### Question:
PMMLIncludedDocumentFactory { public PMMLDocumentMetadata getDocumentByPath(final Path path) { return Optional.ofNullable(loadPMMLInfo(path)).map(pmml -> convertPMMLInfo(path, pmml)).orElse(emptyPMMLDocumentMetadata(path)); } PMMLIncludedDocumentFactory(); @Inject  PMMLIncludedDocumentFactory(final @Named("ioStrategy") IOService ioService); PMMLDocumentMetadata getDocumentByPath(final Path path); PMMLDocumentMetadata getDocumentByPath(final Path path,
                                                  final PMMLIncludedModel includeModel);  }### Answer:
@Test public void testGetDocumentByPathWithUnknownPath() { final Path path = mock(Path.class); when(path.toURI()).thenReturn(URI); when(ioService.newInputStream(any())).thenThrow(new NoSuchFileException()); final PMMLDocumentMetadata document = factory.getDocumentByPath(path); assertThat(document).isNotNull(); assertThat(document.getPath()).isEqualTo(URI); assertThat(document.getImportType()).isEqualTo(NAMESPACE); assertThat(document.getModels()).isEmpty(); }
@Test public void testGetDocumentByPathWithUnknownPathWithIncludedModel() { final Path path = mock(Path.class); final PMMLIncludedModel includedModel = makePMMLIncludedModel(); when(path.toURI()).thenReturn(URI); when(ioService.newInputStream(any())).thenThrow(new NoSuchFileException()); final PMMLDocumentMetadata document = factory.getDocumentByPath(path, includedModel); assertThat(document).isNotNull(); assertThat(document.getPath()).isEqualTo(URI); assertThat(document.getImportType()).isEqualTo(NAMESPACE); assertThat(document.getName()).isEqualTo(DOCUMENT_NAME); assertThat(document.getModels()).isEmpty(); }