use of com.runwaysdk.RunwayExceptionDTO in project geoprism-registry by terraframe.
the class HierarchyServiceTest method testCreateHierarchyTypeAsBadRole.
@Test(expected = SmartExceptionDTO.class)
public void testCreateHierarchyTypeAsBadRole() {
String organizationCode = FastTestDataset.ORG_CGOV.getCode();
HierarchyType reportingDivision = MetadataFactory.newHierarchyType(TEST_HT.getCode(), new LocalizedValue("Reporting Division"), new LocalizedValue("The rporting division hieracy..."), organizationCode, testData.adapter);
String gtJSON = reportingDivision.toJSON().toString();
TestUserInfo[] users = new TestUserInfo[] { FastTestDataset.USER_MOHA_RA, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC, FastTestDataset.USER_CGOV_RM };
for (TestUserInfo user : users) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
ServiceFactory.getHierarchyService().createHierarchyType(request.getSessionId(), gtJSON);
});
Assert.fail("Able to update a geo object type as a user with bad roles");
} catch (RunwayExceptionDTO e) {
// This is expected
}
}
}
Aggregations