@Test public void givenNotSignedResponse_RaiseException() throws ClientProtocolException, IOException, JAXBException, Oadr20bException, Oadr20bMarshalException, URISyntaxException, Oadr20bHttpLayerException, Oadr20bXMLSignatureException, Oadr20bXMLSignatureValidationException, OadrSecurityException { OadrHttpClient oadrHttpClient = Mockito.mock(OadrHttpClient.class); int scOk = HttpStatus.SC_OK; OadrResponseType mockOadrResponseType = Oadr20bResponseBuilders.newOadr20bResponseBuilder("", scOk, "venId") .build(); String marshal = jaxbContext.marshalRoot(mockOadrResponseType); HttpResponse response = this.createHttpResponse(scOk, marshal); when(oadrHttpClient.execute(Matchers.<HttpPost>anyObject(), any(), any(), any())).thenReturn(response); String certPath = "src/test/resources/cert/test"; OadrHttpClient20b client = new OadrHttpClient20b(oadrHttpClient, certPath + ".key", certPath + ".crt", 1200L); OadrDistributeEventType mockDistributeEvent = this.createOadrDistributeEvent(); boolean exception = false; try { client.post(Oadr20bFactory.createOadrDistributeEvent(mockDistributeEvent), Oadr20bUrlPath.OADR_BASE_PATH + Oadr20bUrlPath.EI_EVENT_SERVICE, OadrResponseType.class); } catch (Oadr20bException e) { exception = true; } assertTrue(exception); }
public <T, I extends JAXBElement<?>> T post(I payload, String path, Class<T> responseKlass) throws Oadr20bException, Oadr20bHttpLayerException, Oadr20bXMLSignatureException, Oadr20bXMLSignatureValidationException { return this.post(null, path, null, payload, responseKlass); }
OadrHttpClient20b { public <T, I extends JAXBElement<?>> T post(I payload, String path, Class<T> responseKlass) throws Oadr20bException, Oadr20bHttpLayerException, Oadr20bXMLSignatureException, Oadr20bXMLSignatureValidationException { return this.post(null, path, null, payload, responseKlass); } }
OadrHttpClient20b { public <T, I extends JAXBElement<?>> T post(I payload, String path, Class<T> responseKlass) throws Oadr20bException, Oadr20bHttpLayerException, Oadr20bXMLSignatureException, Oadr20bXMLSignatureValidationException { return this.post(null, path, null, payload, responseKlass); } OadrHttpClient20b(OadrHttpClient client);  OadrHttpClient20b(OadrHttpClient client, String privateKeyPath, String clientCertificatePath,
			Long replayProtectAcceptedDelaySecond);  OadrHttpClient20b(OadrHttpClient client, String privateKeyPath, String clientCertificatePath,
			Long replayProtectAcceptedDelaySecond, Boolean validateXmlPayload); }
OadrHttpClient20b { public <T, I extends JAXBElement<?>> T post(I payload, String path, Class<T> responseKlass) throws Oadr20bException, Oadr20bHttpLayerException, Oadr20bXMLSignatureException, Oadr20bXMLSignatureValidationException { return this.post(null, path, null, payload, responseKlass); } OadrHttpClient20b(OadrHttpClient client);  OadrHttpClient20b(OadrHttpClient client, String privateKeyPath, String clientCertificatePath,
			Long replayProtectAcceptedDelaySecond);  OadrHttpClient20b(OadrHttpClient client, String privateKeyPath, String clientCertificatePath,
			Long replayProtectAcceptedDelaySecond, Boolean validateXmlPayload); T post(I payload, String path, Class<T> responseKlass); O post(String host, String path, HttpClientContext context, I payload,
			Class<O> responseKlass); }
OadrHttpClient20b { public <T, I extends JAXBElement<?>> T post(I payload, String path, Class<T> responseKlass) throws Oadr20bException, Oadr20bHttpLayerException, Oadr20bXMLSignatureException, Oadr20bXMLSignatureValidationException { return this.post(null, path, null, payload, responseKlass); } OadrHttpClient20b(OadrHttpClient client);  OadrHttpClient20b(OadrHttpClient client, String privateKeyPath, String clientCertificatePath,
			Long replayProtectAcceptedDelaySecond);  OadrHttpClient20b(OadrHttpClient client, String privateKeyPath, String clientCertificatePath,
			Long replayProtectAcceptedDelaySecond, Boolean validateXmlPayload); T post(I payload, String path, Class<T> responseKlass); O post(String host, String path, HttpClientContext context, I payload,
			Class<O> responseKlass);  }