| 123456789101112131415161718192021222324252627282930 |
-
- import org.junit.Assert;
- import org.junit.Test;
-
- /**
- * @author leon on 4/19/18.
- */
- public class DogTest {
- // TODO - Create tests for `new Dog(String name, Date birthDate, Integer id)`
- // TODO - Create tests for `speak`
- // TODO - Create tests for `setBirthDate(Date birthDate)`
- // TODO - Create tests for `void eat(Food food)`
- // TODO - Create tests for `Integer getId()`
- // TODO - Create test to check Animal inheritance; google search `java instanceof keyword`
- // TODO - Create test to check Mammal inheritance; google search `java instanceof keyword`
- @Test
- public void setNameTest() {
- // Given (a name exists and a dog exists)
- Dog dog = new Dog(null, null, null);
- String givenName = "Milo";
-
- // When (a dog's name is set to the given name)
- dog.setName(givenName);
-
- // Then (we expect to get the given name from the dog)
- String dogName = dog.getName();
- Assert.assertEquals(dogName, givenName);
- }
- }
|