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

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


public class TestFileExistCmdLineOptionValidator extends TestCase {

   public void testValidate() throws IOException {
      // Test null option instance not allowed.
      try {
         new FileExistCmdLineOptionValidator().validate(null);
         fail("Should have thrown IllegalArgumentException");
      } catch (IllegalArgumentException ignore) { /* expect throw */
      }

      // Test fail case.
      CmdLineOptionInstance instance = createOptionInstance(
            createSimpleOption("test", false), "bogus");
      assertEquals(Result.Grade.FAIL, new FileExistCmdLineOptionValidator()
            .validate(instance).getGrade());

      // Test pass case.
      File tempFile = File.createTempFile("bogus", "bogus");
      tempFile.deleteOnExit();
      instance = createOptionInstance(createSimpleOption("test", false),
            tempFile.getAbsolutePath());
      assertEquals(Result.Grade.PASS, new FileExistCmdLineOptionValidator()
            .validate(instance).getGrade());
   }
View Full Code Here

TOP

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

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.