@Test public void shouldCallProductServiceIfColumnNameIsProduct() { String searchParam = "a"; String column = "Product"; when(productService.getTotalSearchResultCount(searchParam)).thenReturn(10); service.getTotalSearchResultCount(searchParam, column); verify(productService).getTotalSearchResultCount(searchParam); }
public Integer getTotalSearchResultCount(String searchParam, String column) { if (column.equalsIgnoreCase("Program")) { return programProductRepository.getTotalSearchResultCount(searchParam); } return productService.getTotalSearchResultCount(searchParam); }
ProgramProductService { public Integer getTotalSearchResultCount(String searchParam, String column) { if (column.equalsIgnoreCase("Program")) { return programProductRepository.getTotalSearchResultCount(searchParam); } return productService.getTotalSearchResultCount(searchParam); } }
ProgramProductService { public Integer getTotalSearchResultCount(String searchParam, String column) { if (column.equalsIgnoreCase("Program")) { return programProductRepository.getTotalSearchResultCount(searchParam); } return productService.getTotalSearchResultCount(searchParam); }  }
ProgramProductService { public Integer getTotalSearchResultCount(String searchParam, String column) { if (column.equalsIgnoreCase("Program")) { return programProductRepository.getTotalSearchResultCount(searchParam); } return productService.getTotalSearchResultCount(searchParam); }  Long getIdByProgramIdAndProductId(Long programId, Long productId); void updateProgramProductPrice(ProgramProductPrice programProductPrice); void save(ProgramProduct programProduct); void saveAndLogPriceChange(ProgramProduct programProduct); ProgramProduct getByProgramAndProductCode(ProgramProduct programProduct); ProgramProductPrice getProgramProductPrice(ProgramProduct programProduct); List<ProgramProduct> getByProgram(Program program); List<ProgramProduct> getByProductCode(String productCode); List<ProgramProduct> getProgramProductsBy(String programCode, String facilityTypeCode); List<ProgramProduct> getNonFullSupplyProductsForProgram(Program program); List<ProgramProduct> getActiveByProgram(Long programId); ProgramProduct getByProgramAndProductId(Long programId, Long productId); List<ProgramProduct> search(String searchParam, Pagination pagination, String column); List<ProgramProduct> getUnapprovedProgramProducts(Long facilityTypeId, Long programId); Integer getTotalSearchResultCount(String searchParam, String column); @Transactional void saveAll(List<ProgramProduct> programProducts, Product product); void insertISA(ProgramProductISA isa); void updateISA(ProgramProductISA isa); }
ProgramProductService { public Integer getTotalSearchResultCount(String searchParam, String column) { if (column.equalsIgnoreCase("Program")) { return programProductRepository.getTotalSearchResultCount(searchParam); } return productService.getTotalSearchResultCount(searchParam); }  Long getIdByProgramIdAndProductId(Long programId, Long productId); void updateProgramProductPrice(ProgramProductPrice programProductPrice); void save(ProgramProduct programProduct); void saveAndLogPriceChange(ProgramProduct programProduct); ProgramProduct getByProgramAndProductCode(ProgramProduct programProduct); ProgramProductPrice getProgramProductPrice(ProgramProduct programProduct); List<ProgramProduct> getByProgram(Program program); List<ProgramProduct> getByProductCode(String productCode); List<ProgramProduct> getProgramProductsBy(String programCode, String facilityTypeCode); List<ProgramProduct> getNonFullSupplyProductsForProgram(Program program); List<ProgramProduct> getActiveByProgram(Long programId); ProgramProduct getByProgramAndProductId(Long programId, Long productId); List<ProgramProduct> search(String searchParam, Pagination pagination, String column); List<ProgramProduct> getUnapprovedProgramProducts(Long facilityTypeId, Long programId); Integer getTotalSearchResultCount(String searchParam, String column); @Transactional void saveAll(List<ProgramProduct> programProducts, Product product); void insertISA(ProgramProductISA isa); void updateISA(ProgramProductISA isa);  }