use of org.eclipse.che.api.project.server.type.ValueProvider in project che by eclipse.
the class JavaValueProviderFactoryTest method checkWithErrorInSubfolder.
/**
* In this case we have an exception while trying to search in sub folders
*/
@Test(expectedExceptions = ValueStorageException.class)
public void checkWithErrorInSubfolder() throws Throwable {
// we return a file entry that is a javascript file
FileEntry fileEntry = mock(FileEntry.class);
when(fileEntry.getName()).thenReturn("helloworld.js");
when(rootProjectFolder.getChildFiles()).thenReturn(Collections.singletonList(fileEntry));
FileEntry javaFileEntry = mock(FileEntry.class);
when(javaFileEntry.getName()).thenThrow(new IllegalStateException("unable to get name of this file"));
FolderEntry subFolder = mock(FolderEntry.class);
when(subFolder.getChildFiles()).thenReturn(Collections.singletonList(javaFileEntry));
when(rootProjectFolder.getChildFolders()).thenReturn(Collections.singletonList(subFolder));
ValueProvider javaPropertiesValueProvider = new JavaValueProviderFactory().newInstance(rootProjectFolder);
javaPropertiesValueProvider.getValues(CONTAINS_JAVA_FILES);
org.testng.Assert.fail("We should have exception reported");
}
Aggregations