Created
May 23, 2012 17:20
-
-
Save rtorr/2776477 to your computer and use it in GitHub Desktop.
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
//create a method to create lists in our table | |
private Agency createAgency(String name){ | |
//create agency | |
Agency agency = new Agency(); | |
//set the name of the agency | |
agency.setName(name); | |
//create it though our DAO (put it on the database) | |
dao.create(agency); | |
//get the id of the posted Agency | |
Assert.assertNotNull(agency.getId()); | |
//return | |
return agency; | |
} | |
//test the list method | |
@Test | |
public void listTest(){ | |
//set how many lists we want to create | |
int listAmount = 100; | |
//create list of agencies | |
for (int i=0; i < listAmount; i++) { | |
createAgency("My new agency"); | |
} | |
//use DAO to list those agencies | |
List<Agency> entityList = dao.list(); | |
//check that the list is equal to the size of list we created | |
Assert.assertEquals(listAmount, entityList.size()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment