Board implements IBoard { public void openAllFlaggedOrBomb() { for (Field field : itsFields) if (field.isBomb() || field.isFlagged()) field.setOpen(true); } Board(final int dimX, final int dimY); private  Board(final BoardState state); @Override IField getField(final int x, final int y); @Override Point getDimension(); @Override int getFlagCount(); @Override int getOpenCount(); void openAllFlaggedOrBomb(); @Override String toString(); @Override Point getPosition(final IField field); @Override boolean isOverflagged(); boolean isExploded(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testOpenAllFlaggedOrBomb() { flag(0, 0); bomb(0, 1); itsBoard.openAllFlaggedOrBomb(); Point dimension = itsBoard.getDimension(); int count = 0; for (int i = 0; i < dimension.x; i++) for (int j = 0; j < dimension.y; j++) { IField field = itsBoard.getField(i, j); if (field.isOpen()) { count++; assertTrue(field.isFlagged() || field.isBomb()); } } assertEquals(2, count); }