### Question:
LoggingCategoryNames { public static String getCategoryName(final String className) { final Entry<String, String> entry = NAMES.floorEntry(className); if (entry != null && className.startsWith(entry.getKey())) { return entry.getValue(); } return className; }  static String getCategoryName(final String className);  }### Answer:
@Test(dataProvider = "matchingNames") public void testMatching(String classname) throws Exception { assertEquals(LoggingCategoryNames.getCategoryName(classname), CORE_PACKAGE_NAME); }
@Test(dataProvider = "nonMatchingNames") public void testNonMatching(String classname) throws Exception { assertEquals(LoggingCategoryNames.getCategoryName(classname), classname); }
@Test public void testSubPackages() throws Exception { assertEquals(LoggingCategoryNames.getCategoryName("org.opends.server.backends.jeb.foo"), "JEB"); assertEquals(LoggingCategoryNames.getCategoryName("org.opends.server.backends.jeb"), "JEB"); assertEquals(LoggingCategoryNames.getCategoryName("org.opends.server.backends"), "BACKEND"); assertEquals(LoggingCategoryNames.getCategoryName("org.opends.server"), "org.opends.server"); }