/**
* Test of remove method of class ExtraServiceDAO.
*/
@Test
public void testRemove() {
ExtraService e = newExtraService(null, null, BigDecimal.TEN);
extraServiceDAO.create(e);
//
try {
extraServiceDAO.remove(null);
fail("ExtraService is null and didn't throw exception");
} catch (DataAccessException ex) {
//ok
} catch (Exception ex) {
fail("ExtraService is null and didn't throw appropriate exception");
}
try {
extraServiceDAO.remove(new ExtraService());
fail("ExtraService ID is null and didn't throw exception");
} catch (DataAccessException ex) {
// ok
} catch (Exception ex) {
fail("ExtraService ID is null and didn't throw appropriate exception");
}
try {
ExtraService es = new ExtraService();
es.setId(-1L);
extraServiceDAO.remove(es);
fail("Shouldn't remove non-existent entity");
} catch (DataAccessException ex) {
//ok
} catch (Exception ex) {
fail("Non existent es (extra service) - should throw appropriate exception");
}
//
extraServiceDAO.remove(e);
ExtraService e2 = extraServiceDAO.get(e.getId());
assertNull("Found extraService that shouldn't be there", e2);
removeAll();
}