Example #1
0
 /**
  * Tests {@link PlayerFish#canBeEatenBy(IEatable).
  * Test with a smaller enemy.
  */
 public void testCanBeEatenBySmallerEnemy() {
   IEatable other = mock(IEatable.class);
   when(other.getSize()).thenReturn(4.0);
   assertFalse(pf.canBeEatenBy(other));
 }
Example #2
0
 /**
  * Tests {@link PlayerFish#canBeEatenBy(IEatable).
  * Test for when the player fish is invincible
  */
 public void testCanBeEatenByInvincible() {
   IEatable other = mock(IEatable.class);
   when(other.getSize()).thenReturn(4.0);
   pf.setInvincible(-1);
   assertFalse(pf.canBeEatenBy(other));
 }
Example #3
0
 /**
  * Tests {@link PlayerFish#canBeEatenBy(IEatable).
  * Test for larger enemy.
  */
 public void testCanBeEatenByLargerEnemy() {
   IEatable other = mock(IEatable.class);
   when(other.getSize()).thenReturn(10.0);
   assertTrue(pf.canBeEatenBy(other));
 }