### Question:
RequestPathMetricsCollector { static String trimPathDepth(String path, int maxDepth) { int count = 0; StringBuilder sb = new StringBuilder(); StringTokenizer pathTokenizer = new StringTokenizer(path, PATH_SEPERATOR); while (pathTokenizer.hasMoreElements() && count++ < maxDepth) { sb.append(PATH_SEPERATOR); sb.append(pathTokenizer.nextToken()); } path = sb.toString(); return path; } RequestPathMetricsCollector();  RequestPathMetricsCollector(boolean accurateMode); void shutdown(); void start(); void registerRequest(int type, String path); void dumpTopRequestPath(PrintWriter pwriter, String requestTypeName, int queryMaxDepth); void dumpTopReadPaths(PrintWriter pwriter, int queryMaxDepth); void dumpTopWritePaths(PrintWriter pwriter, int queryMaxDepth); void dumpTopPaths(PrintWriter pwriter, int queryMaxDepth); static final String PATH_STATS_SLOT_CAPACITY; static final String PATH_STATS_SLOT_DURATION; static final String PATH_STATS_MAX_DEPTH; static final String PATH_STATS_SAMPLE_RATE; static final String PATH_STATS_COLLECTOR_INITIAL_DELAY; static final String PATH_STATS_COLLECTOR_DELAY; static final String PATH_STATS_TOP_PATH_MAX; static final String PATH_STATS_ENABLED; }### Answer:
@Test public void testTrimPath() { String trimedPath = RequestPathMetricsCollector.trimPathDepth("/p1/p2/p3", 1); assertTrue(trimedPath.equalsIgnoreCase("/p1")); trimedPath = RequestPathMetricsCollector.trimPathDepth("/p1/p2/p3", 2); assertTrue(trimedPath.equalsIgnoreCase("/p1/p2")); trimedPath = RequestPathMetricsCollector.trimPathDepth("/p1/p2/p3", 3); assertTrue(trimedPath.equalsIgnoreCase("/p1/p2/p3")); trimedPath = RequestPathMetricsCollector.trimPathDepth("/p1/p2/p3", 4); assertTrue(trimedPath.equalsIgnoreCase("/p1/p2/p3")); trimedPath = RequestPathMetricsCollector.trimPathDepth(" assertTrue(trimedPath.equalsIgnoreCase("/p1 next/p2.index/p3:next")); trimedPath = RequestPathMetricsCollector.trimPathDepth(" assertTrue(trimedPath.equalsIgnoreCase("/p1 next/p2.index")); trimedPath = RequestPathMetricsCollector.trimPathDepth(" assertTrue(trimedPath.equalsIgnoreCase("/p1 next/p2.index/p3:next")); }