@Test public void testSearch1() { Pagination<AccountDetailKey> expectedResult = new Pagination<>(); expectedResult.setPageSize(500); expectedResult.setOffset(0); when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); when(accountDetailKeyESRepository.search(any(AccountDetailKeySearchContract.class))).thenReturn(expectedResult); Pagination<AccountDetailKey> actualResult = accountDetailKeyRepository.search(getAccountDetailKeySearch()); assertEquals(expectedResult, actualResult); }
public Pagination<AccountDetailKey> search(final AccountDetailKeySearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { final AccountDetailKeySearchContract accountDetailKeySearchContract = new AccountDetailKeySearchContract(); final ModelMapper mapper = new ModelMapper(); mapper.map(domain, accountDetailKeySearchContract); return accountDetailKeyESRepository.search(accountDetailKeySearchContract); } else return accountDetailKeyJdbcRepository.search(domain); }
AccountDetailKeyRepository { public Pagination<AccountDetailKey> search(final AccountDetailKeySearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { final AccountDetailKeySearchContract accountDetailKeySearchContract = new AccountDetailKeySearchContract(); final ModelMapper mapper = new ModelMapper(); mapper.map(domain, accountDetailKeySearchContract); return accountDetailKeyESRepository.search(accountDetailKeySearchContract); } else return accountDetailKeyJdbcRepository.search(domain); } }
AccountDetailKeyRepository { public Pagination<AccountDetailKey> search(final AccountDetailKeySearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { final AccountDetailKeySearchContract accountDetailKeySearchContract = new AccountDetailKeySearchContract(); final ModelMapper mapper = new ModelMapper(); mapper.map(domain, accountDetailKeySearchContract); return accountDetailKeyESRepository.search(accountDetailKeySearchContract); } else return accountDetailKeyJdbcRepository.search(domain); } @Autowired  AccountDetailKeyRepository(AccountDetailKeyJdbcRepository accountDetailKeyJdbcRepository,
			MastersQueueRepository accountDetailKeyQueueRepository,
			FinancialConfigurationService financialConfigurationService,
			AccountDetailKeyESRepository accountDetailKeyESRepository,
			@Value("${persist.through.kafka}") String persistThroughKafka); }
AccountDetailKeyRepository { public Pagination<AccountDetailKey> search(final AccountDetailKeySearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { final AccountDetailKeySearchContract accountDetailKeySearchContract = new AccountDetailKeySearchContract(); final ModelMapper mapper = new ModelMapper(); mapper.map(domain, accountDetailKeySearchContract); return accountDetailKeyESRepository.search(accountDetailKeySearchContract); } else return accountDetailKeyJdbcRepository.search(domain); } @Autowired  AccountDetailKeyRepository(AccountDetailKeyJdbcRepository accountDetailKeyJdbcRepository,
			MastersQueueRepository accountDetailKeyQueueRepository,
			FinancialConfigurationService financialConfigurationService,
			AccountDetailKeyESRepository accountDetailKeyESRepository,
			@Value("${persist.through.kafka}") String persistThroughKafka); @Transactional List<AccountDetailKey> save(List<AccountDetailKey> accountDetailKies, RequestInfo requestInfo); @Transactional List<AccountDetailKey> update(List<AccountDetailKey> accountDetailKies, RequestInfo requestInfo); void addToQue(AccountDetailKeyRequest request); void addToSearchQueue(AccountDetailKeyRequest request); AccountDetailKey findById(AccountDetailKey accountDetailKey); String getNextSequence(); @Transactional AccountDetailKey save(AccountDetailKey accountDetailKey); @Transactional AccountDetailKey update(AccountDetailKey accountDetailKey); void add(AccountDetailKeyRequest request); Pagination<AccountDetailKey> search(final AccountDetailKeySearch domain); boolean uniqueCheck(String fieldName, AccountDetailKey accountDetailKey); }
AccountDetailKeyRepository { public Pagination<AccountDetailKey> search(final AccountDetailKeySearch domain) { if (!financialConfigurationService.fetchDataFrom().isEmpty() && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { final AccountDetailKeySearchContract accountDetailKeySearchContract = new AccountDetailKeySearchContract(); final ModelMapper mapper = new ModelMapper(); mapper.map(domain, accountDetailKeySearchContract); return accountDetailKeyESRepository.search(accountDetailKeySearchContract); } else return accountDetailKeyJdbcRepository.search(domain); } @Autowired  AccountDetailKeyRepository(AccountDetailKeyJdbcRepository accountDetailKeyJdbcRepository,
			MastersQueueRepository accountDetailKeyQueueRepository,
			FinancialConfigurationService financialConfigurationService,
			AccountDetailKeyESRepository accountDetailKeyESRepository,
			@Value("${persist.through.kafka}") String persistThroughKafka); @Transactional List<AccountDetailKey> save(List<AccountDetailKey> accountDetailKies, RequestInfo requestInfo); @Transactional List<AccountDetailKey> update(List<AccountDetailKey> accountDetailKies, RequestInfo requestInfo); void addToQue(AccountDetailKeyRequest request); void addToSearchQueue(AccountDetailKeyRequest request); AccountDetailKey findById(AccountDetailKey accountDetailKey); String getNextSequence(); @Transactional AccountDetailKey save(AccountDetailKey accountDetailKey); @Transactional AccountDetailKey update(AccountDetailKey accountDetailKey); void add(AccountDetailKeyRequest request); Pagination<AccountDetailKey> search(final AccountDetailKeySearch domain); boolean uniqueCheck(String fieldName, AccountDetailKey accountDetailKey);  }