### Question:
HttpStopwatchSource extends AbstractStopwatchSource<HttpServletRequest> { protected String getMonitorName(HttpServletRequest request) { String uri = requestToStringForMonitorName(request); String localName = SimonServletFilterUtils.getSimonName(uri, unallowedCharacterReplacer); String monitorName; if (prefix == null || prefix.isEmpty()) { monitorName = localName; } else { monitorName = prefix + Manager.HIERARCHY_DELIMITER + localName; } if (includeMethodName(request)) { monitorName += Manager.HIERARCHY_DELIMITER + request.getMethod(); } return monitorName; } HttpStopwatchSource(Manager manager); String getPrefix(); void setPrefix(String prefix); String getReplaceUnallowed(); void setReplaceUnallowed(String replaceUnallowed); IncludeHttpMethodName getIncludeHttpMethodName(); void setIncludeHttpMethodName(IncludeHttpMethodName includeHttpMethodName); @Override boolean isMonitored(HttpServletRequest httpServletRequest); @Override Stopwatch getMonitor(HttpServletRequest request); static StopwatchSource<HttpServletRequest> newCacheStopwatchSource(StopwatchSource<HttpServletRequest> stopwatchSource); static final String DEFAULT_SIMON_PREFIX; }### Answer:
@Test public void testGetMonitorName() { httpStopwatchSource.setPrefix(null); assertMonitorName("/foo/bar/quix", "foo.bar.quix"); assertMonitorName("/foo/+bar/quix.png", "foo._bar.quix_png"); assertMonitorName("/foo assertMonitorName("/foo/++bar/++/quix.png", "foo._bar._.quix_png"); httpStopwatchSource.setPrefix(""); assertMonitorName("/foo/++bar/++/quix.png", "foo._bar._.quix_png"); httpStopwatchSource.setReplaceUnallowed(""); assertMonitorName("/foo/+bar/quix.png", "foo.bar.quixpng"); assertMonitorName("/foo assertMonitorName("/foo/++bar/++/quix.png", "foo.bar.quixpng"); httpStopwatchSource.setPrefix("testing.prefix"); assertMonitorName("/foo/++bar/++/quix.png", "testing.prefix.foo.bar.quixpng"); }