예제 #1
0
 /** Test the shoot method for a BossAlien. */
 @Test
 public final void bossShootTest() {
   float x = 1;
   float y = 1;
   Alien alien = new BossAlien(x, y);
   ArrayList<Bullet> list = alien.shootBullet(1);
   assertEquals(list.size(), 6);
 }
예제 #2
0
 /** Test if the Alien creates a new Bullet which goes downwards. */
 @Test
 public final void shootBulletTest() {
   float x = 1;
   float y = 1;
   Alien alien = new NormalAlien(x, y);
   ArrayList<Bullet> list = alien.shootBullet(1);
   Bullet bullet = list.get(0);
   assertEquals(alien.getXCoor(), bullet.getXCoor(), 0.05);
   assertEquals(alien.getYCoor(), bullet.getYCoor(), 0.05);
   bullet.move(1.0);
   assertEquals(alien.getXCoor(), bullet.getXCoor(), 0.05);
   assertEquals(alien.getYCoor() + 1, bullet.getYCoor(), 0.05);
 }