JSValueProviderFactory implements ValueProviderFactory { @Override public ValueProvider newInstance(FolderEntry projectFolder) { return new JSValueProvider(projectFolder); }  @Override ValueProvider newInstance(FolderEntry projectFolder); static final String JS_EXTESION; }
@Test public void testGetValuesWhenProjectContainsJSFiles() throws Exception { Project jsProject = pm.createProject(workspace, "jsProject", new ProjectConfig("test project", "BasicJS", new HashMap<>(), null, null, null), null, null); FolderEntry baseFolder = jsProject.getBaseFolder(); baseFolder.createFile("test.js", "test".getBytes(), MediaType.TEXT_PLAIN); List<String> values = jsValueProviderFactory.newInstance(baseFolder).getValues(HAS_JS_FILES); Assert.assertNotNull(values); Assert.assertFalse(values.isEmpty()); assertEquals(1, values.size()); }
@Test public void testGetValuesWhenProjectNotContainsJSFiles() throws Exception { Project jsProject = pm.createProject(workspace, "jsProject", new ProjectConfig("test project", "BasicJS", new HashMap<>(), null, null, null), null, null); FolderEntry baseFolder = jsProject.getBaseFolder(); FolderEntry firstFolder = baseFolder.createFolder("firstFolder"); FolderEntry secondFolder = baseFolder.createFolder("secondFolder"); firstFolder.createFile("test.txt", "test".getBytes(), MediaType.TEXT_PLAIN); secondFolder.createFile("test.java", "test".getBytes(), MediaType.TEXT_PLAIN); List<String> values = jsValueProviderFactory.newInstance(baseFolder).getValues(HAS_JS_FILES); Assert.assertNotNull(values); Assert.assertTrue(values.isEmpty()); }