PetTest.java 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. import org.junit.Assert;
  6. public class PetTest
  7. {
  8. Pet petCaller = new Pet();
  9. @Test
  10. public void dogTypeTest(){
  11. //when
  12. petCaller.setType("Dog");
  13. //expected
  14. String expected = "Dog";
  15. //actual
  16. String actual = petCaller.getType();
  17. Assert.assertEquals(expected, actual);
  18. }
  19. @Test
  20. public void catTypeTest(){
  21. //when
  22. petCaller.setType("Cat");
  23. //expected
  24. String expected = "Cat";
  25. //actual
  26. String actual = petCaller.getType();
  27. Assert.assertEquals(expected, actual);
  28. }
  29. @Test
  30. public void fishTypeTest(){
  31. //when
  32. petCaller.setType("Fish");
  33. //expected
  34. String expected = "Fish";
  35. //actual
  36. String actual = petCaller.getType();
  37. Assert.assertEquals(expected, actual);
  38. }
  39. }