From 67ed18fe86ddfabe5f6c6c270273597799722a72 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sat, 26 Jun 2021 22:07:53 +0200 Subject: Tests are ok fully covered. --- log/spoteezer.log | 5 +- src/main/java/musichub/util/LogHandler.java | 12 + src/test/java/musichub/util/LogHandlerTest.java | 41 +++ target/jacoco.exec | Bin 80650 -> 27236 bytes target/maven-archiver/pom.properties | 2 +- target/maven-javadoc-plugin-stale-data.txt | 39 +- .../compile/default-compile/createdFiles.lst | 3 +- .../compile/default-compile/inputFiles.lst | 3 +- .../default-testCompile/createdFiles.lst | 3 +- .../testCompile/default-testCompile/inputFiles.lst | 3 +- target/original-spoteezer-0.1.0.jar | Bin 31900 -> 33244 bytes target/site/apidocs/allclasses-index.html | 32 +- target/site/apidocs/allpackages-index.html | 2 +- target/site/apidocs/help-doc.html | 2 +- target/site/apidocs/index-all.html | 31 +- target/site/apidocs/index.html | 2 +- target/site/apidocs/member-search-index.js | 2 +- target/site/apidocs/musichub/business/Album.html | 2 +- .../site/apidocs/musichub/business/AudioBook.html | 2 +- .../apidocs/musichub/business/AudioElement.html | 2 +- .../site/apidocs/musichub/business/Category.html | 2 +- target/site/apidocs/musichub/business/Genre.html | 2 +- .../site/apidocs/musichub/business/Language.html | 2 +- .../site/apidocs/musichub/business/MusicHub.html | 2 +- .../musichub/business/NoAlbumFoundException.html | 2 +- .../musichub/business/NoElementFoundException.html | 2 +- .../business/NoPlayListFoundException.html | 2 +- .../apidocs/musichub/business/PathValidation.html | 189 ---------- .../site/apidocs/musichub/business/PlayList.html | 2 +- target/site/apidocs/musichub/business/Song.html | 2 +- .../apidocs/musichub/business/class-use/Album.html | 2 +- .../musichub/business/class-use/AudioBook.html | 2 +- .../musichub/business/class-use/AudioElement.html | 2 +- .../musichub/business/class-use/Category.html | 2 +- .../apidocs/musichub/business/class-use/Genre.html | 2 +- .../musichub/business/class-use/Language.html | 2 +- .../musichub/business/class-use/MusicHub.html | 2 +- .../business/class-use/NoAlbumFoundException.html | 2 +- .../class-use/NoElementFoundException.html | 2 +- .../class-use/NoPlayListFoundException.html | 2 +- .../business/class-use/PathValidation.html | 65 ---- .../musichub/business/class-use/PlayList.html | 2 +- .../apidocs/musichub/business/class-use/Song.html | 2 +- .../apidocs/musichub/business/package-summary.html | 12 +- .../apidocs/musichub/business/package-tree.html | 3 +- .../apidocs/musichub/business/package-use.html | 2 +- target/site/apidocs/musichub/main/Main.html | 2 +- .../site/apidocs/musichub/main/class-use/Main.html | 2 +- .../apidocs/musichub/main/package-summary.html | 2 +- .../site/apidocs/musichub/main/package-tree.html | 2 +- target/site/apidocs/musichub/main/package-use.html | 2 +- target/site/apidocs/musichub/util/XMLHandler.html | 2 +- .../musichub/util/class-use/XMLHandler.html | 2 +- .../apidocs/musichub/util/package-summary.html | 10 +- .../site/apidocs/musichub/util/package-tree.html | 4 +- target/site/apidocs/musichub/util/package-use.html | 2 +- target/site/apidocs/overview-summary.html | 2 +- target/site/apidocs/overview-tree.html | 5 +- target/site/apidocs/serialized-form.html | 2 +- target/site/apidocs/type-search-index.js | 2 +- target/site/jacoco/index.html | 2 +- target/site/jacoco/jacoco-sessions.html | 2 +- target/site/jacoco/jacoco.csv | 5 +- target/site/jacoco/jacoco.xml | 2 +- .../jacoco/musichub.business/PathValidation.html | 1 - .../musichub.business/PathValidation.java.html | 39 -- target/site/jacoco/musichub.business/index.html | 2 +- .../jacoco/musichub.business/index.source.html | 2 +- target/site/jacoco/musichub.main/Main.html | 2 +- target/site/jacoco/musichub.main/Main.java.html | 410 +++++++++++---------- target/site/jacoco/musichub.main/index.html | 2 +- target/site/jacoco/musichub.main/index.source.html | 2 +- target/site/jacoco/musichub.util/index.html | 2 +- target/site/jacoco/musichub.util/index.source.html | 2 +- target/spoteezer-0.1.0.jar | Bin 367786 -> 369146 bytes .../TEST-musichub.business.PathValidationTest.xml | 60 --- .../musichub.business.PathValidationTest.txt | 4 - 77 files changed, 412 insertions(+), 669 deletions(-) create mode 100644 src/test/java/musichub/util/LogHandlerTest.java delete mode 100644 target/site/apidocs/musichub/business/PathValidation.html delete mode 100644 target/site/apidocs/musichub/business/class-use/PathValidation.html delete mode 100644 target/site/jacoco/musichub.business/PathValidation.html delete mode 100644 target/site/jacoco/musichub.business/PathValidation.java.html delete mode 100644 target/surefire-reports/TEST-musichub.business.PathValidationTest.xml delete mode 100644 target/surefire-reports/musichub.business.PathValidationTest.txt diff --git a/log/spoteezer.log b/log/spoteezer.log index 091f5e0..834e29f 100644 --- a/log/spoteezer.log +++ b/log/spoteezer.log @@ -1,3 +1,6 @@ [yyyy-MM-dd HH:mm:ss.SSS] TYPE: Message [2021-06-26 21:37:09.507] WARNING: The music file was not found with the path you've provided. -[2021-06-26 21:45:11.453] WARNING: The music file was not found with the path you've provided. \ No newline at end of file +[2021-06-26 21:45:11.453] WARNING: The music file was not found with the path you've provided. +[2021-06-26 22:05:28.614] INFO: JUnit test +[2021-06-26 22:06:26.191] INFO: JUnit test +[2021-06-26 22:06:38.453] INFO: JUnit test \ No newline at end of file diff --git a/src/main/java/musichub/util/LogHandler.java b/src/main/java/musichub/util/LogHandler.java index f6522f5..988b149 100644 --- a/src/main/java/musichub/util/LogHandler.java +++ b/src/main/java/musichub/util/LogHandler.java @@ -26,6 +26,13 @@ public final class 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()); @@ -42,6 +49,11 @@ public final class LogHandler { } + /** + * 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"); diff --git a/src/test/java/musichub/util/LogHandlerTest.java b/src/test/java/musichub/util/LogHandlerTest.java new file mode 100644 index 0000000..17b47f6 --- /dev/null +++ b/src/test/java/musichub/util/LogHandlerTest.java @@ -0,0 +1,41 @@ +package musichub.util; + + +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static musichub.util.LogHandler.read; +import static musichub.util.LogHandler.write; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class LogHandlerTest { + @Test + void testWrite() { + try { + write("JUnit test", "INFO"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Test + void testRead() { + try { + read(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Test + void testLogHandlerClass() { + try { + LogHandler logHandlerClass = new LogHandler(); + } catch (Error ex) { + assertTrue(ex instanceof AssertionError); + assertEquals("You just can't instantiate this class.", ex.getMessage()); + } + } +} diff --git a/target/jacoco.exec b/target/jacoco.exec index a11f908..5deaa95 100644 Binary files a/target/jacoco.exec and b/target/jacoco.exec differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties index 1d6eb92..9bf0389 100644 --- a/target/maven-archiver/pom.properties +++ b/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Sat Jun 26 14:29:09 CEST 2021 +#Sat Jun 26 22:06:26 CEST 2021 groupId=esiea.softwareengineering artifactId=spoteezer version=0.1.0 diff --git a/target/maven-javadoc-plugin-stale-data.txt b/target/maven-javadoc-plugin-stale-data.txt index 211d1c0..e5ff7a2 100644 --- a/target/maven-javadoc-plugin-stale-data.txt +++ b/target/maven-javadoc-plugin-stale-data.txt @@ -34,10 +34,11 @@ 'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/business/NoAlbumFoundException.java' 'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/business/NoElementFoundException.java' 'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/business/NoPlayListFoundException.java' -'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/business/PathValidation.java' 'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/business/PlayList.java' 'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/business/Song.java' 'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/main/Main.java' +'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/util/LogHandler.java' +'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/util/PathValidation.java' 'C:/Users/SoftA/Documents/spoteezer/src/main/java/musichub/util/XMLHandler.java' C:\Users\SoftA\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.0.2\junit-jupiter-api-5.0.2.jar = 1624015816799 C:\Users\SoftA\.m2\repository\org\opentest4j\opentest4j\1.0.0\opentest4j-1.0.0.jar = 1624015816785 @@ -45,21 +46,21 @@ C:\Users\SoftA\.m2\repository\org\junit\platform\junit-platform-commons\1.0.2\ju C:\Users\SoftA\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.0.2\junit-jupiter-engine-5.0.2.jar = 1624015816790 C:\Users\SoftA\.m2\repository\org\junit\platform\junit-platform-engine\1.0.2\junit-platform-engine-1.0.2.jar = 1624015816783 C:\Users\SoftA\Documents\spoteezer\src\main\java = 1624708123937 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\allclasses-index.html = 1624710556861 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\allpackages-index.html = 1624710556864 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\element-list = 1624710556758 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\help-doc.html = 1624710556888 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\index-all.html = 1624710556884 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\index.html = 1624710556844 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\jquery-ui.overrides.css = 1624710556910 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\member-search-index.js = 1624710556868 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\module-search-index.js = 1624710556865 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\overview-summary.html = 1624710556885 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\overview-tree.html = 1624710556841 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\package-search-index.js = 1624710556866 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\script.js = 1624710556892 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\search.js = 1624710556895 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\serialized-form.html = 1624710556785 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\stylesheet.css = 1624710556891 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\tag-search-index.js = 1624710556869 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\type-search-index.js = 1624710556867 \ No newline at end of file +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\allclasses-index.html = 1624737994231 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\allpackages-index.html = 1624737994233 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\element-list = 1624737994134 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\help-doc.html = 1624737994257 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\index-all.html = 1624737994253 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\index.html = 1624737994214 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\jquery-ui.overrides.css = 1624737994280 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\member-search-index.js = 1624737994238 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\module-search-index.js = 1624737994234 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\overview-summary.html = 1624737994255 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\overview-tree.html = 1624737994211 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\package-search-index.js = 1624737994235 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\script.js = 1624737994260 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\search.js = 1624737994263 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\serialized-form.html = 1624737994156 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\stylesheet.css = 1624737994259 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\tag-search-index.js = 1624737994239 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\type-search-index.js = 1624737994236 \ No newline at end of file diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 26c13ed..acee52e 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,6 +1,6 @@ musichub\util\XMLHandler.class -musichub\business\PathValidation.class musichub\business\NoElementFoundException.class +musichub\util\LogHandler.class musichub\business\Language.class musichub\business\PlayList.class musichub\main\Main.class @@ -11,6 +11,7 @@ musichub\business\SortByAuthor.class musichub\business\NoAlbumFoundException.class musichub\business\AudioBook.class musichub\business\Song.class +musichub\util\PathValidation.class musichub\business\Genre.class musichub\business\NoPlayListFoundException.class musichub\business\Category.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 93f6593..a533945 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -5,9 +5,10 @@ C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\main\Main.java C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\business\AudioBook.java C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\business\Language.java C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\business\MusicHub.java +C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\util\LogHandler.java +C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\util\PathValidation.java C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\business\Album.java C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\business\AudioElement.java -C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\business\PathValidation.java C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\business\Category.java C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\business\NoAlbumFoundException.java C:\Users\SoftA\Documents\spoteezer\src\main\java\musichub\business\NoPlayListFoundException.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst index 649a939..13c2c99 100644 --- a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -1 +1,2 @@ -musichub\business\PathValidationTest.class +musichub\util\PathValidationTest.class +musichub\util\LogHandlerTest.class diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst index 9b5d3f0..1b9eea3 100644 --- a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -1 +1,2 @@ -C:\Users\SoftA\Documents\spoteezer\src\test\java\musichub\business\PathValidationTest.java +C:\Users\SoftA\Documents\spoteezer\src\test\java\musichub\util\LogHandlerTest.java +C:\Users\SoftA\Documents\spoteezer\src\test\java\musichub\util\PathValidationTest.java diff --git a/target/original-spoteezer-0.1.0.jar b/target/original-spoteezer-0.1.0.jar index fbeb8a5..e14293d 100644 Binary files a/target/original-spoteezer-0.1.0.jar and b/target/original-spoteezer-0.1.0.jar differ diff --git a/target/site/apidocs/allclasses-index.html b/target/site/apidocs/allclasses-index.html index 767b8ab..e4d9f65 100644 --- a/target/site/apidocs/allclasses-index.html +++ b/target/site/apidocs/allclasses-index.html @@ -2,7 +2,7 @@ - + All Classes (spoteezer 0.1.0 API) @@ -76,26 +76,30 @@ loadScripts(document, 'script');
 
