@Ignore @Test public void test_should_return_otp_for_given_request() { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)) .andExpect(content().string(resources.getFileContents("otpRequest.json"))) .andRespond( withSuccess(resources.getFileContents("otpSuccessResponse.json"), MediaType.APPLICATION_JSON_UTF8)); final OtpRequest domainOtpRequest = OtpRequest.builder() .tenantId("tenantId") .mobileNumber("mobileNumber") .build(); final String otp = otpRepository.fetchOtp(domainOtpRequest); server.verify(); assertEquals("otpNumber", otp); }
public String fetchOtp(OtpRequest otpRequest) { final org.egov.persistence.contract.OtpRequest request = new org.egov.persistence.contract.OtpRequest(otpRequest); final OtpResponse otpResponse = restTemplate.postForObject(otpCreateUrl, request, OtpResponse.class); if(isOtpNumberAbsent(otpResponse)) { throw new OtpNumberNotPresentException(); } return otpResponse.getOtpNumber(); }
OtpRepository { public String fetchOtp(OtpRequest otpRequest) { final org.egov.persistence.contract.OtpRequest request = new org.egov.persistence.contract.OtpRequest(otpRequest); final OtpResponse otpResponse = restTemplate.postForObject(otpCreateUrl, request, OtpResponse.class); if(isOtpNumberAbsent(otpResponse)) { throw new OtpNumberNotPresentException(); } return otpResponse.getOtpNumber(); } }
OtpRepository { public String fetchOtp(OtpRequest otpRequest) { final org.egov.persistence.contract.OtpRequest request = new org.egov.persistence.contract.OtpRequest(otpRequest); final OtpResponse otpResponse = restTemplate.postForObject(otpCreateUrl, request, OtpResponse.class); if(isOtpNumberAbsent(otpResponse)) { throw new OtpNumberNotPresentException(); } return otpResponse.getOtpNumber(); } OtpRepository(RestTemplate restTemplate,
                         @Value("${otp.host}") String otpHost,
                         @Value("${otp.create.url}") String otpCreateUrl); }
OtpRepository { public String fetchOtp(OtpRequest otpRequest) { final org.egov.persistence.contract.OtpRequest request = new org.egov.persistence.contract.OtpRequest(otpRequest); final OtpResponse otpResponse = restTemplate.postForObject(otpCreateUrl, request, OtpResponse.class); if(isOtpNumberAbsent(otpResponse)) { throw new OtpNumberNotPresentException(); } return otpResponse.getOtpNumber(); } OtpRepository(RestTemplate restTemplate,
                         @Value("${otp.host}") String otpHost,
                         @Value("${otp.create.url}") String otpCreateUrl); String fetchOtp(OtpRequest otpRequest); }
OtpRepository { public String fetchOtp(OtpRequest otpRequest) { final org.egov.persistence.contract.OtpRequest request = new org.egov.persistence.contract.OtpRequest(otpRequest); final OtpResponse otpResponse = restTemplate.postForObject(otpCreateUrl, request, OtpResponse.class); if(isOtpNumberAbsent(otpResponse)) { throw new OtpNumberNotPresentException(); } return otpResponse.getOtpNumber(); } OtpRepository(RestTemplate restTemplate,
                         @Value("${otp.host}") String otpHost,
                         @Value("${otp.create.url}") String otpCreateUrl); String fetchOtp(OtpRequest otpRequest);  }