import org.junit.Ignore; import org.junit.Test; import java.util.Arrays; import java.util.Collections; import java.util.List; import static org.junit.Assert.assertEquals; public class MinesweeperBoardTest { @Test public void testInputBoardWithNoRowsAndNoColumns() { List inputBoard = Collections.emptyList(); List expectedNumberedBoard = Collections.emptyList(); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithOneRowAndNoColumns() { List inputBoard = Collections.singletonList(""); List expectedNumberedBoard = Collections.singletonList(""); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithNoMines() { List inputBoard = Arrays.asList( " ", " ", " " ); List expectedNumberedBoard = Arrays.asList( " ", " ", " " ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithOnlyMines() { List inputBoard = Arrays.asList( "***", "***", "***" ); List expectedNumberedBoard = Arrays.asList( "***", "***", "***" ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithSingleMineAtCenter() { List inputBoard = Arrays.asList( " ", " * ", " " ); List expectedNumberedBoard = Arrays.asList( "111", "1*1", "111" ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithMinesAroundPerimeter() { List inputBoard = Arrays.asList( "***", "* *", "***" ); List expectedNumberedBoard = Arrays.asList( "***", "*8*", "***" ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithSingleRowAndTwoMines() { List inputBoard = Collections.singletonList( " * * " ); List expectedNumberedBoard = Collections.singletonList( "1*2*1" ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithSingleRowAndTwoMinesAtEdges() { List inputBoard = Collections.singletonList( "* *" ); List expectedNumberedBoard = Collections.singletonList( "*1 1*" ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithSingleColumnAndTwoMines() { List inputBoard = Arrays.asList( " ", "*", " ", "*", " " ); List expectedNumberedBoard = Arrays.asList( "1", "*", "2", "*", "1" ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithSingleColumnAndTwoMinesAtEdges() { List inputBoard = Arrays.asList( "*", " ", " ", " ", "*" ); List expectedNumberedBoard = Arrays.asList( "*", "1", " ", "1", "*" ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testInputBoardWithMinesInCross() { List inputBoard = Arrays.asList( " * ", " * ", "*****", " * ", " * " ); List expectedNumberedBoard = Arrays.asList( " 2*2 ", "25*52", "*****", "25*52", " 2*2 " ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } @Ignore("Remove to run test") @Test public void testLargeInputBoard() { List inputBoard = Arrays.asList( " * * ", " * ", " * ", " * *", " * * ", " " ); List expectedNumberedBoard = Arrays.asList( "1*22*1", "12*322", " 123*2", "112*4*", "1*22*2", "111111" ); List actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers(); assertEquals(expectedNumberedBoard, actualNumberedBoard); } }