### Question:
StorageUtil { public static Stream<StorageAsset> newAssetStream( StorageAsset start, boolean parallel ) { final AssetSpliterator spliterator = new AssetSpliterator( start ); return StreamSupport.stream( spliterator, parallel ).onClose( ( ) -> spliterator.close( ) ); }  static void walk( StorageAsset start, Consumer<StorageAsset> consumer ); static void walk( StorageAsset start, Function<StorageAsset, Boolean> consumer ); static Stream<StorageAsset> newAssetStream( StorageAsset start, boolean parallel ); static Stream<StorageAsset> newAssetStream( StorageAsset start); static final void deleteRecursively(StorageAsset baseDir); static final boolean deleteRecursively(final StorageAsset baseDir, final boolean stopOnError); static final void moveAsset(StorageAsset source, StorageAsset target, boolean locked, CopyOption... copyOptions); static final void copy( final ReadableByteChannel is, final WritableByteChannel os ); static final void copy( final FileChannel is, final WritableByteChannel os ); static final void copy( final ReadableByteChannel is, final FileChannel os ); static final String getExtension(StorageAsset asset);  }### Answer:
@Test void testStream() { StorageAsset root = createTree( ); ConsumeVisitStatus status = new ConsumeVisitStatus( ); List<StorageAsset> result; try ( Stream<StorageAsset> stream = StorageUtil.newAssetStream( root, false ) ) { result = stream.filter( a -> a.getName( ).startsWith( "001" ) ).collect( Collectors.toList()); } int expected = LEVEL2 * LEVEL3 + LEVEL2 + 1; assertEquals( expected, result.size( ) ); assertEquals( "001", result.get( result.size( ) - 1 ).getName() ); assertEquals( "001012", result.get( result.size( ) - 2 ).getName() ); }
@Test void testStreamParallel() { StorageAsset root = createTree( ); ConsumeVisitStatus status = new ConsumeVisitStatus( ); List<StorageAsset> result; try ( Stream<StorageAsset> stream = StorageUtil.newAssetStream( root, true ) ) { result = stream.filter( a -> a.getName( ).startsWith( "001" ) ).collect( Collectors.toList()); } int expected = LEVEL2 * LEVEL3 + LEVEL2 + 1; assertEquals( expected, result.size( ) ); }