< prev index next >

test/tools/jmod/JmodNegativeTest.java

Print this page




  65     @BeforeTest
  66     public void buildExplodedModules() throws IOException {
  67         if (Files.exists(EXPLODED_DIR))
  68             FileUtils.deleteFileTreeWithRetry(EXPLODED_DIR);
  69 
  70         for (String name : new String[] { "foo"/*, "bar", "baz"*/ } ) {
  71             Path dir = EXPLODED_DIR.resolve(name);
  72             assertTrue(compileModule(name, dir.resolve("classes")));
  73         }
  74 
  75         if (Files.exists(MODS_DIR))
  76             FileUtils.deleteFileTreeWithRetry(MODS_DIR);
  77         Files.createDirectories(MODS_DIR);
  78     }
  79 
  80     @Test
  81     public void testNoArgs() {
  82         jmod()
  83             .assertFailure()
  84             .resultChecker(r ->
  85                 assertContains(r.output, "Error: one of create, list, describe, or hash must be specified")
  86             );
  87     }
  88 
  89     @Test
  90     public void testBadAction() {
  91         jmod("badAction")
  92             .assertFailure()
  93             .resultChecker(r ->
  94                 assertContains(r.output, "Error: mode must be one of create, list, describe, or hash")
  95             );
  96 
  97         jmod("--badOption")
  98             .assertFailure()
  99             .resultChecker(r ->
 100                 assertContains(r.output, "Error: 'badOption' is not a recognized option")
 101             );
 102     }
 103 
 104     @Test
 105     public void testTooManyArgs() throws IOException {
 106         Path jmod = MODS_DIR.resolve("doesNotExist.jmod");
 107         FileUtils.deleteFileIfExistsWithRetry(jmod);
 108 
 109         jmod("create",
 110              jmod.toString(),
 111              "AAA")
 112             .assertFailure()
 113             .resultChecker(r ->
 114                 assertContains(r.output, "Error: unknown option(s): [AAA]")




  65     @BeforeTest
  66     public void buildExplodedModules() throws IOException {
  67         if (Files.exists(EXPLODED_DIR))
  68             FileUtils.deleteFileTreeWithRetry(EXPLODED_DIR);
  69 
  70         for (String name : new String[] { "foo"/*, "bar", "baz"*/ } ) {
  71             Path dir = EXPLODED_DIR.resolve(name);
  72             assertTrue(compileModule(name, dir.resolve("classes")));
  73         }
  74 
  75         if (Files.exists(MODS_DIR))
  76             FileUtils.deleteFileTreeWithRetry(MODS_DIR);
  77         Files.createDirectories(MODS_DIR);
  78     }
  79 
  80     @Test
  81     public void testNoArgs() {
  82         jmod()
  83             .assertFailure()
  84             .resultChecker(r ->
  85                 assertContains(r.output, "Error: one of create, extract, list, describe, or hash must be specified")
  86             );
  87     }
  88 
  89     @Test
  90     public void testBadAction() {
  91         jmod("badAction")
  92             .assertFailure()
  93             .resultChecker(r ->
  94                 assertContains(r.output, "Error: mode must be one of create, extract, list, describe, or hash")
  95             );
  96 
  97         jmod("--badOption")
  98             .assertFailure()
  99             .resultChecker(r ->
 100                 assertContains(r.output, "Error: 'badOption' is not a recognized option")
 101             );
 102     }
 103 
 104     @Test
 105     public void testTooManyArgs() throws IOException {
 106         Path jmod = MODS_DIR.resolve("doesNotExist.jmod");
 107         FileUtils.deleteFileIfExistsWithRetry(jmod);
 108 
 109         jmod("create",
 110              jmod.toString(),
 111              "AAA")
 112             .assertFailure()
 113             .resultChecker(r ->
 114                 assertContains(r.output, "Error: unknown option(s): [AAA]")


< prev index next >