@Test
  public void testBirdWalkingIsSame() {
    // Find the animals in the wild.
    Animal animal = new Animal();
    Bird bird = new Bird();

    // Observe the way they walk.
    animal.walk();
    bird.walk();

    // If they walk the same, maybe they are the same.
    String[] actual = stdout.toString().split("\n");
    assertEquals(actual[0], actual[1]);
  }
예제 #2
0
 public int compareTo(Animal a) {
   return title.compareTo(a.getTitle());
 }
 @Test
 public void testAnimalWalk() {
   Animal animal = new Animal();
   animal.walk();
   assertEquals("I am walking\n", stdout.toString());
 }