@Test public void shouldInsertIntoDB() throws Exception { carpoolBuddyDao.insert(carpoolBuddy, carpool); assertThat( carpoolBuddyDao.getCarpoolBuddiesByCarpoolName(carpool.getName()).contains(carpoolBuddy), equalTo(true)); carpoolBuddyDao.remove(carpoolBuddy.getBuddy().getUserName(), carpool.getName()); }
@Test public void shouldGetCarpoolBuddyFormUserNameAndCarpoolName() throws Exception { carpoolBuddyDao.insert(carpoolBuddy, carpool); CarpoolBuddy carpoolBuddyActual = carpoolBuddyDao.getCarpoolBuddyFromUsernameAndCarpoolName( buddy.getUserName(), carpool.getName()); assertEquals(carpoolBuddy, carpoolBuddyActual); carpoolBuddyDao.remove(buddy.getUserName(), carpool.getName()); }
@Test public void shouldGetBuddyInsideCarpoolBuddyFromDB() { ArrayList<CarpoolBuddy> carpoolBuddies = carpoolBuddyDao.getCarpoolBuddiesByCarpoolName("carpool-1"); assertThat(carpoolBuddies.get(0).getBuddy(), notNullValue()); }
@Test public void shouldGetCarpoolBuddyFromDB() throws Exception { ArrayList<CarpoolBuddy> carpoolBuddies = carpoolBuddyDao.getCarpoolBuddiesByCarpoolName("carpool-1"); assertThat(carpoolBuddies.size(), not(0)); }