@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]);
  }
Example #2
0
  public static void main(String args[]) {

    Bird bird = new Bird();
    bird.walk();
    bird.fly();
    bird.sing();
  }
 @Test
 public void testBirdSings() {
   Bird bird = new Bird();
   bird.sing();
   assertEquals("I am singing\n", stdout.toString());
 }
 @Test
 public void testBirdFlies() {
   Bird bird = new Bird();
   bird.fly();
   assertEquals("I am flying\n", stdout.toString());
 }