Puzzle { public void setNumber(Point point, Integer value) throws IllegalArgumentException { AssertValidIndexes(point); assertValidValue(value); Numbers[point.x][point.y] = value; } Puzzle();   Puzzle(Puzzle toCopy);  Puzzle(Integer[][] problem); void setNumber(Point point, Integer value); Integer getNumber(Point point); static final int SIZE; }
@Test(expected = IllegalArgumentException.class) public void NumberTooBig_SetNumber_IllegalArgumentExceptionThrown() { Puzzle sut = new Puzzle(); Point validPoint = new Point(0, 0); Integer invalidNumber = Puzzle.MAX_VALUE + 1; sut.setNumber(validPoint, invalidNumber); }
@Test(expected = IllegalArgumentException.class) public void NumberTooSmall_SetNumber_IllegalArgumentExceptionThrown() { Puzzle sut = new Puzzle(); Point validPoint = new Point(0, 0); Integer invalidNumber = Puzzle.MIN_VALUE - 1; sut.setNumber(validPoint, invalidNumber); }
@Test(expected = IllegalArgumentException.class) public void InvalidRow_SetNumber_IllegalArgumentExceptionThrown() { Puzzle sut = new Puzzle(); Point invalidPoint = new Point(0, Puzzle.SIZE + 1); Integer validNumber = 0; sut.setNumber(invalidPoint, validNumber); }
@Test(expected = IllegalArgumentException.class) public void InvalidCol_SetNumber_IllegalArgumentExceptionThrown() { Puzzle sut = new Puzzle(); Point invalidPoint = new Point(Puzzle.SIZE + 1, 0); Integer validNumber = 0; sut.setNumber(invalidPoint, validNumber); }