@Test public void getGeoLevelBoundsForArea_COMMON1() { /** * Inputs: geography='SAHSU' geoLevelSelect='LEVEL3' studyID=1 mapAreaID='01.008.005600' * * <p>should yield the results: "(54.5492,-6.56952,54.5205,-6.62246)" */ try { User validUser = cloneValidUser(); StudyResultRetrievalContext validStudyResultRetrievalContext = cloneValidResultContext(); validStudyResultRetrievalContext.setGeoLevelSelectName("LEVEL3"); MapArea validMapArea = MapArea.newInstance("01.008.005600", "01.008.005600", "01.008.005600"); BoundaryRectangle boundaryRectangle = rifStudyRetrievalService.getGeoLevelBoundsForArea( validUser, validStudyResultRetrievalContext, validMapArea); assertEquals("-6.56952", boundaryRectangle.getXMax()); assertEquals("54.5492", boundaryRectangle.getYMax()); assertEquals("54.5205", boundaryRectangle.getYMin()); assertEquals("-6.62246", boundaryRectangle.getXMin()); } catch (RIFServiceException rifServiceException) { fail(); } }
@Test public void getGeoLevelBoundsForArea_NULL2() { try { User validUser = cloneValidUser(); MapArea validMapArea = MapArea.newInstance("01.008.003500", "01.008.003500", "01.008.003500"); rifStudyRetrievalService.getGeoLevelBoundsForArea(validUser, null, validMapArea); fail(); } catch (RIFServiceException rifServiceException) { checkErrorType(rifServiceException, RIFServiceError.EMPTY_API_METHOD_PARAMETER, 1); } }
@Test public void getGeoLevelBoundsForArea_NULL1() { try { StudyResultRetrievalContext validStudyResultRetrievalContext = cloneValidResultContext(); validStudyResultRetrievalContext.setGeoLevelSelectName("LEVEL3"); MapArea validMapArea = MapArea.newInstance("01.008.003500", "01.008.003500", "01.008.003500"); rifStudyRetrievalService.getGeoLevelBoundsForArea( null, validStudyResultRetrievalContext, validMapArea); fail(); } catch (RIFServiceException rifServiceException) { checkErrorType(rifServiceException, RIFServiceError.EMPTY_API_METHOD_PARAMETER, 1); } }
@Test public void getGeoLevelBoundsForArea_MALICIOUS3() { try { User validUser = cloneValidUser(); StudyResultRetrievalContext maliciousStudyResultRetrievalContext = cloneMaliciousResultContext(); MapArea validMapArea = MapArea.newInstance("01.008.003500", "01.008.003500", "01.008.003500"); rifStudyRetrievalService.getGeoLevelBoundsForArea( validUser, maliciousStudyResultRetrievalContext, validMapArea); fail(); } catch (RIFServiceException rifServiceException) { checkErrorType(rifServiceException, RIFGenericLibraryError.SECURITY_VIOLATION, 1); } }
@Test public void getGeoLevelBoundsForArea_EMPTY3() { try { User validUser = cloneValidUser(); StudyResultRetrievalContext validStudyResultRetrievalContext = cloneValidResultContext(); validStudyResultRetrievalContext.setGeoLevelSelectName("LEVEL3"); MapArea emptyMapArea = MapArea.newInstance("", "01.008.003500", "01.008.003500"); rifStudyRetrievalService.getGeoLevelBoundsForArea( validUser, validStudyResultRetrievalContext, emptyMapArea); fail(); } catch (RIFServiceException rifServiceException) { checkErrorType(rifServiceException, RIFServiceError.INVALID_MAP_AREA, 1); } }
@Test public void getGeoLevelBoundsForArea_EMPTY2() { try { User validUser = cloneValidUser(); StudyResultRetrievalContext emptyStudyResultRetrievalContext = cloneValidResultContext(); emptyStudyResultRetrievalContext.setStudyID(""); MapArea validMapArea = MapArea.newInstance("01.008.003500", "01.008.003500", "01.008.003500"); rifStudyRetrievalService.getGeoLevelBoundsForArea( validUser, emptyStudyResultRetrievalContext, validMapArea); fail(); } catch (RIFServiceException rifServiceException) { checkErrorType( rifServiceException, RIFServiceError.INVALID_STUDY_RESULT_RETRIEVAL_CONTEXT, 1); } }