WebSocketPushEventsListener extends AbstractTestListener implements MessageListener, TestListener, TestActionListener, InitializingBean { @Override public void onOutboundMessage(Message message, TestContext testContext) { pushMessage(getProcessId(testContext), message, "outbound"); }  @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 testOnOutboundMessage() throws Exception { Message outbound = new DefaultMessage("Hello Citrus!"); reset(restTemplate, context); when(restTemplate.exchange(eq("http: HttpEntity request = (HttpEntity) invocation.getArguments()[2]; Assert.assertEquals(request.getBody().toString(), outbound.toString()); return ResponseEntity.ok().build(); }); when(context.getVariables()).thenReturn(Collections.singletonMap(Citrus.TEST_NAME_VARIABLE, "MySampleTest")); when(context.getVariable(Citrus.TEST_NAME_VARIABLE)).thenReturn("MySampleTest"); pushMessageListener.onOutboundMessage(outbound, context); verify(restTemplate).exchange(eq("http: }