@Test(expected = RuntimeException.class) public void testRemoveNotExists() throws Exception { Role role = new Role(); role.setId(4); role.setName("role5"); roleDao.remove(role); }
@Test @ExpectedDatabase( table = "Role", value = "/dataset/role/afterRemove.xml", assertionMode = DatabaseAssertionMode.NON_STRICT) public void testRemove() throws Exception { roleDao.remove(roles[1]); }
@Test @DatabaseSetup("/dataset/role/empty.xml") @ExpectedDatabase( table = "Role", value = "/dataset/role/afterCreate.xml", assertionMode = DatabaseAssertionMode.NON_STRICT) public void testCreate() throws Exception { roleDao.create(roles[1]); }
@Test @ExpectedDatabase( table = "Role", value = "/dataset/role/afterUpdate.xml", assertionMode = DatabaseAssertionMode.NON_STRICT) public void testUpdate() throws Exception { Role role = roles[2]; role.setName("role55"); roleDao.update(role); }
@Test(expected = IllegalArgumentException.class) public void testRemoveWithNull() { roleDao.remove(null); }
@Test(expected = IllegalArgumentException.class) public void testUpdateWithNull() { roleDao.update(null); }
@Test(expected = RuntimeException.class) public void testCreateExists() throws Exception { roleDao.create(roles[0]); }
@Test public void testFindByName() { Role role = roleDao.findByName(roles[2].getName()); Assert.assertEquals("Roles must equals", roles[2], role); }