MainApplicationTest.java 751B

123456789101112131415161718192021222324252627282930
  1. import org.junit.Assert;
  2. import org.junit.Test;
  3. public class MainApplicationTest
  4. {
  5. @Test
  6. public void dogSpeakTest(){
  7. Pet dog1 = new Dog("Bill");
  8. String expected = "woof";
  9. String actual = dog1.speak();
  10. Assert.assertEquals(expected,actual);
  11. }
  12. @Test
  13. public void snakeSpeakTest(){
  14. Pet snake1 = new Snake("Bill");
  15. String expected = "hsss";
  16. String actual = snake1.speak();
  17. Assert.assertEquals(expected,actual);
  18. }
  19. @Test
  20. public void catSpeakTest(){
  21. Pet cat1 = new Cat("Bill");
  22. String expected = "meow";
  23. String actual = cat1.speak();
  24. Assert.assertEquals(expected,actual);
  25. }
  26. }