@Test public void shouldReturnTotalCountAsZeroIfSearchCriteriaIsInvalid() throws Exception { Integer count = service.getTotalSearchResultCount("name", "invalidName"); assertThat(count, is(0)); verify(repository, never()).getTotalSearchResultCount("name"); verify(repository, never()).getTotalParentSearchResultCount("name"); }
public Integer getTotalSearchResultCount(String param, String columnName) { if (columnName.equals("parentName")) { return repository.getTotalParentSearchResultCount(param); } if (columnName.equals("name")) { return repository.getTotalSearchResultCount(param); } return 0; }
GeographicZoneService { public Integer getTotalSearchResultCount(String param, String columnName) { if (columnName.equals("parentName")) { return repository.getTotalParentSearchResultCount(param); } if (columnName.equals("name")) { return repository.getTotalSearchResultCount(param); } return 0; } }
GeographicZoneService { public Integer getTotalSearchResultCount(String param, String columnName) { if (columnName.equals("parentName")) { return repository.getTotalParentSearchResultCount(param); } if (columnName.equals("name")) { return repository.getTotalSearchResultCount(param); } return 0; }  }
GeographicZoneService { public Integer getTotalSearchResultCount(String param, String columnName) { if (columnName.equals("parentName")) { return repository.getTotalParentSearchResultCount(param); } if (columnName.equals("name")) { return repository.getTotalSearchResultCount(param); } return 0; }  @Autowired void setPageSize(@Value("${search.page.size}") String pageSize); void save(GeographicZone geographicZone); GeographicZone getByCode(GeographicZone geographicZone); GeographicZone getById(Long id); List<GeographicZone> searchBy(String searchParam, String columnName, Integer page); List<GeographicLevel> getAllGeographicLevels(); List<GeographicZone> getAllGeographicZonesAbove(GeographicLevel level); Pagination getPagination(Integer page); Integer getTotalSearchResultCount(String param, String columnName); List<GeographicZone> getGeographicZonesByCodeOrName(String searchParam); Integer getGeographicZonesCountBy(String searchParam); void saveGisInfo(List<GeographicZoneGeometry> geoZoneGeometries, Long userId); }
GeographicZoneService { public Integer getTotalSearchResultCount(String param, String columnName) { if (columnName.equals("parentName")) { return repository.getTotalParentSearchResultCount(param); } if (columnName.equals("name")) { return repository.getTotalSearchResultCount(param); } return 0; }  @Autowired void setPageSize(@Value("${search.page.size}") String pageSize); void save(GeographicZone geographicZone); GeographicZone getByCode(GeographicZone geographicZone); GeographicZone getById(Long id); List<GeographicZone> searchBy(String searchParam, String columnName, Integer page); List<GeographicLevel> getAllGeographicLevels(); List<GeographicZone> getAllGeographicZonesAbove(GeographicLevel level); Pagination getPagination(Integer page); Integer getTotalSearchResultCount(String param, String columnName); List<GeographicZone> getGeographicZonesByCodeOrName(String searchParam); Integer getGeographicZonesCountBy(String searchParam); void saveGisInfo(List<GeographicZoneGeometry> geoZoneGeometries, Long userId);  }