ListBundleFiles extends AbstractFormatService implements Service { private boolean isEditibleFileType(Path f) { String fileName = f.getFileName().toString(); for (String ext : extensions) { if (fileName.endsWith("." + ext)) return true; } return fileName.toString().equalsIgnoreCase("README"); }  Element exec(Element params, ServiceContext context);  }
@Test public void testIsEditibleFileType() { Path p = Mockito.mock(Path.class); Mockito.when(p.getFileName()).thenReturn(p); Mockito.when(p.toString()).thenReturn("file.properties", "manifest.xml", "view.xsl", "custom.css", "custom.js", "README"); ListBundleFiles lst = new ListBundleFiles(); Method prvMeth = ReflectionUtils.findMethod(lst.getClass(), "isEditibleFileType", Path.class); prvMeth.setAccessible(true); Boolean[] rets = new Boolean[6]; for (int i = 0; i < 6; ++i) { rets[i] = (Boolean) ReflectionUtils.invokeMethod(prvMeth, lst, p); } assertTrue("isEditibleFileType(\"file.properties\"): Expected true, false returned", rets[0]); assertTrue("isEditibleFileType(\"manifest.xml\"): Expected true, false returned", rets[1]); assertTrue("isEditibleFileType(\"view.xsl\"): Expected true, false returned", rets[2]); assertTrue("isEditibleFileType(\"custom.css\"): Expected true, false returned", rets[3]); assertTrue("isEditibleFileType(\"custom.js\"): Expected true, false returned", rets[4]); assertTrue("isEditibleFileType(\"README\"): Expected false, true returned", rets[5]); }