### Question:
TraceeMessagePropertiesConverter extends DefaultMessagePropertiesConverter { @Override public MessageProperties toMessageProperties(AMQP.BasicProperties source, Envelope envelope, String charset) { final MessageProperties messageProperties = super.toMessageProperties(source, envelope, charset); final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile); if (filterConfiguration.shouldProcessContext(AsyncProcess)) { final Map<String, String> traceeContextMap = transformToTraceeContextMap( (Map<String, ?>) messageProperties.getHeaders().get(TPIC_HEADER)); if (traceeContextMap != null && !traceeContextMap.isEmpty()) { backend.putAll(filterConfiguration.filterDeniedParams(traceeContextMap, AsyncProcess)); } } Utilities.generateInvocationIdIfNecessary(backend); return messageProperties; } TraceeMessagePropertiesConverter();  TraceeMessagePropertiesConverter(String profile);   TraceeMessagePropertiesConverter(TraceeBackend backend, String profile); @Override MessageProperties toMessageProperties(AMQP.BasicProperties source, Envelope envelope, String charset); @Override AMQP.BasicProperties fromMessageProperties(MessageProperties source, String charset);  }### Answer:
@Test public void messageParserShouldHandleMissingTpicHeaderAndGenerateInvocationId() { unit.toMessageProperties(createRabbitHeaderWith("anyKey", "anyValue"), mock(Envelope.class), CHARSET_UTF8); assertThat(backend.copyToMap(), hasKey(TraceeConstants.INVOCATION_ID_KEY)); }
@Test public void parseMessageHeaderIntoBackend() throws Exception { final Map<String, LongString> rabbitTraceeHeader = new HashMap<>(); rabbitTraceeHeader.put(INVOCATION_ID_KEY, new TestLongString("Crazy ID")); unit.toMessageProperties(createRabbitHeaderWith(TPIC_HEADER, rabbitTraceeHeader), mock(Envelope.class), CHARSET_UTF8); assertThat(backend.copyToMap(), hasEntry(INVOCATION_ID_KEY, "Crazy ID")); }
@Test public void noTraceeHeaderShouldResultInGeneratedRequestId() throws Exception { unit.toMessageProperties(createRabbitHeaderWith("someHeader", "fromResponse=true"), mock(Envelope.class), CHARSET_UTF8); assertThat(backend.copyToMap(), hasKey(INVOCATION_ID_KEY)); assertThat(backend.size(), is(1)); }