Example usage for java.util Spliterators emptySpliterator

List of usage examples for java.util Spliterators emptySpliterator

Introduction

In this page you can find the example usage for java.util Spliterators emptySpliterator.

Prototype

@SuppressWarnings("unchecked")
public static <T> Spliterator<T> emptySpliterator() 

Source Link

Document

Creates an empty Spliterator

The empty spliterator reports Spliterator#SIZED and Spliterator#SUBSIZED .

Usage

From source file:org.cryptomator.cryptofs.CryptoDirectoryStreamTest.java

License:asdf

@Test(expected = NoSuchElementException.class)
public void testDirListingForEmptyDir() throws IOException {
    Path cleartextPath = Paths.get("/foo/bar");

    Mockito.when(dirStream.spliterator()).thenReturn(Spliterators.emptySpliterator());

    try (CryptoDirectoryStream stream = new CryptoDirectoryStream(new Directory("foo", ciphertextDirPath),
            cleartextPath, filenameCryptor, cryptoPathMapper, longFileNameProvider, conflictResolver,
            ACCEPT_ALL, DO_NOTHING_ON_CLOSE, finallyUtil)) {
        Iterator<Path> iter = stream.iterator();
        Assert.assertFalse(iter.hasNext());
        iter.next();/*from  w ww  .j  av a 2  s. c o  m*/
    }
}