Skip to content
Snippets Groups Projects
Commit d52906e6 authored by Torstein Strømme's avatar Torstein Strømme
Browse files

Ny test for getCells -metoden som inkluderer null

parent 0b6e3e40
No related branches found
No related tags found
No related merge requests found
......@@ -91,6 +91,28 @@ public class TestColorGrid {
}
}
@Test
public void testGetCellsWithNull() {
IColorGrid grid = new WColorGrid(3, 1);
grid.set(new CellPosition(2, 0), Color.GREEN);
List<CellColor> expected = Arrays.asList(
new CellColor(new CellPosition(0, 0), null),
new CellColor(new CellPosition(1, 0), null),
new CellColor(new CellPosition(2, 0), Color.GREEN)
);
List<CellColor> actual = grid.getCells();
assertEquals(expected.size(), actual.size());
for (CellColor cp : actual) {
assertTrue(expected.contains(cp));
}
for (CellColor cp : expected) {
assertTrue(actual.contains(cp));
}
}
@Test
public void testIndexOutOfBoundsException() {
IColorGrid grid = new WColorGrid(10, 20);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment