From f42590f675ec76e8b515aebd2ebf66430435b6bd Mon Sep 17 00:00:00 2001 From: said belhadj Date: Sun, 27 Jun 2021 16:07:27 +0200 Subject: Add unit test for Category and Language --- src/test/java/musichub/business/CategoryTest.java | 25 ++++++++++ src/test/java/musichub/business/LanguageTest.java | 23 +++++++++ .../TEST-musichub.business.CategoryTest.xml | 58 ++++++++++++++++++++++ .../TEST-musichub.business.LanguageTest.xml | 58 ++++++++++++++++++++++ 4 files changed, 164 insertions(+) create mode 100644 src/test/java/musichub/business/CategoryTest.java create mode 100644 src/test/java/musichub/business/LanguageTest.java create mode 100644 target/surefire-reports/TEST-musichub.business.CategoryTest.xml create mode 100644 target/surefire-reports/TEST-musichub.business.LanguageTest.xml diff --git a/src/test/java/musichub/business/CategoryTest.java b/src/test/java/musichub/business/CategoryTest.java new file mode 100644 index 0000000..f1fef50 --- /dev/null +++ b/src/test/java/musichub/business/CategoryTest.java @@ -0,0 +1,25 @@ +package musichub.business; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +public class CategoryTest { + + @Test + void testGetter() { + + String t1 = "t1"; + String a1 = "a1"; + int l1 = 1; + String c1 = a1+" - "+t1; + String lan1 = "french"; + String cat1 = "novel"; + AudioBook s1 = new AudioBook(t1, a1, l1, c1, lan1, cat1); + + assertEquals(s1.getCategory(), Category.NOVEL); + s1.setCategory("NOVEL"); + assertEquals(s1.getCategory(), Category.NOVEL); + } +} diff --git a/src/test/java/musichub/business/LanguageTest.java b/src/test/java/musichub/business/LanguageTest.java new file mode 100644 index 0000000..93e9d1c --- /dev/null +++ b/src/test/java/musichub/business/LanguageTest.java @@ -0,0 +1,23 @@ +package musichub.business; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class LanguageTest { + @Test + void testGetter() { + + String t1 = "t1"; + String a1 = "a1"; + int l1 = 1; + String c1 = a1+" - "+t1; + String lan1 = "FRENCH"; + String cat1 = "novel"; + AudioBook s1 = new AudioBook(t1, a1, l1, c1, lan1, cat1); + assertEquals(s1.getLanguage(), Language.FRENCH); + s1.setLanguage("french"); + assertEquals(s1.getLanguage(), Language.FRENCH); + } + +} diff --git a/target/surefire-reports/TEST-musichub.business.CategoryTest.xml b/target/surefire-reports/TEST-musichub.business.CategoryTest.xml new file mode 100644 index 0000000..706f15d --- /dev/null +++ b/target/surefire-reports/TEST-musichub.business.CategoryTest.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/surefire-reports/TEST-musichub.business.LanguageTest.xml b/target/surefire-reports/TEST-musichub.business.LanguageTest.xml new file mode 100644 index 0000000..088ebdd --- /dev/null +++ b/target/surefire-reports/TEST-musichub.business.LanguageTest.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3