@Test public void findUserById() throws Exception { final RequestInfo requestInfo = RequestInfo.builder().apiId("org.egov.pgr").ver("1.0").msgId("654654") .authToken("cdaaa28a-f88a-429e-a710-b401097a165c").build(); final User user = User.builder().id(67l).tenantId("tenantId").build(); server.expect(once(), requestTo("http: .andExpect(content().string(new Resources().getFileContents("searchUserByIdRequest.json"))) .andRespond(withSuccess(new Resources().getFileContents("searchUserById.json"), MediaType.APPLICATION_JSON_UTF8)); final UserResponse userResponse = userRepository.findUserByIdAndTenantId(67L,"tenantId"); server.verify(); assertEquals(1, userResponse.getUser().size()); }
public UserResponse findUserByIdAndTenantId(Long userId,String tenantId) { String url = String.format("%s%s", userHost, userServiceUrl); UserRequest userRequest = UserRequest.builder().requestInfo(new RequestInfo()) .id(Collections.singletonList(userId)).tenantId(tenantId).build(); return restTemplate.postForObject(url, userRequest, UserResponse.class); }
UserRepository { public UserResponse findUserByIdAndTenantId(Long userId,String tenantId) { String url = String.format("%s%s", userHost, userServiceUrl); UserRequest userRequest = UserRequest.builder().requestInfo(new RequestInfo()) .id(Collections.singletonList(userId)).tenantId(tenantId).build(); return restTemplate.postForObject(url, userRequest, UserResponse.class); } }
UserRepository { public UserResponse findUserByIdAndTenantId(Long userId,String tenantId) { String url = String.format("%s%s", userHost, userServiceUrl); UserRequest userRequest = UserRequest.builder().requestInfo(new RequestInfo()) .id(Collections.singletonList(userId)).tenantId(tenantId).build(); return restTemplate.postForObject(url, userRequest, UserResponse.class); } UserRepository(RestTemplate restTemplate, @Value("${user.service.url}") final String userHostUrl,
			@Value("${egov.services.user_by_id}") final String userServiceUrl); }
UserRepository { public UserResponse findUserByIdAndTenantId(Long userId,String tenantId) { String url = String.format("%s%s", userHost, userServiceUrl); UserRequest userRequest = UserRequest.builder().requestInfo(new RequestInfo()) .id(Collections.singletonList(userId)).tenantId(tenantId).build(); return restTemplate.postForObject(url, userRequest, UserResponse.class); } UserRepository(RestTemplate restTemplate, @Value("${user.service.url}") final String userHostUrl,
			@Value("${egov.services.user_by_id}") final String userServiceUrl); UserResponse findUserByIdAndTenantId(Long userId,String tenantId); }
UserRepository { public UserResponse findUserByIdAndTenantId(Long userId,String tenantId) { String url = String.format("%s%s", userHost, userServiceUrl); UserRequest userRequest = UserRequest.builder().requestInfo(new RequestInfo()) .id(Collections.singletonList(userId)).tenantId(tenantId).build(); return restTemplate.postForObject(url, userRequest, UserResponse.class); } UserRepository(RestTemplate restTemplate, @Value("${user.service.url}") final String userHostUrl,
			@Value("${egov.services.user_by_id}") final String userServiceUrl); UserResponse findUserByIdAndTenantId(Long userId,String tenantId);  }