|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+import org.junit.Ignore;
|
|
|
2
|
+import org.junit.Test;
|
|
|
3
|
+
|
|
|
4
|
+import java.util.List;
|
|
|
5
|
+
|
|
|
6
|
+import static java.util.Arrays.asList;
|
|
|
7
|
+import static java.util.Collections.singletonList;
|
|
|
8
|
+import static org.hamcrest.CoreMatchers.is;
|
|
|
9
|
+import static org.junit.Assert.assertThat;
|
|
|
10
|
+
|
|
|
11
|
+public final class DiamondPrinterTest {
|
|
|
12
|
+
|
|
|
13
|
+ @Test
|
|
|
14
|
+ public void testOneByOneDiamond() {
|
|
|
15
|
+ List<String> output = new DiamondPrinter().printToList('A');
|
|
|
16
|
+ assertThat(output, is(singletonList("A")));
|
|
|
17
|
+ }
|
|
|
18
|
+
|
|
|
19
|
+ @Ignore
|
|
|
20
|
+ @Test
|
|
|
21
|
+ public void testTwoByTwoDiamond() {
|
|
|
22
|
+ List<String> output = new DiamondPrinter().printToList('B');
|
|
|
23
|
+ assertThat(output, is(asList(" A ",
|
|
|
24
|
+ "B B",
|
|
|
25
|
+ " A ")));
|
|
|
26
|
+ }
|
|
|
27
|
+
|
|
|
28
|
+ @Ignore
|
|
|
29
|
+ @Test
|
|
|
30
|
+ public void testThreeByThreeDiamond() {
|
|
|
31
|
+ List<String> output = new DiamondPrinter().printToList('C');
|
|
|
32
|
+ assertThat(output, is(asList(" A ",
|
|
|
33
|
+ " B B ",
|
|
|
34
|
+ "C C",
|
|
|
35
|
+ " B B ",
|
|
|
36
|
+ " A ")));
|
|
|
37
|
+ }
|
|
|
38
|
+
|
|
|
39
|
+ @Ignore
|
|
|
40
|
+ @Test
|
|
|
41
|
+ public void testFiveByFiveDiamond() {
|
|
|
42
|
+ List<String> output = new DiamondPrinter().printToList('E');
|
|
|
43
|
+ assertThat(output, is(asList(" A ",
|
|
|
44
|
+ " B B ",
|
|
|
45
|
+ " C C ",
|
|
|
46
|
+ " D D ",
|
|
|
47
|
+ "E E",
|
|
|
48
|
+ " D D ",
|
|
|
49
|
+ " C C ",
|
|
|
50
|
+ " B B ",
|
|
|
51
|
+ " A ")));
|
|
|
52
|
+ }
|
|
|
53
|
+
|
|
|
54
|
+ @Ignore
|
|
|
55
|
+ @Test
|
|
|
56
|
+ public void testFullDiamond() {
|
|
|
57
|
+ List<String> output = new DiamondPrinter().printToList('Z');
|
|
|
58
|
+ assertThat(output, is(asList(" A ",
|
|
|
59
|
+ " B B ",
|
|
|
60
|
+ " C C ",
|
|
|
61
|
+ " D D ",
|
|
|
62
|
+ " E E ",
|
|
|
63
|
+ " F F ",
|
|
|
64
|
+ " G G ",
|
|
|
65
|
+ " H H ",
|
|
|
66
|
+ " I I ",
|
|
|
67
|
+ " J J ",
|
|
|
68
|
+ " K K ",
|
|
|
69
|
+ " L L ",
|
|
|
70
|
+ " M M ",
|
|
|
71
|
+ " N N ",
|
|
|
72
|
+ " O O ",
|
|
|
73
|
+ " P P ",
|
|
|
74
|
+ " Q Q ",
|
|
|
75
|
+ " R R ",
|
|
|
76
|
+ " S S ",
|
|
|
77
|
+ " T T ",
|
|
|
78
|
+ " U U ",
|
|
|
79
|
+ " V V ",
|
|
|
80
|
+ " W W ",
|
|
|
81
|
+ " X X ",
|
|
|
82
|
+ " Y Y ",
|
|
|
83
|
+ "Z Z",
|
|
|
84
|
+ " Y Y ",
|
|
|
85
|
+ " X X ",
|
|
|
86
|
+ " W W ",
|
|
|
87
|
+ " V V ",
|
|
|
88
|
+ " U U ",
|
|
|
89
|
+ " T T ",
|
|
|
90
|
+ " S S ",
|
|
|
91
|
+ " R R ",
|
|
|
92
|
+ " Q Q ",
|
|
|
93
|
+ " P P ",
|
|
|
94
|
+ " O O ",
|
|
|
95
|
+ " N N ",
|
|
|
96
|
+ " M M ",
|
|
|
97
|
+ " L L ",
|
|
|
98
|
+ " K K ",
|
|
|
99
|
+ " J J ",
|
|
|
100
|
+ " I I ",
|
|
|
101
|
+ " H H ",
|
|
|
102
|
+ " G G ",
|
|
|
103
|
+ " F F ",
|
|
|
104
|
+ " E E ",
|
|
|
105
|
+ " D D ",
|
|
|
106
|
+ " C C ",
|
|
|
107
|
+ " B B ",
|
|
|
108
|
+ " A ")));
|
|
|
109
|
+ }
|
|
|
110
|
+
|
|
|
111
|
+}
|