/** Tests the disable method */ @Test public void testDisable() { rabbit.enable(); assertEquals(true, rabbit.canAct()); rabbit.disable(); assertEquals(false, rabbit.canAct()); }
/** Tests if the animals alive boolean is set to false */ @Test public void testDie() { assertEquals(false, rabbit.isAlive()); rabbit.enable(); assertEquals(true, rabbit.isAlive()); rabbit.die(); assertEquals(false, rabbit.isAlive()); }
/** Tests the move method in the organism class */ @Test public void testMove() { Cell middle = new Cell(2, 2); system.add(rabbit, middle); rabbit.move(middle, system); system.findFirstEmptyNeighbor(middle, 0); String now = "xxMxxxxxx"; assertEquals(now, printX()); }
/** Tests the eat method in the organism class */ @Test public void testEat() { Cell middle = new Cell(2, 2); Cell west = new Cell(1, 2); system.add(rabbit, middle); system.add(insect, west); rabbit.eat(middle, system); String now = "xxxxxMxxx"; assertEquals(now, printX()); }
/** Tests the breed method in the organism class */ @Test public void testBreed() { assertEquals(0, rabbit.getTimeSinceLastBreed()); rabbit.incrementTimeSinceLastBreed(); rabbit.incrementTimeSinceLastBreed(); rabbit.incrementTimeSinceLastBreed(); rabbit.incrementTimeSinceLastBreed(); rabbit.incrementTimeSinceLastBreed(); rabbit.incrementTimeSinceLastBreed(); rabbit.incrementTimeSinceLastBreed(); assertEquals(7, rabbit.getTimeSinceLastBreed()); Cell middle = new Cell(2, 2); Cell west = new Cell(1, 2); system.add(rabbit, middle); assertEquals(true, rabbit.breed(middle, system)); }
/** Tests to see if the time is incremented */ @Test public void testIncrementTimeSinceLastBreed() { assertEquals(0, rabbit.getTimeSinceLastBreed()); rabbit.incrementTimeSinceLastBreed(); assertEquals(1, rabbit.getTimeSinceLastBreed()); }
/** Tests the getter for the time of meal */ @Test public void testGetTimeSinceLastMeal() { assertEquals(0, rabbit.getTimeSinceLastMeal()); rabbit.incrementTimeSinceLastMeal(); assertEquals(1, rabbit.getTimeSinceLastMeal()); }
/** Tests the can act method */ @Test public void testCanAct() { rabbit.enable(); assertEquals(true, rabbit.canAct()); }
/** Tests to gettor for the color of the organism */ @Test public void testGetColor() { assertEquals(Color.orange, rabbit.getColor()); }
/** tests the getter for the symbol */ @Test public void testGetSymbol() { assertEquals('M', rabbit.getSymbol()); }