@Test public void test_should_return_department_by_id() { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(new Resources().getFileContents("departmentResponse.json"), MediaType.APPLICATION_JSON_UTF8)); final DepartmentRes departmentRes=departmentRestRepository.getDepartmentById(1L,"default"); server.verify(); assertEquals(1, departmentRes.getDepartment().size()); }
public DepartmentRes getDepartmentById(final Long departmentId, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().apiId("apiID").ver("ver").ts(new Date()).msgId("msgID").build()).build(); return restTemplate.postForObject(departmentByIdUrl,wrapper,DepartmentRes.class, departmentId, tenantId); }
DepartmentRestRepository { public DepartmentRes getDepartmentById(final Long departmentId, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().apiId("apiID").ver("ver").ts(new Date()).msgId("msgID").build()).build(); return restTemplate.postForObject(departmentByIdUrl,wrapper,DepartmentRes.class, departmentId, tenantId); } }
DepartmentRestRepository { public DepartmentRes getDepartmentById(final Long departmentId, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().apiId("apiID").ver("ver").ts(new Date()).msgId("msgID").build()).build(); return restTemplate.postForObject(departmentByIdUrl,wrapper,DepartmentRes.class, departmentId, tenantId); } @Autowired  DepartmentRestRepository(final RestTemplate restTemplate,
                                    @Value("${egov.services.commonmasters.host}") final String departmentServiceHostname,
                                    @Value("${egov.services.common_masters.department}") final String departmentByIdUrl); }
DepartmentRestRepository { public DepartmentRes getDepartmentById(final Long departmentId, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().apiId("apiID").ver("ver").ts(new Date()).msgId("msgID").build()).build(); return restTemplate.postForObject(departmentByIdUrl,wrapper,DepartmentRes.class, departmentId, tenantId); } @Autowired  DepartmentRestRepository(final RestTemplate restTemplate,
                                    @Value("${egov.services.commonmasters.host}") final String departmentServiceHostname,
                                    @Value("${egov.services.common_masters.department}") final String departmentByIdUrl); DepartmentRes getDepartmentById(final Long departmentId, final String tenantId); }
DepartmentRestRepository { public DepartmentRes getDepartmentById(final Long departmentId, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().apiId("apiID").ver("ver").ts(new Date()).msgId("msgID").build()).build(); return restTemplate.postForObject(departmentByIdUrl,wrapper,DepartmentRes.class, departmentId, tenantId); } @Autowired  DepartmentRestRepository(final RestTemplate restTemplate,
                                    @Value("${egov.services.commonmasters.host}") final String departmentServiceHostname,
                                    @Value("${egov.services.common_masters.department}") final String departmentByIdUrl); DepartmentRes getDepartmentById(final Long departmentId, final String tenantId);  }