Package org.apache.oodt.cas.cli.option.validator

Examples of org.apache.oodt.cas.cli.option.validator.AllowedArgsCmdLineOptionValidator


      }

      // Test no allowed args set and valid option instance
      CmdLineOptionInstance instance = createOptionInstance(
            createSimpleOption("test", false), "value");
      assertEquals(Result.Grade.FAIL, new AllowedArgsCmdLineOptionValidator()
            .validate(instance).getGrade());
   }
View Full Code Here


public class TestAllowedArgsCmdLineOptionValidator extends TestCase {

   public void testIntialState() {
      // Test no null option instance allowed.
      try {
         new AllowedArgsCmdLineOptionValidator().validate(null);
         fail("Should have thrown IllegalArgumentException");
      } catch (IllegalArgumentException ignore) { /* expect throw */
      }

      // Test no allowed args set and valid option instance
      CmdLineOptionInstance instance = createOptionInstance(
            createSimpleOption("test", false), "value");
      assertEquals(Result.Grade.FAIL, new AllowedArgsCmdLineOptionValidator()
            .validate(instance).getGrade());
   }
View Full Code Here

      assertEquals(Result.Grade.FAIL, new AllowedArgsCmdLineOptionValidator()
            .validate(instance).getGrade());
   }

   public void testValidate() {
      AllowedArgsCmdLineOptionValidator validator = new AllowedArgsCmdLineOptionValidator();
      validator.setAllowedArgs(Lists.newArrayList("value1", "value2"));

      // Test no null option instance allowed.
      try {
         validator.validate(null);
         fail("Should have thrown IllegalArgumentException");
      } catch (IllegalArgumentException ignore) { /* expect throw */
      }

      // Test should fail case.
      CmdLineOptionInstance instance = createOptionInstance(
            createSimpleOption("test", false), "value");
      assertEquals(Result.Grade.FAIL, validator.validate(instance).getGrade());

      // Test should pass case.
      instance = createOptionInstance(createSimpleOption("test", false),
            "value1");
      assertEquals(Result.Grade.PASS, validator.validate(instance).getGrade());
   }
View Full Code Here

   }

   public void testValidate() {
      AdvancedCmdLineOption option = new AdvancedCmdLineOption("t", "test", "",
            true);
      AllowedArgsCmdLineOptionValidator validator = new AllowedArgsCmdLineOptionValidator();
      validator.setAllowedArgs(Lists.newArrayList("value"));
      option.setValidators(Lists
            .newArrayList((CmdLineOptionValidator) validator));

      // Test case fail.
      assertFalse(determineFailedValidation(validate(createOptionInstance(option, "value1"))).isEmpty());
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.cli.option.validator.AllowedArgsCmdLineOptionValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.