@Test public void poseidonFire2() throws Exception { bn.addShip(TypeShip.BARQUE, new Coordinate(0, 0), new Coordinate(0, 4)); bn.switchTurn(); TypeShip[] bateaux = {BARQUE, BARQUE, BARQUE}; ((Bot) bn.getJ2()).placerBateaux(bateaux); bn.fire(OrdreTir.NO_ORDER); bn.fire(OrdreTir.NO_ORDER); bn.fire(OrdreTir.NO_ORDER); bn.fire(OrdreTir.NO_ORDER); StateCase state = bn.fire(OrdreTir.NO_ORDER); assertEquals(FLOTTE_DETRUITE, state); }
// TODO add test methods here. // The methods must be annotated with annotation @Test. For example: // @Test public void poseidonFire() throws Exception { bn.addShip(TypeShip.BARQUE, new Coordinate(0, 0), new Coordinate(0, 4)); bn.switchTurn(); TypeShip[] bateaux = {BARQUE, BARQUE, BARQUE}; ((Bot) bn.getJ2()).placerBateaux(bateaux); bn.fire(OrdreTir.NO_ORDER); bn.fire(OrdreTir.NO_ORDER); bn.fire(OrdreTir.NO_ORDER); bn.fire(OrdreTir.NO_ORDER); // bn.fire(OrdreTir.NO_ORDER); assertEquals(bn.getJ1().getFlotte().getVaisseaux().get(0).getLife(), 1); }
@Test public void poseidonFire3() throws Exception { bn.addShip(TypeShip.BARQUE, new Coordinate(0, 0), new Coordinate(0, 4)); bn.addShip(TypeShip.TRANSPORT, new Coordinate(1, 0), new Coordinate(1, 1)); bn.switchTurn(); TypeShip[] bateaux = {BARQUE, TRANSPORT}; ((Bot) bn.getJ2()).placerBateaux(bateaux); int i = 0; // int j = 0; StateCase s; while (i < 5) { s = bn.fire(OrdreTir.NO_ORDER); if (s == HIT) { i++; } } // bn.fire(OrdreTir.NO_ORDER); // bn.fire(OrdreTir.NO_ORDER); // bn.fire(OrdreTir.NO_ORDER); // bn.fire(OrdreTir.NO_ORDER); assertEquals(bn.getJ1().getFlotte().getVaisseaux().size(), 1); }