### Question:
StreamRepositoryService { public StreamRepository readRepository(Path rootDir) { try { { StreamRepository repo = new ApplicationStreamRepository(); repo.rootDirectory = rootDir; if (Files.exists(repo.getRepositoryXmlFile())) { repo = (StreamRepository) ctx.createUnmarshaller() .unmarshal(repo.getRepositoryXmlFile().toFile()); repo.rootDirectory = rootDir; return repo; } } { StreamRepository repo = new BackupStreamRepository(); repo.rootDirectory = rootDir; if (Files.exists(repo.getRepositoryXmlFile())) { repo = (StreamRepository) ctx.createUnmarshaller() .unmarshal(repo.getRepositoryXmlFile().toFile()); repo.rootDirectory = rootDir; return repo; } } } catch (JAXBException e) { throw new RuntimeException("Error while reading repository from " + rootDir.toAbsolutePath(), e); } throw new DisplayException("No Repository found at " + rootDir.toAbsolutePath()); }  @SuppressWarnings("unchecked") T createRepository(Class<T> clazz,
            Path location); void deleteEmptyRepository(StreamRepository repository); StreamRepository readRepository(Path rootDir);  }### Answer:
@Test public void testReadRepository() throws Exception { Path path = testRepoCreate(BackupStreamRepository.class); StreamRepository repo = service.readRepository(path); assertThat(repo instanceof BackupStreamRepository, is(true)); assertThat(repo.rootDirectory, equalTo(path)); }