private void handleStatusMessage(Message message) { try { String sender = message.getStringProperty(SENDER); services.add(new Service(sender, dateTimeProvider)); } catch (JMSException e) { LOGGER.error("Error while processing JMS map message. ", e); } }
@Test public void serviceUpdateMessage_shouldBeReflectedInServicesObject_whenTextMessageReceived() throws JMSException { Mockito.when(textMessage.getStringProperty("sender")).thenReturn("service"); Mockito.when(dateTimeProvider.now()).thenReturn(now); sut.onMessage(textMessage); List<Service> allServices = services.getAllServices(); assertEquals(1, allServices.size()); assertEquals("service - 2015-12-03T10:15:30Z", allServices.get(0).getServiceDetails()); }