use of org.springframework.test.annotation.ExpectedException in project head by mifos.
the class RolesPermissionsBusinessServiceTest method testInvalidConnectionInGetRole.
@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInGetRole() throws PersistenceException {
try {
when(rolesPermissionsPersistence.getRole(id)).thenThrow(new PersistenceException("some exception"));
service.getRole(id);
junit.framework.Assert.fail("should fail because of invalid session");
} catch (ServiceException e) {
}
}
use of org.springframework.test.annotation.ExpectedException in project head by mifos.
the class RolesPermissionsBusinessServiceTest method testInvalidConnectionInGetRoles.
@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInGetRoles() throws PersistenceException {
try {
when(rolesPermissionsPersistence.getRoles()).thenThrow(new PersistenceException("some exception"));
service.getRoles();
junit.framework.Assert.fail("should fail because of invalid session");
} catch (ServiceException e) {
}
}
use of org.springframework.test.annotation.ExpectedException in project head by mifos.
the class RolesPermissionsBusinessServiceTest method testInvalidConnectionInGetActivities.
@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInGetActivities() throws PersistenceException {
try {
when(rolesPermissionsPersistence.getActivities()).thenThrow(new PersistenceException("some exception"));
service.getActivities();
junit.framework.Assert.fail("should fail because of invalid session");
} catch (ServiceException e) {
}
}
use of org.springframework.test.annotation.ExpectedException in project gocd by gocd.
the class UserSqlMapDaoIntegrationTest method shouldThrowExceptionWhenUserIsNotDisabled.
@Test
@ExpectedException(UserEnabledException.class)
public void shouldThrowExceptionWhenUserIsNotDisabled() {
String userName = "enabledUser";
User user = new User(userName);
userDao.saveOrUpdate(user);
userDao.deleteUser(userName);
}
use of org.springframework.test.annotation.ExpectedException in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldResolveSimpleDiamondAndThrowLimitException.
@Test
@ExpectedException(MaxBackTrackLimitReachedException.class)
public void shouldResolveSimpleDiamondAndThrowLimitException() {
int i = 1;
GitMaterial git1 = u.wf(new GitMaterial("git1"), "folder");
String[] git_revs1 = { "g11", "g12" };
u.checkinInOrder(git1, u.d(i++), git_revs1);
ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("p1", u.m(git1));
ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("p2", u.m(p1));
ScheduleTestUtil.AddedPipeline p3 = u.saveConfigWith("p3", u.m(p1));
ScheduleTestUtil.AddedPipeline p4 = u.saveConfigWith("p4", u.m(p2), u.m(p3));
CruiseConfig cruiseConfig = goConfigDao.load();
String p1_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p1, u.d(i++), "g11");
String p2_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p2, u.d(i++), p1_1);
String p3_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p3, u.d(i++), p1_1);
String p1_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p1, u.d(i++), "g12");
String p2_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p2, u.d(i++), p1_2);
MaterialRevisions given = u.mrs(u.mr(p2, true, p2_2), u.mr(p3, false, p3_1));
MaterialRevisions expected = u.mrs(u.mr(p2, true, p2_1), u.mr(p3, false, p3_1));
assertThat(getRevisionsBasedOnDependencies(p4, cruiseConfig, given), is(expected));
systemEnvironment.set(SystemEnvironment.RESOLVE_FANIN_MAX_BACK_TRACK_LIMIT, 1);
getRevisionsBasedOnDependencies(p4, cruiseConfig, given);
}
Aggregations