Language
 
-
Main
-
 
-
MusicHub
+
LogHandler
+
+
Class offering a log writing method.
+
+
Main
 
-
NoAlbumFoundException
-
 
-
NoElementFoundException
+
MusicHub
+
 
+
NoAlbumFoundException
 
-
NoPlayListFoundException
+
NoElementFoundException
 
-
PathValidation
-
+ +
 
+ +
Class offering a path validation method.
- -
 
- +
 
- +
 
+ +
 
diff --git a/target/site/apidocs/allpackages-index.html b/target/site/apidocs/allpackages-index.html index daffbfc..1670da5 100644 --- a/target/site/apidocs/allpackages-index.html +++ b/target/site/apidocs/allpackages-index.html @@ -2,7 +2,7 @@ - + All Packages (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/help-doc.html b/target/site/apidocs/help-doc.html index 084eeb0..4d85c2b 100644 --- a/target/site/apidocs/help-doc.html +++ b/target/site/apidocs/help-doc.html @@ -2,7 +2,7 @@ - + API Help (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/index-all.html b/target/site/apidocs/index-all.html index bb26bd1..0df0f51 100644 --- a/target/site/apidocs/index-all.html +++ b/target/site/apidocs/index-all.html @@ -2,7 +2,7 @@ - + Index (spoteezer 0.1.0 API) @@ -54,7 +54,7 @@ loadScripts(document, 'script');

Index

-A C D E F G H I J L M N P R S T U V X Y 
All Classes|All Packages|Serialized Form +A C D E F G H I J L M N P R S T U V W X Y 
All Classes|All Packages|Serialized Form

A

addAlbum(Album) - Method in class musichub.business.MusicHub
@@ -202,7 +202,7 @@ loadScripts(document, 'script');

I

-
isPathValid(String) - Static method in class musichub.business.PathValidation
+
isPathValid(String) - Static method in class musichub.util.PathValidation
Method that checks the validity of a given path
@@ -220,6 +220,14 @@ loadScripts(document, 'script');
 
lengthInSeconds - Variable in class musichub.business.AudioElement
 
+
LogHandler - Class in musichub.util
+
+
Class offering a log writing method.
+
+
LogHandler() - Constructor for class musichub.util.LogHandler
+
+
Method that just throws an AssertionError if the class is called
+

M

@@ -263,11 +271,11 @@ loadScripts(document, 'script');
parseXMLFile(String) - Method in class musichub.util.XMLHandler
 
-
PathValidation - Class in musichub.business
+
PathValidation - Class in musichub.util
Class offering a path validation method.
-
PathValidation() - Constructor for class musichub.business.PathValidation
+
PathValidation() - Constructor for class musichub.util.PathValidation
Method that just throws an AssertionError if the class is called
@@ -290,6 +298,10 @@ loadScripts(document, 'script');
RAP - Enum constant in enum class musichub.business.Genre
 
+
read() - Static method in class musichub.util.LogHandler
+
+
Method that prints the content of spoteezer.log
+
ROCK - Enum constant in enum class musichub.business.Genre
 
@@ -368,6 +380,13 @@ the order they are declared. the order they are declared.
+

W

+
+
write(String, String) - Static method in class musichub.util.LogHandler
+
+
Method that writes a log message to spoteezer.log
+
+

X

XMLHandler - Class in musichub.util
@@ -380,7 +399,7 @@ the order they are declared.
YOUTH - Enum constant in enum class musichub.business.Category
 
-A C D E F G H I J L M N P R S T U V X Y 
All Classes|All Packages|Serialized Form +A C D E F G H I J L M N P R S T U V W X Y 
All Classes|All Packages|Serialized Form