use of org.sagebionetworks.bridge.exceptions.EntityNotFoundException in project BridgeServer2 by Sage-Bionetworks.
the class DefaultAppBootstrapperTest method skipBootstrapAccountIfNotConfigured.
@Test
public void skipBootstrapAccountIfNotConfigured() {
when(mockConfig.getEnvironment()).thenReturn(Environment.DEV);
List<TableDescription> tables = ImmutableList.of();
when(mockAnnotationBasedTableCreator.getTables("org.sagebionetworks.bridge.dynamodb")).thenReturn(tables);
when(mockAppService.getApp(any())).thenThrow(new EntityNotFoundException(App.class));
when(mockAppService.createApp(any())).thenAnswer((args) -> args.getArgument(0));
// We don't care about the context
bootstrapper.onApplicationEvent(null);
verify(mockDynamoInitializer).init(tables);
verify(mockS3Initializer).initBuckets();
verify(mockAppService, times(3)).createApp(appCaptor.capture());
verify(mockUserAdminService, never()).createUser(any(), any(), any(), anyBoolean(), anyBoolean());
}
use of org.sagebionetworks.bridge.exceptions.EntityNotFoundException in project BridgeServer2 by Sage-Bionetworks.
the class ConsentServiceTest method userCannotGetConsentSignatureForSubpopulationToWhichTheyAreNotMapped.
@Test(expectedExceptions = EntityNotFoundException.class)
public void userCannotGetConsentSignatureForSubpopulationToWhichTheyAreNotMapped() {
when(subpopService.getSubpopulation(app.getIdentifier(), SUBPOP_GUID)).thenThrow(new EntityNotFoundException(Subpopulation.class));
consentService.getConsentSignature(app, SUBPOP_GUID, PARTICIPANT.getId());
}
use of org.sagebionetworks.bridge.exceptions.EntityNotFoundException in project BridgeServer2 by Sage-Bionetworks.
the class EnrollmentServiceTest method getEnrollmentsForUser_studyNotFound.
@Test(expectedExceptions = EntityNotFoundException.class, expectedExceptionsMessageRegExp = "Study not found.")
public void getEnrollmentsForUser_studyNotFound() {
when(mockStudyService.getStudy(TEST_APP_ID, TEST_STUDY_ID, true)).thenThrow(new EntityNotFoundException(Study.class));
service.getEnrollmentsForUser(TEST_APP_ID, TEST_STUDY_ID, TEST_USER_ID);
}
use of org.sagebionetworks.bridge.exceptions.EntityNotFoundException in project BridgeServer2 by Sage-Bionetworks.
the class EnrollmentServiceTest method addEnrollment_studyNotFound.
@Test(expectedExceptions = EntityNotFoundException.class, expectedExceptionsMessageRegExp = "Study not found.")
public void addEnrollment_studyNotFound() {
when(mockStudyService.getStudy(TEST_APP_ID, TEST_STUDY_ID, true)).thenThrow(new EntityNotFoundException(Study.class));
service.addEnrollment(Account.create(), Enrollment.create(TEST_APP_ID, TEST_STUDY_ID, TEST_USER_ID), false);
}
use of org.sagebionetworks.bridge.exceptions.EntityNotFoundException in project BridgeServer2 by Sage-Bionetworks.
the class EnrollmentServiceTest method enroll_studyNotFound.
@Test(expectedExceptions = EntityNotFoundException.class, expectedExceptionsMessageRegExp = "Study not found.")
public void enroll_studyNotFound() {
when(mockStudyService.getStudy(TEST_APP_ID, TEST_STUDY_ID, true)).thenThrow(new EntityNotFoundException(Study.class));
service.enroll(Enrollment.create(TEST_APP_ID, TEST_STUDY_ID, TEST_USER_ID));
}
Aggregations