123456789101112131415161718192021222324252627282930
  1. import org.junit.Assert;
  2. import org.junit.Test;
  3. /**
  4. * @author leon on 4/19/18.
  5. */
  6. public class DogTest {
  7. // TODO - Create tests for `new Dog(String name, Date birthDate, Integer id)`
  8. // TODO - Create tests for `speak`
  9. // TODO - Create tests for `setBirthDate(Date birthDate)`
  10. // TODO - Create tests for `void eat(Food food)`
  11. // TODO - Create tests for `Integer getId()`
  12. // TODO - Create test to check Animal inheritance; google search `java instanceof keyword`
  13. // TODO - Create test to check Mammal inheritance; google search `java instanceof keyword`
  14. @Test
  15. public void setNameTest() {
  16. // Given (a name exists and a dog exists)
  17. Dog dog = new Dog(null, null, null);
  18. String givenName = "Milo";
  19. // When (a dog's name is set to the given name)
  20. dog.setName(givenName);
  21. // Then (we expect to get the given name from the dog)
  22. String dogName = dog.getName();
  23. Assert.assertEquals(dogName, givenName);
  24. }
  25. }