/** 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 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 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)); }