TestCLIPOption.java :  » Portal » Open-Portal » com » sun » portal » rewriter » util » clip » test » Java Open Source

Java Open Source » Portal » Open Portal 
Open Portal » com » sun » portal » rewriter » util » clip » test » TestCLIPOption.java
/*
 * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
 * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
 */
package com.sun.portal.rewriter.util.clip.test;

import com.sun.portal.rewriter.test.util.BasicTestCase;
import com.sun.portal.rewriter.util.clip.CLIPConstants;
import com.sun.portal.rewriter.util.clip.CLIPOption;
import com.sun.portal.rewriter.util.clip.CLIPSpec;
import junit.framework.TestCase;

public class TestCLIPOption extends TestCase
{
    public TestCLIPOption( String s )
    {
  super( s );
    }//constructor

    public void setUp() throws Exception
    {
  CLIPSpec.getCLIArgs( new String[]{"resources/RWCLISpec.xml", "psrwCLI"} );
    }//setUp()

    public void testDefaultValuesCollection()
    {
  try
  {
      new CLIPOption( "version", "", CLIPConstants.COLLECTION, "a b c d e", "TestMessage" );
      fail( "Exception of Type IllegalArgumentException is not thrown " );
  }
  catch ( IllegalArgumentException e )
  {
      assertTrue( true );
      return;
  }
    }//testDefaultValuesCollection()

    public void testDefaultValuesBoolean0()
    {
  try
  {
      new CLIPOption( "version", "v", CLIPConstants.BOOLEAN, "a b c d e", "TestMessage" );

  }
  catch ( IllegalArgumentException e )
  {
      assertTrue( true );
      return;
  }
    }//testDefaultValuesBoolean0()

    public void testDefaultValuesBooleanFalse()
    {
  try
  {
      new CLIPOption( "version", "v", CLIPConstants.BOOLEAN, "false", "optionHelp" );
      assertTrue( true );
  }
  catch ( Exception e )
  {
      assertTrue( false );
  }
    }//testDefaultValuesBooleanFalse()

    public void testDefaultValuesBooleanWithSpaceTrue()
    {
  try
  {
      new CLIPOption( "version", "v", CLIPConstants.BOOLEAN, " true ", "optionHelp" );
      assertTrue( true );
  }
  catch ( Exception e )
  {
      assertTrue( false );
  }
    }//testDefaultValuesBooleanWithSpaceTrue()

    public static void main( String[] args )
    {
  BasicTestCase.run( TestCLIPOption.class );
    }//main()
}//class TestCLIPOption
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.