private void visitPath( Path transactionalLogsPath, Predicate<Path> exclude, ArchiveOutputStream stream ) throws IOException { Files.walkFileTree( transactionalLogsPath, onlyMatching( not( exclude ), throwExceptions( onDirectory( dir -> dumpDirectory( transactionalLogsPath, stream, dir ), onFile( file -> dumpFile( transactionalLogsPath, stream, file ), justContinue() ) ) ) ) ); }
@Test public void shouldThrowExceptionFromVisitFileFailed() { IOException exception = new IOException(); try { throwExceptions( wrapped ).visitFileFailed( null, exception ); fail( "Expected exception" ); } catch ( Exception e ) { assertThat( e, is( exception ) ); } }
@Test public void shouldThrowExceptionFromPostVisitDirectory() { IOException exception = new IOException(); try { throwExceptions( wrapped ).postVisitDirectory( null, exception ); fail( "Expected exception" ); } catch ( Exception e ) { assertThat( e, is( exception ) ); } } }
private void visitPath( Path transactionalLogsPath, Predicate<Path> exclude, ArchiveOutputStream stream ) throws IOException { Files.walkFileTree( transactionalLogsPath, onlyMatching( not( exclude ), throwExceptions( onDirectory( dir -> dumpDirectory( transactionalLogsPath, stream, dir ), onFile( file -> dumpFile( transactionalLogsPath, stream, file ), justContinue() ) ) ) ) ); }