### Question:
MotownRoutingKeyResolver implements RoutingKeyResolver { @Override public String resolveRoutingKey(EventMessage eventMessage) { if (eventMessage.getPayload() instanceof CommunicationWithChargingStationRequestedEvent) { CommunicationWithChargingStationRequestedEvent event = (CommunicationWithChargingStationRequestedEvent) eventMessage.getPayload(); return ROUTING_KEY_PREFIX + event.getProtocol(); } else { return this.routingKeyResolver.resolveRoutingKey(eventMessage); } } MotownRoutingKeyResolver(); @Override String resolveRoutingKey(EventMessage eventMessage);  }### Answer:
@Test public void testResolveRoutingKeyCommunicationWithChargingStationEvent() { EventMessage message = new GenericEventMessage<>(new HardResetChargingStationRequestedEvent(CHARGING_STATION_ID, PROTOCOL, ROOT_IDENTITY_CONTEXT)); String routingKey = resolver.resolveRoutingKey(message); String expected = routingKeyPrefix + PROTOCOL; assertEquals(expected, routingKey); }
@Test public void testResolveRoutingKeyNoCommunicationEvent() { EventMessage message = new GenericEventMessage<>(new ChargingStationSentHeartbeatEvent(CHARGING_STATION_ID, IDENTITY_CONTEXT)); String routingKey = resolver.resolveRoutingKey(message); String expected = ChargingStationSentHeartbeatEvent.class.getPackage().getName(); assertEquals(expected, routingKey); }