@Test public void getProjectionTest() throws Exception { Map<String, Object> targetTypesMap = new HashMap<>(); targetTypesMap.put("faqid", "q5"); targetTypesMap.put("tag", "vulnerabilities"); List<Map<String, Object>> maintargetTypesList = new ArrayList<>(); maintargetTypesList.add(targetTypesMap); ReflectionTestUtils.setField(projectionServiceImpl, "projectionTargetTypes", "onpremserver"); when(repository.getProjectionDetailsFromDb(anyString(), anyInt(),anyInt())) .thenReturn(maintargetTypesList); when(repository.getTotalAssetCountByTargetType( anyString())) .thenReturn(5000l); assertThat(projectionServiceImpl.getProjection("onpremserver", 1,2), is(notNullValue())); }
@Override public ProjectionResponse getProjection(String resourceType, int year, int quarter) throws ServiceException { Long totalAssets = 0l; List<Map<String, Object>> projectionList = new ArrayList<>(); if (projectionTargetTypes.contains(resourceType)) { try { projectionList = repository.getProjectionDetailsFromDb( resourceType, year, quarter); totalAssets = repository .getTotalAssetCountByTargetType(resourceType); } catch (DataException e) { logger.error("Error @ getProjection", e); throw new ServiceException(e); } } return new ProjectionResponse("", resourceType, totalAssets, year, quarter, projectionList); }
ProjectionServiceImpl implements ProjectionService, Constants { @Override public ProjectionResponse getProjection(String resourceType, int year, int quarter) throws ServiceException { Long totalAssets = 0l; List<Map<String, Object>> projectionList = new ArrayList<>(); if (projectionTargetTypes.contains(resourceType)) { try { projectionList = repository.getProjectionDetailsFromDb( resourceType, year, quarter); totalAssets = repository .getTotalAssetCountByTargetType(resourceType); } catch (DataException e) { logger.error("Error @ getProjection", e); throw new ServiceException(e); } } return new ProjectionResponse("", resourceType, totalAssets, year, quarter, projectionList); } }
ProjectionServiceImpl implements ProjectionService, Constants { @Override public ProjectionResponse getProjection(String resourceType, int year, int quarter) throws ServiceException { Long totalAssets = 0l; List<Map<String, Object>> projectionList = new ArrayList<>(); if (projectionTargetTypes.contains(resourceType)) { try { projectionList = repository.getProjectionDetailsFromDb( resourceType, year, quarter); totalAssets = repository .getTotalAssetCountByTargetType(resourceType); } catch (DataException e) { logger.error("Error @ getProjection", e); throw new ServiceException(e); } } return new ProjectionResponse("", resourceType, totalAssets, year, quarter, projectionList); }  }
ProjectionServiceImpl implements ProjectionService, Constants { @Override public ProjectionResponse getProjection(String resourceType, int year, int quarter) throws ServiceException { Long totalAssets = 0l; List<Map<String, Object>> projectionList = new ArrayList<>(); if (projectionTargetTypes.contains(resourceType)) { try { projectionList = repository.getProjectionDetailsFromDb( resourceType, year, quarter); totalAssets = repository .getTotalAssetCountByTargetType(resourceType); } catch (DataException e) { logger.error("Error @ getProjection", e); throw new ServiceException(e); } } return new ProjectionResponse("", resourceType, totalAssets, year, quarter, projectionList); }  @Override Boolean updateProjection(ProjectionRequest projectionRequest); @Override ProjectionResponse getProjection(String resourceType, int year,
            int quarter); Long getTotalAsseCountByTargetType(String targetType); @Override ProjectionResponse getPatchingAndProjectionByWeek(String assetGroup); @Override PatchingProgressResponse getPatchingProgressByDirector(
            String assetGroup); @Override PatchingProgressResponse patchProgByExSponsor(String assetGroup); }
ProjectionServiceImpl implements ProjectionService, Constants { @Override public ProjectionResponse getProjection(String resourceType, int year, int quarter) throws ServiceException { Long totalAssets = 0l; List<Map<String, Object>> projectionList = new ArrayList<>(); if (projectionTargetTypes.contains(resourceType)) { try { projectionList = repository.getProjectionDetailsFromDb( resourceType, year, quarter); totalAssets = repository .getTotalAssetCountByTargetType(resourceType); } catch (DataException e) { logger.error("Error @ getProjection", e); throw new ServiceException(e); } } return new ProjectionResponse("", resourceType, totalAssets, year, quarter, projectionList); }  @Override Boolean updateProjection(ProjectionRequest projectionRequest); @Override ProjectionResponse getProjection(String resourceType, int year,
            int quarter); Long getTotalAsseCountByTargetType(String targetType); @Override ProjectionResponse getPatchingAndProjectionByWeek(String assetGroup); @Override PatchingProgressResponse getPatchingProgressByDirector(
            String assetGroup); @Override PatchingProgressResponse patchProgByExSponsor(String assetGroup);  }