CatTest.java 686B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import org.junit.Assert;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. /**
  6. * The test class CatTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class CatTest
  12. {
  13. Cat boo;
  14. @Before
  15. public void setup(){
  16. boo = new Cat("Boo Saurus Rex");
  17. }
  18. @Test
  19. public void speak() {
  20. String expected = "Meow";
  21. String actual = boo.speak();
  22. Assert.assertEquals(expected, actual);
  23. }
  24. @Test
  25. public void name() {
  26. String expected = "Boo Saurus Rex";
  27. String actual = boo.getName();
  28. Assert.assertEquals(expected, actual);
  29. }
  30. }