@Test
public void testConvertWeaselBeaconToSpan_withMetadata() throws ServletException, IOException {

	// Given - normal trace data
	MockHttpServletRequest mockHttpServletRequest = new MockHttpServletRequest();
	mockHttpServletRequest.setParameter("ty", "pl");
	mockHttpServletRequest.setParameter("r", "1496751574200");
	mockHttpServletRequest.setParameter("u", "http://localhost:9966/petclinic/");
	mockHttpServletRequest.setParameter("m_user", "tom.mason@example.com");
	mockHttpServletRequest.setParameter("ts", "-197");
	mockHttpServletRequest.setParameter("d", "518");
	mockHttpServletRequest.setParameter("t_unl", "0");
	mockHttpServletRequest.setParameter("t_red", "0");
	mockHttpServletRequest.setParameter("t_apc", "5");
	mockHttpServletRequest.setParameter("t_dns", "0");
	mockHttpServletRequest.setParameter("t_tcp", "0");
	mockHttpServletRequest.setParameter("t_ssl", "0");
	mockHttpServletRequest.setParameter("t_req", "38");
	mockHttpServletRequest.setParameter("t_rsp", "4");
	mockHttpServletRequest.setParameter("t_pro", "471");
	mockHttpServletRequest.setParameter("t_loa", "5");
	mockHttpServletRequest.setParameter("t_fp", "151");
	// Given - metadata
	mockHttpServletRequest.setParameter("m_username", "test string here");
	mockHttpServletRequest.setParameter("m_age", "26");
	mockHttpServletRequest.setParameter("m_is_access_allowed", "1");
	mockHttpServletRequest.setParameter("m_some_not_mapped_property", "this should not exist");
	// When
	final HashMap<String, ClientSpanMetadataDefinition> whitelistedValues = new HashMap<>();
	whitelistedValues.put("username", new ClientSpanMetadataDefinition("string"));
	whitelistedValues.put("age", new ClientSpanMetadataDefinition("number"));
	whitelistedValues.put("is_access_allowed", new ClientSpanMetadataDefinition("boolean"));
	whitelistedValues.put("parameter_not_sent", new ClientSpanMetadataDefinition("string"));
	when(servletPlugin.getWhitelistedClientSpanTags()).thenReturn(whitelistedValues);
	servlet.doGet(mockHttpServletRequest, new MockHttpServletResponse());
	// Then
	assertSoftly(softly -> {
		final List<MockSpan> finishedSpans = mockTracer.finishedSpans();
		softly.assertThat(finishedSpans).hasSize(1);
		MockSpan span = finishedSpans.get(0);
		softly.assertThat(span.operationName()).isEqualTo("/petclinic/");
		softly.assertThat(span.tags())
				.doesNotContainEntry(Tags.SAMPLING_PRIORITY.getKey(), 0)
				.containsEntry("type", "pageload")
				.containsEntry("username", "test string here")
				.containsEntry("age", 26.)
				.containsEntry("is_access_allowed", true)
				.doesNotContainKey("parameter_not_sent")
				.doesNotContainKey("some_not_mapped_property");
	});
}