-
-
Notifications
You must be signed in to change notification settings - Fork 682
/
EtlTest.java
129 lines (113 loc) · 3.57 KB
/
EtlTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import org.junit.Test;
import org.junit.Ignore;
import java.util.*;
import static org.junit.Assert.assertEquals;
public class EtlTest {
private final Etl etl = new Etl();
@Test
public void testTransformOneValue() {
Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
{
put(1, Arrays.asList("A"));
}
};
old = Collections.unmodifiableMap(old);
Map<String, Integer> expected = new HashMap<String, Integer>() {
{
put("a", 1);
}
};
expected = Collections.unmodifiableMap(expected);
assertEquals(expected, etl.transform(old));
}
@Ignore
@Test
public void testTransformMoreValues() {
Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
{
put(1, Arrays.asList("A", "E", "I", "O", "U"));
}
};
old = Collections.unmodifiableMap(old);
Map<String, Integer> expected = new HashMap<String, Integer>() {
{
put("a", 1);
put("e", 1);
put("i", 1);
put("o", 1);
put("u", 1);
}
};
expected = Collections.unmodifiableMap(expected);
assertEquals(expected, etl.transform(old));
}
@Ignore
@Test
public void testMoreKeys() {
Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
{
put(1, Arrays.asList("A", "E"));
put(2, Arrays.asList("D", "G"));
}
};
old = Collections.unmodifiableMap(old);
Map<String, Integer> expected = new HashMap<String, Integer>() {
{
put("a", 1);
put("e", 1);
put("d", 2);
put("g", 2);
}
};
expected = Collections.unmodifiableMap(expected);
assertEquals(expected, etl.transform(old));
}
@Ignore
@Test
public void testFullDataset() {
Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
{
put(1, Arrays.asList("A", "E", "I", "O", "U", "L", "N", "R", "S", "T"));
put(2, Arrays.asList("D", "G"));
put(3, Arrays.asList("B", "C", "M", "P"));
put(4, Arrays.asList("F", "H", "V", "W", "Y"));
put(5, Arrays.asList("K"));
put(8, Arrays.asList("J", "X"));
put(10, Arrays.asList("Q", "Z"));
}
};
old = Collections.unmodifiableMap(old);
Map<String, Integer> expected = new HashMap<String, Integer>() {
{
put("a", 1);
put("b", 3);
put("c", 3);
put("d", 2);
put("e", 1);
put("f", 4);
put("g", 2);
put("h", 4);
put("i", 1);
put("j", 8);
put("k", 5);
put("l", 1);
put("m", 3);
put("n", 1);
put("o", 1);
put("p", 3);
put("q", 10);
put("r", 1);
put("s", 1);
put("t", 1);
put("u", 1);
put("v", 4);
put("w", 4);
put("x", 8);
put("y", 4);
put("z", 10);
}
};
expected = Collections.unmodifiableMap(expected);
assertEquals(expected, etl.transform(old));
}
}