### Question:
TaggedEventHandler { @OnMessage(types = TaggedEvent.NAME) public void onTaggedEvent(PlatformMessage msg) { MessageBody msgBody = msg.getValue(); String tagName = TaggedEvent.getName(msgBody); if (isNotBlank(tagName)) { TaggingMetric<Counter> tagCounter = tagCounterManager.getTagCounter(tagName); if (tagCounter != null) { Map<String, Object> metricTags = TaggedEvent.getContext(msgBody); if (metricTags == null) { metricTags = new HashMap<>(); } else { metricTags.entrySet().removeIf( e -> e.getValue() == null || (e.getValue() instanceof String && isBlank((String) e.getValue()))); } String source = TaggedEvent.getSource(msgBody); if (!isBlank(source)) { metricTags.put(ATTR_SOURCE, source); } String version = TaggedEvent.getVersion(msgBody); if (!isBlank(version)) { metricTags.put(ATTR_VERSION, version); } String serviceLevel = TaggedEvent.getServiceLevel(msgBody); if (!isBlank(serviceLevel)) { metricTags.put(ATTR_SERVICELEVEL, serviceLevel); } metricTags.keySet().retainAll(contextIncludes); tagCounter.tag(metricTags).inc(); } else { logger.trace("Unknown tag name: " + tagName); unknownTagName.inc(); } } } @Inject  TaggedEventHandler(TagCounterManager tagCounterManager, TagServiceConfig config); @OnMessage(types = TaggedEvent.NAME) void onTaggedEvent(PlatformMessage msg);  }### Answer:
@Test public void testUnknownTagName() { expect(mockTagCounterManager.getTagCounter("test.tag")).andReturn(null); replay(); PlatformMessage msg = PlatformMessage.builder() .from(clientAddress("test", "10")) .withPayload(TaggedEvent.builder() .withName("test.tag") .build()) .create(); componentUnderTest.onTaggedEvent(msg); long count = metrics("tag").counter("tagName.unknown").getCount(); assertThat(count, equalTo(1L)); metrics("tag").counter("tagName.unknown").dec(count); }