### Question:
BPMNDiagramProjectService implements BPMNDiagramService { @Override public ProjectType getProjectType(Path projectRootPath) { try (DirectoryStream<org.uberfire.java.nio.file.Path> paths = ioService.newDirectoryStream(Paths.convert(projectRootPath), f -> f.getFileName().toString().startsWith("."))) { return ProjectType.fromFileName(StreamSupport.stream(paths.spliterator(), false) .map(Paths::convert) .map(Path::getFileName) .findFirst() ).orElse(null); } } @Inject  BPMNDiagramProjectService(final @Named("ioStrategy") IOService ioService);  BPMNDiagramProjectService(); @Override ProjectType getProjectType(Path projectRootPath);  }### Answer:
@Test public void getProjectTypeCase() { final ProjectType projectType = tested.getProjectType(projectPath); assertEquals(ProjectType.CASE, projectType); }
@Test public void getProjectTypeNull() { when(directoryStream.spliterator()).thenReturn(Collections.<Path>emptyList().spliterator()); final ProjectType projectType = tested.getProjectType(projectPath); assertNull(projectType); }