parent
221c2aea92
commit
20f13467c6
|
@ -23,10 +23,15 @@ import java.util.Map;
|
|||
public class ShoppingCart implements Analysis<Map<List<String>, List<String>>> {
|
||||
|
||||
private Instances instances;
|
||||
private Map<List<String>, List<String>> result;
|
||||
|
||||
@Override
|
||||
public Map<List<String>, List<String>> getResult() {
|
||||
Map<List<String>, List<String>> result = new HashMap<>();
|
||||
if(result != null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = new HashMap<>();
|
||||
|
||||
Apriori model = new Apriori();
|
||||
|
||||
|
|
|
@ -4,13 +4,17 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* Test class for shopping-cart analysis.
|
||||
*
|
||||
* @author Julian Hinxlage
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
*/
|
||||
class ShoppingCartTest {
|
||||
|
@ -23,7 +27,10 @@ class ShoppingCartTest {
|
|||
ShoppingCart cart = new ShoppingCart(new File(url.getFile()));
|
||||
Map<List<String>, List<String>> result = cart.getResult();
|
||||
|
||||
System.out.println(result);
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik")));
|
||||
assertEquals(Collections.singletonList("Elektromaterial"), result.get(Collections.singletonList("Leuchten")));
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Schliesstechnik", "Renovierung")));
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Baustoffe")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -34,7 +41,11 @@ class ShoppingCartTest {
|
|||
ShoppingCart cart = new ShoppingCart(new File(url.getFile()));
|
||||
Map<List<String>, List<String>> result = cart.getResult();
|
||||
|
||||
System.out.println(result);
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Elektromaterial")));
|
||||
assertEquals(Collections.singletonList("Elektromaterial"), result.get(Arrays.asList("Renovierung", "Leuchten")));
|
||||
assertEquals(Collections.singletonList("Sanitaermaterial"), result.get(Arrays.asList("Fliesen", "Armaturen")));
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Renovierung")));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -45,7 +56,11 @@ class ShoppingCartTest {
|
|||
ShoppingCart cart = new ShoppingCart(new File(url.getFile()));
|
||||
Map<List<String>, List<String>> result = cart.getResult();
|
||||
|
||||
System.out.println(result);
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Elektromaterial")));
|
||||
assertEquals(Collections.singletonList("Sanitaermaterial"), result.get(Arrays.asList("Eisenwaren", "Fliesen", "Armaturen")));
|
||||
assertEquals(Collections.singletonList("Elektromaterial"), result.get(Arrays.asList("Renovierung", "Leuchten")));
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Baustoffe")));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue