[cvs] / jsr166 / src / test / tck / LinkedBlockingQueue8Test.java Repository:
ViewVC logotype

View of /jsr166/src/test/tck/LinkedBlockingQueue8Test.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (annotate)
Sat Mar 11 17:33:32 2017 UTC (3 months, 1 week ago) by jsr166
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -1 lines
fix unused imports reported by errorprone [RemoveUnusedImports]
/*
 * Written by Doug Lea and Martin Buchholz with assistance from
 * members of JCP JSR-166 Expert Group and released to the public
 * domain, as explained at
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

import java.util.concurrent.LinkedBlockingQueue;
import java.util.Spliterator;

import junit.framework.Test;

public class LinkedBlockingQueue8Test extends JSR166TestCase {
    public static void main(String[] args) {
        main(suite(), args);
    }

    public static Test suite() {
        return newTestSuite(LinkedBlockingQueue8Test.class);
    }

    /**
     * Spliterator.getComparator always throws IllegalStateException
     */
    public void testSpliterator_getComparator() {
        assertThrows(IllegalStateException.class,
                     () -> new LinkedBlockingQueue().spliterator().getComparator());
    }

    /**
     * Spliterator characteristics are as advertised
     */
    public void testSpliterator_characteristics() {
        LinkedBlockingQueue q = new LinkedBlockingQueue();
        Spliterator s = q.spliterator();
        int characteristics = s.characteristics();
        int required = Spliterator.CONCURRENT
            | Spliterator.NONNULL
            | Spliterator.ORDERED;
        assertEquals(required, characteristics & required);
        assertTrue(s.hasCharacteristics(required));
        assertEquals(0, characteristics
                     & (Spliterator.DISTINCT
                        | Spliterator.IMMUTABLE
                        | Spliterator.SORTED));
    }

}

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8