@Test public void testForSearch() { RegnUnitResponse regnUnitResponse = null; try { regnUnitResponse = getRegistrationUnitResponse("org/egov/mr/service/registrationUnitsListForSearch.json"); } catch (Exception e) { e.printStackTrace(); fail(); } RegistrationUnitSearchCriteria registrationUnitSearchCriteria = RegistrationUnitSearchCriteria.builder() .tenantId("KA.BANGALORE").build(); when(registrationUnitRepository.search(any(RegistrationUnitSearchCriteria.class))) .thenReturn(getRegnUnitsFromDB()); List<RegistrationUnit> actualRegistrationUnitsList = registrationUnitService .search(registrationUnitSearchCriteria); List<RegistrationUnit> expectedRegistrationUnits = new ArrayList(); expectedRegistrationUnits.add(regnUnitResponse.getRegnUnits().get(0)); expectedRegistrationUnits.add(regnUnitResponse.getRegnUnits().get(1)); expectedRegistrationUnits.add(regnUnitResponse.getRegnUnits().get(2)); assertTrue(registrationUnitSearchCriteria.getTenantId().equals("KA.BANGALORE")); assertEquals(expectedRegistrationUnits.get(0), actualRegistrationUnitsList.get(0)); assertEquals(expectedRegistrationUnits.get(1), actualRegistrationUnitsList.get(1)); assertEquals(expectedRegistrationUnits.get(2), actualRegistrationUnitsList.get(2)); }
public List<RegistrationUnit> search(RegistrationUnitSearchCriteria regnUnitSearchCriteria) { return registrationUnitRepository.search(regnUnitSearchCriteria); }
RegistrationUnitService { public List<RegistrationUnit> search(RegistrationUnitSearchCriteria regnUnitSearchCriteria) { return registrationUnitRepository.search(regnUnitSearchCriteria); } }
RegistrationUnitService { public List<RegistrationUnit> search(RegistrationUnitSearchCriteria regnUnitSearchCriteria) { return registrationUnitRepository.search(regnUnitSearchCriteria); }  }
RegistrationUnitService { public List<RegistrationUnit> search(RegistrationUnitSearchCriteria regnUnitSearchCriteria) { return registrationUnitRepository.search(regnUnitSearchCriteria); }  List<RegistrationUnit> createAsync(RegnUnitRequest regnUnitRequest); List<RegistrationUnit> search(RegistrationUnitSearchCriteria regnUnitSearchCriteria); List<RegistrationUnit> updateAsync(RegnUnitRequest regnUnitRequest); void create(RegnUnitRequest regnUnitRequest); void update(RegnUnitRequest regnUnitRequest); }
RegistrationUnitService { public List<RegistrationUnit> search(RegistrationUnitSearchCriteria regnUnitSearchCriteria) { return registrationUnitRepository.search(regnUnitSearchCriteria); }  List<RegistrationUnit> createAsync(RegnUnitRequest regnUnitRequest); List<RegistrationUnit> search(RegistrationUnitSearchCriteria regnUnitSearchCriteria); List<RegistrationUnit> updateAsync(RegnUnitRequest regnUnitRequest); void create(RegnUnitRequest regnUnitRequest); void update(RegnUnitRequest regnUnitRequest);  }