From 3ccad0d8370416fa9d2881dc38a1987cc67651c8 Mon Sep 17 00:00:00 2001 From: Karsten Date: Sun, 5 May 2019 18:56:10 +0200 Subject: [PATCH] Test Cases --- .../baudas/analysis/TopFlopArticlesTest.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/test/java/de/hsel/spm/baudas/analysis/TopFlopArticlesTest.java diff --git a/src/test/java/de/hsel/spm/baudas/analysis/TopFlopArticlesTest.java b/src/test/java/de/hsel/spm/baudas/analysis/TopFlopArticlesTest.java new file mode 100644 index 0000000..b81f4a2 --- /dev/null +++ b/src/test/java/de/hsel/spm/baudas/analysis/TopFlopArticlesTest.java @@ -0,0 +1,57 @@ +package de.hsel.spm.baudas.analysis; + +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.net.URL; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class TopFlopArticlesTest { + + @Test + void test100() { + URL url = getClass().getClassLoader().getResource("kd100.csv"); + assert url != null; + TopFlopArticle tfArticle = new TopFlopArticle(new File(url.getFile())); + Map results = tfArticle.getResult(); + + assertEquals(529, results.get("Farben")); + assertEquals(2403, results.get("Elektrowerkzeuge")); + assertEquals(8055, results.get("Baustoffe")); + assertEquals(5414, results.get("Fliesen")); + assertEquals(1466, results.get("Holz")); + + } + + @Test + void test1000() { + URL url = getClass().getClassLoader().getResource("kd1000.csv"); + assert url != null; + TopFlopArticle tfArticle = new TopFlopArticle(new File(url.getFile())); + Map results = tfArticle.getResult(); + + assertEquals(5643, results.get("Eisenwaren")); + assertEquals(9339, results.get("Bodenbelag")); + assertEquals(12824, results.get("Gartengeraete")); + assertEquals(29055, results.get("Sanitaermaterial")); + assertEquals(50067, results.get("Armaturen")); + + } + + @Test + void test10000() { + URL url = getClass().getClassLoader().getResource("kd10000.csv"); + assert url != null; + TopFlopArticle tfArticle = new TopFlopArticle(new File(url.getFile())); + Map results = tfArticle.getResult(); + + assertEquals(101665, results.get("Handwerkzeuge")); + assertEquals(151920, results.get("Leuchten")); + assertEquals(231881, results.get("Schliesstechnik")); + assertEquals(294053, results.get("Elektromaterial")); + assertEquals(543613, results.get("Renovierung")); + + } +}