tracks/java/exercises/queen-attack/src/test/java/QueenAttackCalculatorTest.java in trackler-2.0.6.11 vs tracks/java/exercises/queen-attack/src/test/java/QueenAttackCalculatorTest.java in trackler-2.0.6.12
- old
+ new
@@ -14,121 +14,121 @@
*/
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Test
- public void testCoordinateWithNegativeRankNotAllowed() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Coordinate must have positive rank.");
+ public void testQueensThatDoNotShareRankFileOrDiagonalCannotAttack() {
+ final QueenAttackCalculator calculator
+ = new QueenAttackCalculator(new BoardCoordinate(2, 4), new BoardCoordinate(6, 6));
- new BoardCoordinate(-2, 2);
+ assertFalse(calculator.canQueensAttackOneAnother());
}
@Ignore
@Test
- public void testCoordinateWithRankGreaterThan7NotAllowed() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Coordinate must have rank <= 7.");
+ public void testQueensCanAttackOnTheSameRank() {
+ final QueenAttackCalculator calculator
+ = new QueenAttackCalculator(new BoardCoordinate(2, 4), new BoardCoordinate(2, 6));
- new BoardCoordinate(8, 4);
+ assertTrue(calculator.canQueensAttackOneAnother());
}
@Ignore
@Test
- public void testCoordinateWithNegativeFileNotAllowed() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Coordinate must have positive file.");
+ public void testQueensCanAttackOnTheSameFile() {
+ final QueenAttackCalculator calculator
+ = new QueenAttackCalculator(new BoardCoordinate(4, 5), new BoardCoordinate(2, 5));
- new BoardCoordinate(2, -2);
+ assertTrue(calculator.canQueensAttackOneAnother());
}
@Ignore
@Test
- public void testCoordinateWithFileGreaterThan7NotAllowed() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Coordinate must have file <= 7.");
+ public void testQueensCanAttackOnFirstDiagonal() {
+ final QueenAttackCalculator calculator
+ = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(0, 4));
- new BoardCoordinate(4, 8);
+ assertTrue(calculator.canQueensAttackOneAnother());
}
@Ignore
@Test
- public void testNullCoordinateNotAllowed() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("You must supply valid board coordinates for both Queens.");
+ public void testQueensCanAttackOnSecondDiagonal() {
+ final QueenAttackCalculator calculator
+ = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(3, 1));
- new QueenAttackCalculator(null, new BoardCoordinate(0, 7));
+ assertTrue(calculator.canQueensAttackOneAnother());
}
@Ignore
@Test
- public void testQueensMustNotOccupyTheSameSquare() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Queens may not occupy the same board coordinate.");
+ public void testQueensCanAttackOnThirdDiagonal() {
+ final QueenAttackCalculator calculator
+ = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(1, 1));
- new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(2, 2));
+ assertTrue(calculator.canQueensAttackOneAnother());
}
@Ignore
@Test
- public void testQueensThatDoNotShareRankFileOrDiagonalCannotAttack() {
+ public void testQueensCanAttackOnFourthDiagonal() {
final QueenAttackCalculator calculator
- = new QueenAttackCalculator(new BoardCoordinate(2, 4), new BoardCoordinate(6, 6));
+ = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(5, 5));
- assertFalse(calculator.canQueensAttackOneAnother());
+ assertTrue(calculator.canQueensAttackOneAnother());
}
@Ignore
@Test
- public void testQueensCanAttackOnTheSameRank() {
- final QueenAttackCalculator calculator
- = new QueenAttackCalculator(new BoardCoordinate(2, 4), new BoardCoordinate(2, 6));
+ public void testCoordinateWithNegativeRankNotAllowed() {
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Coordinate must have positive rank.");
- assertTrue(calculator.canQueensAttackOneAnother());
+ new BoardCoordinate(-2, 2);
}
@Ignore
@Test
- public void testQueensCanAttackOnTheSameFile() {
- final QueenAttackCalculator calculator
- = new QueenAttackCalculator(new BoardCoordinate(4, 5), new BoardCoordinate(2, 5));
+ public void testCoordinateWithRankGreaterThan7NotAllowed() {
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Coordinate must have rank <= 7.");
- assertTrue(calculator.canQueensAttackOneAnother());
+ new BoardCoordinate(8, 4);
}
@Ignore
@Test
- public void testQueensCanAttackOnFirstDiagonal() {
- final QueenAttackCalculator calculator
- = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(0, 4));
+ public void testCoordinateWithNegativeFileNotAllowed() {
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Coordinate must have positive file.");
- assertTrue(calculator.canQueensAttackOneAnother());
+ new BoardCoordinate(2, -2);
}
@Ignore
@Test
- public void testQueensCanAttackOnSecondDiagonal() {
- final QueenAttackCalculator calculator
- = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(3, 1));
+ public void testCoordinateWithFileGreaterThan7NotAllowed() {
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Coordinate must have file <= 7.");
- assertTrue(calculator.canQueensAttackOneAnother());
+ new BoardCoordinate(4, 8);
}
@Ignore
@Test
- public void testQueensCanAttackOnThirdDiagonal() {
- final QueenAttackCalculator calculator
- = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(1, 1));
+ public void testNullCoordinateNotAllowed() {
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("You must supply valid board coordinates for both Queens.");
- assertTrue(calculator.canQueensAttackOneAnother());
+ new QueenAttackCalculator(null, new BoardCoordinate(0, 7));
}
@Ignore
@Test
- public void testQueensCanAttackOnFourthDiagonal() {
- final QueenAttackCalculator calculator
- = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(5, 5));
+ public void testQueensMustNotOccupyTheSameSquare() {
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage("Queens may not occupy the same board coordinate.");
- assertTrue(calculator.canQueensAttackOneAnother());
+ new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(2, 2));
}
}