NamespaceUtil { public String filterNamespaceName(String namespaceName) { if (namespaceName.toLowerCase().endsWith(".properties")) { int dotIndex = namespaceName.lastIndexOf("."); return namespaceName.substring(0, dotIndex); } return namespaceName; } NamespaceUtil(final AppNamespaceServiceWithCache appNamespaceServiceWithCache); String filterNamespaceName(String namespaceName); String normalizeNamespace(String appId, String namespaceName);  }
@Test public void testFilterNamespaceName() throws Exception { String someName = "a.properties"; assertEquals("a", namespaceUtil.filterNamespaceName(someName)); }
@Test public void testFilterNamespaceNameUnchanged() throws Exception { String someName = "a.xml"; assertEquals(someName, namespaceUtil.filterNamespaceName(someName)); }
@Test public void testFilterNamespaceNameWithMultiplePropertiesSuffix() throws Exception { String someName = "a.properties.properties"; assertEquals("a.properties", namespaceUtil.filterNamespaceName(someName)); }
@Test public void testFilterNamespaceNameWithRandomCase() throws Exception { String someName = "AbC.ProPErties"; assertEquals("AbC", namespaceUtil.filterNamespaceName(someName)); }
@Test public void testFilterNamespaceNameWithRandomCaseUnchanged() throws Exception { String someName = "AbCD.xMl"; assertEquals(someName, namespaceUtil.filterNamespaceName(someName)); }