@Test public void httpLayerErrorPostTest() throws ClientProtocolException, IOException, JAXBException, Oadr20aException, Oadr20aMarshalException, URISyntaxException, Oadr20aHttpLayerException { OadrHttpClient oadrHttpClient = Mockito.mock(OadrHttpClient.class); int scForbidden = HttpStatus.SC_FORBIDDEN; OadrResponse mockOadrResponse = Oadr20aBuilders.newOadr20aResponseBuilder("", scForbidden).build(); String marshal = jaxbContext.marshal(mockOadrResponse); HttpResponse response = this.createHttpResponse(scForbidden, marshal); when(oadrHttpClient.execute(Matchers.<HttpPost>anyObject(), any(), any(), any())).thenReturn(response); OadrHttpClient20a client = new OadrHttpClient20a(oadrHttpClient); OadrDistributeEvent mockDistributeEvent = this.createOadrDistributeEvent(); boolean exception = false; try { client.post(mockDistributeEvent, Oadr20aUrlPath.OADR_BASE_PATH + Oadr20aUrlPath.EI_EVENT_SERVICE, OadrResponse.class); } catch (Oadr20aHttpLayerException e) { exception = true; } assertTrue(exception); }
public <T> T post(Object payload, String path, Class<T> responseKlass) throws Oadr20aException, Oadr20aHttpLayerException { return this.post(null, path, null, payload, responseKlass); }
OadrHttpClient20a { public <T> T post(Object payload, String path, Class<T> responseKlass) throws Oadr20aException, Oadr20aHttpLayerException { return this.post(null, path, null, payload, responseKlass); } }
OadrHttpClient20a { public <T> T post(Object payload, String path, Class<T> responseKlass) throws Oadr20aException, Oadr20aHttpLayerException { return this.post(null, path, null, payload, responseKlass); } OadrHttpClient20a(OadrHttpClient client); }
OadrHttpClient20a { public <T> T post(Object payload, String path, Class<T> responseKlass) throws Oadr20aException, Oadr20aHttpLayerException { return this.post(null, path, null, payload, responseKlass); } OadrHttpClient20a(OadrHttpClient client); T post(Object payload, String path, Class<T> responseKlass); T post(String host, String path, HttpClientContext context, Object payload, Class<T> responseKlass); }
OadrHttpClient20a { public <T> T post(Object payload, String path, Class<T> responseKlass) throws Oadr20aException, Oadr20aHttpLayerException { return this.post(null, path, null, payload, responseKlass); } OadrHttpClient20a(OadrHttpClient client); T post(Object payload, String path, Class<T> responseKlass); T post(String host, String path, HttpClientContext context, Object payload, Class<T> responseKlass);  }