481N/A/*
481N/A * CDDL HEADER START
481N/A *
481N/A * The contents of this file are subject to the terms of the
481N/A * Common Development and Distribution License (the "License").
481N/A * You may not use this file except in compliance with the License.
481N/A *
481N/A * See LICENSE.txt included in this distribution for the specific
481N/A * language governing permissions and limitations under the License.
481N/A *
481N/A * When distributing Covered Code, include this CDDL HEADER in each
481N/A * file and include the License file at LICENSE.txt.
481N/A * If applicable, add the following below this CDDL HEADER, with the
481N/A * fields enclosed by brackets "[]" replaced with your own identifying
481N/A * information: Portions Copyright [yyyy] [name of copyright owner]
481N/A *
481N/A * CDDL HEADER END
481N/A */
481N/A
481N/A/*
1267N/A * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
481N/A */
481N/Apackage org.opensolaris.opengrok.analysis;
481N/A
928N/Aimport java.io.IOException;
931N/Aimport java.util.Collections;
931N/Aimport java.util.List;
481N/Aimport org.junit.After;
481N/Aimport org.junit.AfterClass;
481N/Aimport org.junit.Before;
481N/Aimport org.junit.BeforeClass;
481N/Aimport org.junit.Test;
481N/Aimport static org.junit.Assert.*;
481N/A
481N/A/**
481N/A * Do basic testing of the List2TokenStream class
481N/A *
481N/A * @author Trond Norbye
481N/A */
481N/Apublic class List2TokenStreamTest {
481N/A
481N/A public List2TokenStreamTest() {
481N/A }
481N/A
481N/A @BeforeClass
481N/A public static void setUpClass() throws Exception {
481N/A }
481N/A
481N/A @AfterClass
481N/A public static void tearDownClass() throws Exception {
481N/A }
481N/A
481N/A @Before
481N/A public void setUp() {
481N/A }
481N/A
481N/A @After
481N/A public void tearDown() {
481N/A }
481N/A
931N/A /**
931N/A * Test that we don't get an error when the list is empty.
931N/A */
481N/A @Test
928N/A public void testBug3094() throws IOException {
931N/A List<String> empty = Collections.emptyList();
931N/A List2TokenStream instance = new List2TokenStream(empty);
481N/A assertNotNull(instance);
928N/A assertFalse(instance.incrementToken());
481N/A instance.close();
481N/A }
931N/A
931N/A /**
931N/A * Test that we get an error immediately when constructing a token stream
931N/A * where the list is {@code null}.
931N/A */
931N/A @Test
931N/A public void testFailfastOnNull() {
931N/A try {
931N/A new List2TokenStream(null);
1267N/A fail("expected an exception");
1267N/A } catch (NullPointerException npe) {
931N/A // expected
931N/A }
931N/A }
928N/A}