From 9a234079437a1532072ed5f0bce0203922719b0f Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sun, 27 Jun 2021 12:54:48 +0200 Subject: Fix : Javadoc missing --- target/site/jacoco/musichub.util/LogHandler.html | 1 + .../site/jacoco/musichub.util/LogHandler.java.html | 69 ++++++++++++++++++++++ .../site/jacoco/musichub.util/PathValidation.html | 1 + .../jacoco/musichub.util/PathValidation.java.html | 40 +++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 target/site/jacoco/musichub.util/LogHandler.html create mode 100644 target/site/jacoco/musichub.util/LogHandler.java.html create mode 100644 target/site/jacoco/musichub.util/PathValidation.html create mode 100644 target/site/jacoco/musichub.util/PathValidation.java.html (limited to 'target/site/jacoco') diff --git a/target/site/jacoco/musichub.util/LogHandler.html b/target/site/jacoco/musichub.util/LogHandler.html new file mode 100644 index 0000000..b1e3f2b --- /dev/null +++ b/target/site/jacoco/musichub.util/LogHandler.html @@ -0,0 +1 @@ +LogHandler

LogHandler

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 46100 %0 of 0n/a0301103
write(String, String)26100 %n/a010501
read()13100 %n/a010401
LogHandler()7100 %n/a010201
\ No newline at end of file diff --git a/target/site/jacoco/musichub.util/LogHandler.java.html b/target/site/jacoco/musichub.util/LogHandler.java.html new file mode 100644 index 0000000..020c8f3 --- /dev/null +++ b/target/site/jacoco/musichub.util/LogHandler.java.html @@ -0,0 +1,69 @@ +LogHandler.java

LogHandler.java

package musichub.util;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+import java.sql.Timestamp;
+
+/**
+ * Class offering a log writing method.
+ *
+ * @author Aimeric ADJUTOR
+ * @version 1.0
+ */
+
+public final class LogHandler {
+
+    /**
+     * Method that just throws an AssertionError if the class is called
+     *
+     * @throws AssertionError you can't instantiate this class
+     * @author Aimeric ADJUTOR
+     */
+
+    public LogHandler() {
+        throw new AssertionError("You just can't instantiate this class.");
+    }
+
+    /**
+     * Method that writes a log message to spoteezer.log
+     *
+     * @param msg  the message to write
+     * @param type the type of log
+     * @throws IOException if the file's not there
+     */
+    public static void write(String msg, String type) throws IOException {
+
+        Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+
+        //Create the log using the given message
+        String logMsg = "\n[" + timestamp + "] " + type + ": " + msg;
+
+        // Define the file name of the file
+        Path fileName = Path.of("log/spoteezer.log");
+
+        // Write into the file
+        Files.writeString(fileName, logMsg, StandardOpenOption.APPEND);
+
+
+    }
+
+    /**
+     * Method that prints the content of spoteezer.log
+     *
+     * @throws IOException if the file's not there
+     */
+    public static void read() throws IOException {
+        Path fileName = Path.of("log/spoteezer.log");
+
+        // Read the content of the file
+        String file_content = Files.readString(fileName);
+
+        // Print the content inside the file
+        System.out.println("\n" + file_content + "\n");
+
+    }
+
+}
+
\ No newline at end of file diff --git a/target/site/jacoco/musichub.util/PathValidation.html b/target/site/jacoco/musichub.util/PathValidation.html new file mode 100644 index 0000000..940af0e --- /dev/null +++ b/target/site/jacoco/musichub.util/PathValidation.html @@ -0,0 +1 @@ +PathValidation

PathValidation

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total0 of 17100 %0 of 0n/a020402
isPathValid(String)10100 %n/a010201
PathValidation()7100 %n/a010201
\ No newline at end of file diff --git a/target/site/jacoco/musichub.util/PathValidation.java.html b/target/site/jacoco/musichub.util/PathValidation.java.html new file mode 100644 index 0000000..7cb31d4 --- /dev/null +++ b/target/site/jacoco/musichub.util/PathValidation.java.html @@ -0,0 +1,40 @@ +PathValidation.java

PathValidation.java

package musichub.util;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * Class offering a path validation method.
+ *
+ * @author Aimeric ADJUTOR
+ * @version 1.0
+ */
+
+public final class PathValidation {
+
+    /**
+     * Method that just throws an AssertionError if the class is called
+     *
+     * @throws AssertionError you can't instantiate this class
+     * @author Aimeric ADJUTOR
+     */
+
+    public PathValidation() {
+        throw new AssertionError("You just can't instantiate this class.");
+    }
+
+    /**
+     * Method that checks the validity of a given path
+     *
+     * @param inputPath the path given by the user
+     * @return a boolean
+     */
+
+    public static boolean isPathValid(String inputPath) {
+        Path path = Paths.get(inputPath);
+        return Files.exists(path);
+    }
+
+}
+
\ No newline at end of file -- cgit v1.2.3