public static void assertEquals ( final Path expected , final Path actual ) throws IOException { containsAll ( actual , expected ) ; if ( Files . exists ( expected ) ) { containsAll ( expected , actual ) ; walkFileTree ( expected , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult visitFile ( final Path file , final BasicFileAttributes attrs ) throws IOException { final Path sub = relativize ( expected , file ) ; final Path therePath = resolve ( actual , sub ) ; final long hereSize = Files . size ( file ) ; final long thereSize = Files . size ( therePath ) ; assertThat ( thereSize , asserts ( ( ) -> sub + " is " + hereSize + " bytes" , t -> t == hereSize ) ) ; assertByteEquals ( sub , file , therePath ) ; return super . visitFile ( file , attrs ) ; } } ) ; } }
Asserts that two paths are deeply byte - equivalent .