CommandLineOptionsTest.java revision 364
364N/A/*
364N/A * CDDL HEADER START
364N/A *
364N/A * The contents of this file are subject to the terms of the
364N/A * Common Development and Distribution License (the "License").
364N/A * You may not use this file except in compliance with the License.
364N/A *
364N/A * See LICENSE.txt included in this distribution for the specific
364N/A * language governing permissions and limitations under the License.
364N/A *
364N/A * When distributing Covered Code, include this CDDL HEADER in each
364N/A * file and include the License file at LICENSE.txt.
364N/A * If applicable, add the following below this CDDL HEADER, with the
364N/A * fields enclosed by brackets "[]" replaced with your own identifying
364N/A * information: Portions Copyright [yyyy] [name of copyright owner]
364N/A *
364N/A * CDDL HEADER END
364N/A */
364N/A
364N/A/*
364N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
364N/A * Use is subject to license terms.
364N/A */
364N/Apackage org.opensolaris.opengrok.index;
364N/A
364N/Aimport java.io.IOException;
364N/Aimport java.util.Iterator;
364N/Aimport org.junit.After;
364N/Aimport org.junit.AfterClass;
364N/Aimport org.junit.Before;
364N/Aimport org.junit.BeforeClass;
364N/Aimport org.junit.Test;
364N/Aimport static org.junit.Assert.*;
364N/A
364N/A/**
364N/A * Check the CommandLineOption class
364N/A *
364N/A * @author Trond Norbye
364N/A */
364N/Apublic class CommandLineOptionsTest {
364N/A
364N/A public CommandLineOptionsTest() {
364N/A }
364N/A
364N/A @BeforeClass
364N/A public static void setUpClass() throws Exception {
364N/A }
364N/A
364N/A @AfterClass
364N/A public static void tearDownClass() throws Exception {
364N/A }
364N/A
364N/A @Before
364N/A public void setUp() {
364N/A }
364N/A
364N/A @After
364N/A public void tearDown() {
364N/A }
364N/A
364N/A /**
364N/A * Test of getCommandString method, of class CommandLineOptions.
364N/A */
364N/A @Test
364N/A public void testCommandLineOptions() {
364N/A System.out.println("testCommandLineOptions");
364N/A CommandLineOptions instance = new CommandLineOptions();
364N/A String cmdString = instance.getCommandString();
364N/A assertNotNull(cmdString);
364N/A
364N/A int ii = 0;
364N/A while (ii < cmdString.length()) {
364N/A char c = cmdString.charAt(ii);
364N/A if (c != ':') {
364N/A assertNotNull(instance.getCommandUsage(c));
364N/A }
364N/A ++ii;
364N/A }
364N/A
364N/A Iterator<CommandLineOptions.Option> iter = instance.getOptionsIterator();
364N/A while (iter.hasNext()) {
364N/A CommandLineOptions.Option o = iter.next();
364N/A assertNotNull(o.description);
364N/A }
364N/A
364N/A assertNotNull(instance.getUsage());
364N/A try {
364N/A assertNotNull(instance.getManPage());
364N/A } catch (IOException exp) {
364N/A fail("Got an exception during generation of man page: " + exp);
364N/A }
364N/A }
364N/A}