use of org.springframework.test.annotation.ExpectedException in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldContinueBackTrackingFromItsLastKnownPositionAndNotFromTheBeginning.
@Test(timeout = 10 * 1000)
@ExpectedException(NoCompatibleUpstreamRevisionsException.class)
public void shouldContinueBackTrackingFromItsLastKnownPositionAndNotFromTheBeginning() {
int i = 1;
GitMaterial git1 = u.wf(new GitMaterial("git1"), "folder1");
String[] git_revs1 = { "g11", "g12", "g13" };
u.checkinInOrder(git1, u.d(i++), git_revs1);
GitMaterial git2 = u.wf(new GitMaterial("git2"), "folder2");
String[] git_revs2 = { "g21", "g22", "g23" };
u.checkinInOrder(git2, u.d(i++), git_revs2);
ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("p1", u.m(git1), u.m(git2));
ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("p2", u.m(git1), u.m(git2));
ScheduleTestUtil.AddedPipeline p3 = u.saveConfigWith("p3", u.m(p1), u.m(p2));
CruiseConfig cruiseConfig = goConfigDao.load();
String p1_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p1, u.d(i++), "g11", "g21");
String p2_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p2, u.d(i++), "g12", "g21");
String p2_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p2, u.d(i++), "g11", "g23");
MaterialRevisions given = u.mrs(u.mr(p1, true, p1_1), u.mr(p2, true, p2_2));
assertThat(getRevisionsBasedOnDependencies(p3, cruiseConfig, given), is(given));
}
use of org.springframework.test.annotation.ExpectedException in project gocd by gocd.
the class UserSqlMapDaoIntegrationTest method shouldThrowExceptionWhenUserIsNotFound.
@Test
@ExpectedException(UserNotFoundException.class)
public void shouldThrowExceptionWhenUserIsNotFound() {
String userName = "invaliduser";
userDao.deleteUser(userName);
}
use of org.springframework.test.annotation.ExpectedException in project head by mifos.
the class LoanBOTest method testInvalidConnectionForSave.
@Test
@ExpectedException(value = AccountException.class)
public void testInvalidConnectionForSave() throws PersistenceException {
final LegacyAccountDao legacyAccountDao = mock(LegacyAccountDao.class);
LoanBO loanBO = new LoanBO() {
@Override
public LegacyAccountDao getlegacyAccountDao() {
return legacyAccountDao;
}
};
try {
when(legacyAccountDao.createOrUpdate(loanBO)).thenThrow(new PersistenceException("some exception"));
loanBO.update();
junit.framework.Assert.fail("should fail because of invalid session");
} catch (AccountException e) {
}
}
use of org.springframework.test.annotation.ExpectedException in project head by mifos.
the class LoanPrdBusinessServiceTest method testInvalidConnectionThrowsExceptionInGetAllLoanOfferings.
@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionThrowsExceptionInGetAllLoanOfferings() throws PersistenceException {
try {
when(loanPrdPersistence.getAllLoanOfferings(localeId)).thenThrow(new PersistenceException("some exception"));
loanPrdBusinessService.getAllLoanOfferings(localeId);
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 LoanPrdBusinessServiceTest method testInvalidConnectionThrowsExceptionInGetLoanOffering.
@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionThrowsExceptionInGetLoanOffering() throws PersistenceException {
try {
when(loanPrdPersistence.getLoanOffering(new Short("112"))).thenThrow(new PersistenceException("some exception"));
loanPrdBusinessService.getLoanOffering(new Short("112"));
Assert.fail("should fail because of invalid session");
} catch (ServiceException e) {
}
}
Aggregations