WebSocketPushEventsListener extends AbstractTestListener implements MessageListener, TestListener, TestActionListener, InitializingBean { @Override public void onTestFailure(TestCase test, Throwable cause) { pushTestEvent(getTestEvent(test, "TEST_FAILED", test.getName())); pushResult(getTestResult(test, cause, false)); }  @Override void onTestStart(TestCase test); @Override void onTestFailure(TestCase test, Throwable cause); @Override void onTestSuccess(TestCase test); @Override void onInboundMessage(Message message, TestContext testContext); @Override void onOutboundMessage(Message message, TestContext testContext); @Override void onTestActionStart(TestCase test, TestAction testAction); @Override void onTestActionFinish(TestCase test, TestAction testAction); @Override void onTestActionSkipped(TestCase test, TestAction testAction); @Override void afterPropertiesSet(); RestTemplate getRestTemplate(); void setHost(String host); void setPort(int port); void setRestTemplate(RestTemplate restTemplate);  }
@Test public void testOnTestErrorResult() throws Exception { TestCase test = new TestCase(); test.setName("MyTestIT"); Throwable cause = Mockito.mock(Throwable.class); reset(restTemplate); when(cause.getMessage()).thenReturn("Something went wrong!"); when(cause.getCause()).thenReturn(new NullPointerException()); when(restTemplate.exchange(eq("http: HttpEntity request = (HttpEntity) invocation.getArguments()[2]; Assert.assertEquals(request.getBody().toString(), "{\"errorCause\":\"java.lang.NullPointerException\",\"test\":{\"name\":\"MyTestIT\",\"className\":\"TestCase\",\"packageName\":\"com.consol.citrus\",\"type\":\"JAVA\"},\"processId\":\"MyTestIT\",\"success\":false,\"errorMessage\":\"Something went wrong!\",\"stackTrace\":\"\"}"); return ResponseEntity.ok().build(); }); when(restTemplate.exchange(eq("http: HttpEntity request = (HttpEntity) invocation.getArguments()[2]; Assert.assertEquals(request.getBody().toString(), "{\"msg\":\"MyTestIT\",\"processId\":\"MyTestIT\",\"type\":\"TEST_FAILED\"}"); return ResponseEntity.ok().build(); }); pushMessageListener.onTestFailure(test, cause); verify(restTemplate).exchange(eq("http: verify(restTemplate).exchange(eq("http: }