Created
February 11, 2016 12:29
-
-
Save AnnaBoro/041ff1388e471ca70bf0 to your computer and use it in GitHub Desktop.
repository 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.Duck; | |
import lesson7_10.generics.Eagle; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.junit.runners.JUnit4; | |
import java.util.ArrayList; | |
@RunWith(JUnit4.class) | |
public class TestServiceRepository { | |
private ArrayList<Bird> list; | |
private Bird bird1; | |
private Bird bird2; | |
@Before | |
public void setUp() throws Exception { | |
list = new ArrayList<Bird>(); | |
bird1 = new Eagle(); | |
bird2 = new Duck(); | |
} | |
@Test | |
public void checkAddBird() { | |
list.add(bird1); | |
assertEquals(bird1, list.get(0)); | |
} | |
@Test | |
public void checkRemoveBird() { | |
list.add(bird1); | |
list.add(bird2); | |
list.remove(0); | |
assertEquals(bird2, list.get(0)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment