@Test public void testSearch() { Pagination<ChartOfAccountDetail> expectedResult = new Pagination<>(); expectedResult.setPageSize(500); expectedResult.setOffset(0); when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); when(chartofAccountDetailJdbcRepository.search(any(ChartOfAccountDetailSearch.class))).thenReturn(expectedResult); Pagination<ChartOfAccountDetail> actualResult = chartOfAccountDetailRepository.search(getChartOfAccountDetailSearch()); assertEquals(expectedResult, actualResult); }
public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract = new ChartOfAccountDetailSearchContract(); ModelMapper mapper = new ModelMapper(); mapper.map(domain, chartOfAccountDetailSearchContract); return chartOfAccountDetailESRepository.search(chartOfAccountDetailSearchContract); } else { return chartOfAccountDetailJdbcRepository.search(domain); } }
ChartOfAccountDetailRepository { public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract = new ChartOfAccountDetailSearchContract(); ModelMapper mapper = new ModelMapper(); mapper.map(domain, chartOfAccountDetailSearchContract); return chartOfAccountDetailESRepository.search(chartOfAccountDetailSearchContract); } else { return chartOfAccountDetailJdbcRepository.search(domain); } } }
ChartOfAccountDetailRepository { public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract = new ChartOfAccountDetailSearchContract(); ModelMapper mapper = new ModelMapper(); mapper.map(domain, chartOfAccountDetailSearchContract); return chartOfAccountDetailESRepository.search(chartOfAccountDetailSearchContract); } else { return chartOfAccountDetailJdbcRepository.search(domain); } }  }
ChartOfAccountDetailRepository { public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract = new ChartOfAccountDetailSearchContract(); ModelMapper mapper = new ModelMapper(); mapper.map(domain, chartOfAccountDetailSearchContract); return chartOfAccountDetailESRepository.search(chartOfAccountDetailSearchContract); } else { return chartOfAccountDetailJdbcRepository.search(domain); } }  ChartOfAccountDetail findById(ChartOfAccountDetail chartOfAccountDetail); String getNextSequence(); @Transactional ChartOfAccountDetail save(ChartOfAccountDetail chartOfAccountDetail); @Transactional ChartOfAccountDetail update(ChartOfAccountDetail chartOfAccountDetail); void add(ChartOfAccountDetailRequest request); Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch domain); boolean uniqueCheck(String fieldName, ChartOfAccountDetail chartOfAccountDetail); }
ChartOfAccountDetailRepository { public Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract = new ChartOfAccountDetailSearchContract(); ModelMapper mapper = new ModelMapper(); mapper.map(domain, chartOfAccountDetailSearchContract); return chartOfAccountDetailESRepository.search(chartOfAccountDetailSearchContract); } else { return chartOfAccountDetailJdbcRepository.search(domain); } }  ChartOfAccountDetail findById(ChartOfAccountDetail chartOfAccountDetail); String getNextSequence(); @Transactional ChartOfAccountDetail save(ChartOfAccountDetail chartOfAccountDetail); @Transactional ChartOfAccountDetail update(ChartOfAccountDetail chartOfAccountDetail); void add(ChartOfAccountDetailRequest request); Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch domain); boolean uniqueCheck(String fieldName, ChartOfAccountDetail chartOfAccountDetail);  }