tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java in trackler-2.0.8.28 vs tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java in trackler-2.0.8.29
- old
+ new
@@ -1,47 +1,54 @@
import org.junit.Ignore;
+import org.junit.Before;
import org.junit.Test;
import java.util.List;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public final class DiamondPrinterTest {
-
+ private DiamondPrinter diamondPrinter;
+
+ @Before
+ public void setUp() {
+ diamondPrinter = new DiamondPrinter();
+ }
+
@Test
public void testOneByOneDiamond() {
- List<String> output = new DiamondPrinter().printToList('A');
+ List<String> output = diamondPrinter.printToList('A');
assertThat(output, is(singletonList("A")));
}
@Ignore
@Test
public void testTwoByTwoDiamond() {
- List<String> output = new DiamondPrinter().printToList('B');
+ List<String> output = diamondPrinter.printToList('B');
assertThat(output, is(asList(" A ",
"B B",
" A ")));
}
@Ignore
@Test
public void testThreeByThreeDiamond() {
- List<String> output = new DiamondPrinter().printToList('C');
+ List<String> output = diamondPrinter.printToList('C');
assertThat(output, is(asList(" A ",
" B B ",
"C C",
" B B ",
" A ")));
}
@Ignore
@Test
public void testFiveByFiveDiamond() {
- List<String> output = new DiamondPrinter().printToList('E');
+ List<String> output = diamondPrinter.printToList('E');
assertThat(output, is(asList(" A ",
" B B ",
" C C ",
" D D ",
"E E",
@@ -52,10 +59,10 @@
}
@Ignore
@Test
public void testFullDiamond() {
- List<String> output = new DiamondPrinter().printToList('Z');
+ List<String> output = diamondPrinter.printToList('Z');
assertThat(output, is(asList(" A ",
" B B ",
" C C ",
" D D ",
" E E ",