/** 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());
 }
 /**
  * Private method that prints the current ecosystem grid as a string
  *
  * @return the string printout
  */
 private String printX() {
   String s = "";
   for (int i = 0; i < 3; i++)
     for (int j = 0; j < 3; j++) {
       Item x = system.getItemAt(new Cell(i, j));
       if (x != null) s += x.getSymbol();
       else s += "x";
     }
   return s;
 }
 /** 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));
 }