@Test public void shouldCreateSellerSession() throws IOException { HttpResponse response = new HttpResponse(200, responseAsString); when(httpClient.execute(any(HttpMethod.class), anyString(), anyMap(), any(HttpRequestBody.class))).thenReturn(response); CreatedSession createdSession = sessionResource.create(); assertEquals(createdSession.getId(), "d8ebd56d32444161852eeb33a6112df6"); }
public CreatedSession create(String authorizationCode) { final RequestMap map = new RequestMap(); map.putString("authorizationCode", authorizationCode); final HttpResponse response; try { response = httpClient.execute(HttpMethod.POST, String.format(Endpoints.SESSION_CREATE_APPLICATION, pagSeguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); } catch (IOException e) { throw new PagSeguroLibException(e); } return response.parseXMLContent(pagSeguro, CreatedSessionXML.class); }
SessionResource { public CreatedSession create(String authorizationCode) { final RequestMap map = new RequestMap(); map.putString("authorizationCode", authorizationCode); final HttpResponse response; try { response = httpClient.execute(HttpMethod.POST, String.format(Endpoints.SESSION_CREATE_APPLICATION, pagSeguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); } catch (IOException e) { throw new PagSeguroLibException(e); } return response.parseXMLContent(pagSeguro, CreatedSessionXML.class); } }
SessionResource { public CreatedSession create(String authorizationCode) { final RequestMap map = new RequestMap(); map.putString("authorizationCode", authorizationCode); final HttpResponse response; try { response = httpClient.execute(HttpMethod.POST, String.format(Endpoints.SESSION_CREATE_APPLICATION, pagSeguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); } catch (IOException e) { throw new PagSeguroLibException(e); } return response.parseXMLContent(pagSeguro, CreatedSessionXML.class); } SessionResource(PagSeguro pagSeguro, HttpClient httpClient); }
SessionResource { public CreatedSession create(String authorizationCode) { final RequestMap map = new RequestMap(); map.putString("authorizationCode", authorizationCode); final HttpResponse response; try { response = httpClient.execute(HttpMethod.POST, String.format(Endpoints.SESSION_CREATE_APPLICATION, pagSeguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); } catch (IOException e) { throw new PagSeguroLibException(e); } return response.parseXMLContent(pagSeguro, CreatedSessionXML.class); } SessionResource(PagSeguro pagSeguro, HttpClient httpClient); CreatedSession create(String authorizationCode); CreatedSession create(); CreatedSession createDirectPreApproval(String authorizationCode); CreatedSession createDirectPreApproval(); }
SessionResource { public CreatedSession create(String authorizationCode) { final RequestMap map = new RequestMap(); map.putString("authorizationCode", authorizationCode); final HttpResponse response; try { response = httpClient.execute(HttpMethod.POST, String.format(Endpoints.SESSION_CREATE_APPLICATION, pagSeguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); } catch (IOException e) { throw new PagSeguroLibException(e); } return response.parseXMLContent(pagSeguro, CreatedSessionXML.class); } SessionResource(PagSeguro pagSeguro, HttpClient httpClient); CreatedSession create(String authorizationCode); CreatedSession create(); CreatedSession createDirectPreApproval(String authorizationCode); CreatedSession createDirectPreApproval();  }