GruntValueProviderFactory implements ValueProviderFactory { @Override public ValueProvider newInstance(FolderEntry projectFolder) { return new GruntValueProvider(projectFolder); }  @Override ValueProvider newInstance(FolderEntry projectFolder); static final String GRUNT_JS_CONFIG_FILE; static final String GRUNT_COFFEE_CONFIG_FILE; }
@Test public void testGetValuesWhenProjectContains_gruntfile_js_configFile() throws Exception { Project gruntProject = pm.createProject(workspace, "gruntProject", new ProjectConfig("test project", "GruntJS", new HashMap<>(), null, null, null), null, null); FolderEntry baseFolder = gruntProject.getBaseFolder(); baseFolder.createFile("Gruntfile.js", "test".getBytes(), MediaType.TEXT_PLAIN); List<String> values = gruntValueProviderFactory.newInstance(baseFolder).getValues(HAS_CONFIG_FILE); Assert.assertNotNull(values); Assert.assertFalse(values.isEmpty()); assertEquals(1, values.size()); }
@Test public void testGetValuesWhenProjectContains_gruntfile_coffee_configFile() throws Exception { Project gruntProject = pm.createProject(workspace, "gruntProject", new ProjectConfig("test project", "GruntJS", new HashMap<>(), null, null, null), null, null); FolderEntry baseFolder = gruntProject.getBaseFolder(); baseFolder.createFile("Gruntfile.coffee", "test".getBytes(), MediaType.TEXT_PLAIN); List<String> values = gruntValueProviderFactory.newInstance(baseFolder).getValues(HAS_CONFIG_FILE); Assert.assertNotNull(values); Assert.assertFalse(values.isEmpty()); assertEquals(1, values.size()); }
@Test public void testGetValuesWhenProjectNotContainsConfigFile() throws Exception { Project gruntProject = pm.createProject(workspace, "gruntProject", new ProjectConfig("test project", "GruntJS", new HashMap<>(), null, null, null), null, null); FolderEntry baseFolder = gruntProject.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 = gruntValueProviderFactory.newInstance(baseFolder).getValues(HAS_CONFIG_FILE); Assert.assertNotNull(values); Assert.assertTrue(values.isEmpty()); }