|
|
@@ -1,4 +1,5 @@
|
|
1
|
1
|
import org.junit.Ignore;
|
|
|
2
|
+import org.junit.Before;
|
|
2
|
3
|
import org.junit.Test;
|
|
3
|
4
|
|
|
4
|
5
|
import java.util.List;
|
|
|
@@ -9,17 +10,23 @@ import static org.hamcrest.CoreMatchers.is;
|
|
9
|
10
|
import static org.junit.Assert.assertThat;
|
|
10
|
11
|
|
|
11
|
12
|
public final class DiamondPrinterTest {
|
|
12
|
|
-
|
|
|
13
|
+ private DiamondPrinter diamondPrinter;
|
|
|
14
|
+
|
|
|
15
|
+ @Before
|
|
|
16
|
+ public void setUp() {
|
|
|
17
|
+ diamondPrinter = new DiamondPrinter();
|
|
|
18
|
+ }
|
|
|
19
|
+
|
|
13
|
20
|
@Test
|
|
14
|
21
|
public void testOneByOneDiamond() {
|
|
15
|
|
- List<String> output = new DiamondPrinter().printToList('A');
|
|
|
22
|
+ List<String> output = diamondPrinter.printToList('A');
|
|
16
|
23
|
assertThat(output, is(singletonList("A")));
|
|
17
|
24
|
}
|
|
18
|
25
|
|
|
19
|
26
|
@Ignore
|
|
20
|
27
|
@Test
|
|
21
|
28
|
public void testTwoByTwoDiamond() {
|
|
22
|
|
- List<String> output = new DiamondPrinter().printToList('B');
|
|
|
29
|
+ List<String> output = diamondPrinter.printToList('B');
|
|
23
|
30
|
assertThat(output, is(asList(" A ",
|
|
24
|
31
|
"B B",
|
|
25
|
32
|
" A ")));
|
|
|
@@ -28,7 +35,7 @@ public final class DiamondPrinterTest {
|
|
28
|
35
|
@Ignore
|
|
29
|
36
|
@Test
|
|
30
|
37
|
public void testThreeByThreeDiamond() {
|
|
31
|
|
- List<String> output = new DiamondPrinter().printToList('C');
|
|
|
38
|
+ List<String> output = diamondPrinter.printToList('C');
|
|
32
|
39
|
assertThat(output, is(asList(" A ",
|
|
33
|
40
|
" B B ",
|
|
34
|
41
|
"C C",
|
|
|
@@ -39,7 +46,7 @@ public final class DiamondPrinterTest {
|
|
39
|
46
|
@Ignore
|
|
40
|
47
|
@Test
|
|
41
|
48
|
public void testFiveByFiveDiamond() {
|
|
42
|
|
- List<String> output = new DiamondPrinter().printToList('E');
|
|
|
49
|
+ List<String> output = diamondPrinter.printToList('E');
|
|
43
|
50
|
assertThat(output, is(asList(" A ",
|
|
44
|
51
|
" B B ",
|
|
45
|
52
|
" C C ",
|
|
|
@@ -54,7 +61,7 @@ public final class DiamondPrinterTest {
|
|
54
|
61
|
@Ignore
|
|
55
|
62
|
@Test
|
|
56
|
63
|
public void testFullDiamond() {
|
|
57
|
|
- List<String> output = new DiamondPrinter().printToList('Z');
|
|
|
64
|
+ List<String> output = diamondPrinter.printToList('Z');
|
|
58
|
65
|
assertThat(output, is(asList(" A ",
|
|
59
|
66
|
" B B ",
|
|
60
|
67
|
" C C ",
|