Created
February 11, 2016 11:58
-
-
Save AnnaBoro/feedb1c14f827fb1c436 to your computer and use it in GitHub Desktop.
bird test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package junittests; | |
import static org.junit.Assert.*; | |
import lesson7_10.generics.Bird; | |
import lesson7_10.generics.Eagle; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.junit.runners.JUnit4; | |
@RunWith(JUnit4.class) | |
public class BirdTest { | |
private Bird bird; | |
@Before | |
public void beforeTest() { | |
bird = new Eagle(); | |
} | |
@Test | |
public void checkBirdNameDefaultValue() { | |
String name = bird.getName(); | |
assertNull("Name should be null", name); | |
} | |
@Test | |
public void checkBirdPriceDefaultValue() { | |
double price = bird.getPrice(); | |
assertTrue("Default price should be 0.0", price == 0.0); | |
} | |
@Test | |
public void checkEagleAgeDefaultValue() { | |
assertTrue("Default age should be 0", ((Eagle) bird).getAge() == 0); | |
} | |
@Test | |
public void checkSetName() { | |
String name = "Kesha"; | |
bird.setName(name); | |
assertEquals(name, bird.getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment