DogTest.java 759B

123456789101112131415161718192021222324252627282930313233343536373839
  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 DogTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class DogTest
  12. {
  13. Dog zero;
  14. @Before
  15. public void setup(){
  16. zero = new Dog("Special Agent Zero \"Skeleton Dog\" Growlkowski");
  17. }
  18. @Test
  19. public void speak() {
  20. String expected = "Grrrrrrr";
  21. String actual = zero.speak();
  22. Assert.assertEquals(expected, actual);
  23. }
  24. @Test
  25. public void name() {
  26. String expected = "Special Agent Zero \"Skeleton Dog\" Growlkowski";
  27. String actual = zero.getName();
  28. Assert.assertEquals(expected, actual);
  29. }
  30. }