|
|
@@ -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,24 @@ 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
|
+
|
|
|
17
|
+ public void setUp() {
|
|
|
18
|
+ diamondPrinter = new DiamondPrinter();
|
|
|
19
|
+ }
|
|
|
20
|
+
|
|
13
|
21
|
@Test
|
|
14
|
22
|
public void testOneByOneDiamond() {
|
|
15
|
|
- List<String> output = new DiamondPrinter().printToList('A');
|
|
|
23
|
+ List<String> output = diamondPrinter.printToList('A');
|
|
16
|
24
|
assertThat(output, is(singletonList("A")));
|
|
17
|
25
|
}
|
|
18
|
26
|
|
|
19
|
27
|
@Ignore
|
|
20
|
28
|
@Test
|
|
21
|
29
|
public void testTwoByTwoDiamond() {
|
|
22
|
|
- List<String> output = new DiamondPrinter().printToList('B');
|
|
|
30
|
+ List<String> output = diamondPrinter.printToList('B');
|
|
23
|
31
|
assertThat(output, is(asList(" A ",
|
|
24
|
32
|
"B B",
|
|
25
|
33
|
" A ")));
|
|
|
@@ -28,7 +36,7 @@ public final class DiamondPrinterTest {
|
|
28
|
36
|
@Ignore
|
|
29
|
37
|
@Test
|
|
30
|
38
|
public void testThreeByThreeDiamond() {
|
|
31
|
|
- List<String> output = new DiamondPrinter().printToList('C');
|
|
|
39
|
+ List<String> output = diamondPrinter.printToList('C');
|
|
32
|
40
|
assertThat(output, is(asList(" A ",
|
|
33
|
41
|
" B B ",
|
|
34
|
42
|
"C C",
|
|
|
@@ -39,7 +47,7 @@ public final class DiamondPrinterTest {
|
|
39
|
47
|
@Ignore
|
|
40
|
48
|
@Test
|
|
41
|
49
|
public void testFiveByFiveDiamond() {
|
|
42
|
|
- List<String> output = new DiamondPrinter().printToList('E');
|
|
|
50
|
+ List<String> output = diamondPrinter.printToList('E');
|
|
43
|
51
|
assertThat(output, is(asList(" A ",
|
|
44
|
52
|
" B B ",
|
|
45
|
53
|
" C C ",
|