forked from exercism/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAtbashTest.java
More file actions
68 lines (57 loc) · 2.09 KB
/
Copy pathAtbashTest.java
File metadata and controls
68 lines (57 loc) · 2.09 KB
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
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
@RunWith(Enclosed.class)
public class AtbashTest {
@RunWith(Parameterized.class)
public static class EncodeTest {
private String input;
private String expectedOutput;
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{ "no", "ml" },
{ "yes", "bvh" },
{ "OMG", "lnt" },
{ "mindblowingly", "nrmwy oldrm tob" },
{ "Testing, 1 2 3, testing.", "gvhgr mt123 gvhgr mt" },
{ "Truth is fiction.", "gifgs rhurx grlm" },
{ "The quick brown fox jumps over the lazy dog.", "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" }
});
}
public EncodeTest(String input, String expectedOutput) {
this.input = input;
this.expectedOutput = expectedOutput;
}
@Test
public void test() {
assertEquals(expectedOutput, Atbash.encode(input));
}
}
@RunWith(Parameterized.class)
public static class DecodeTest {
private String input;
private String expectedOutput;
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{ "vcvix rhn", "exercism" },
{ "zmlyh gzxov rhlug vmzhg vkkrm thglm v", "anobstacleisoftenasteppingstone" },
{ "gvhgr mt123 gvhgr mt", "testing123testing" }
});
}
public DecodeTest(String input, String expectedOutput) {
this.input = input;
this.expectedOutput = expectedOutput;
}
@Test
public void test() {
assertEquals(expectedOutput, Atbash.decode(input));
}
}
}