568 });
569 }
570
571 @Test
572 public void testHelpExtra() {
573 jmod("--help-extra")
574 .assertSuccess()
575 .resultChecker(r -> {
576 assertTrue(r.output.startsWith("Usage: jmod"), "Extra help not printed");
577 assertContains(r.output, "--do-not-resolve-by-default");
578 assertContains(r.output, "--warn-if-resolved");
579 });
580 }
581
582 @Test
583 public void testTmpFileAlreadyExists() throws IOException {
584 // Implementation detail: jmod tool creates <jmod-file>.tmp
585 // Ensure that there are no problems if existing
586
587 Path jmod = MODS_DIR.resolve("testTmpFileAlreadyExists.jmod");
588 Path tmp = MODS_DIR.resolve("testTmpFileAlreadyExists.jmod.tmp");
589 FileUtils.deleteFileIfExistsWithRetry(jmod);
590 FileUtils.deleteFileIfExistsWithRetry(tmp);
591 Files.createFile(tmp);
592 String cp = EXPLODED_DIR.resolve("foo").resolve("classes").toString();
593
594 jmod("create",
595 "--class-path", cp,
596 jmod.toString())
597 .assertSuccess()
598 .resultChecker(r ->
599 assertTrue(Files.notExists(tmp), "Unexpected tmp file:" + tmp)
600 );
601 }
602
603 @Test
604 public void testTmpFileRemoved() throws IOException {
605 // Implementation detail: jmod tool creates <jmod-file>.tmp
606 // Ensure that it is removed in the event of a failure.
607 // The failure in this case is a class in the unnamed package.
608
|
568 });
569 }
570
571 @Test
572 public void testHelpExtra() {
573 jmod("--help-extra")
574 .assertSuccess()
575 .resultChecker(r -> {
576 assertTrue(r.output.startsWith("Usage: jmod"), "Extra help not printed");
577 assertContains(r.output, "--do-not-resolve-by-default");
578 assertContains(r.output, "--warn-if-resolved");
579 });
580 }
581
582 @Test
583 public void testTmpFileAlreadyExists() throws IOException {
584 // Implementation detail: jmod tool creates <jmod-file>.tmp
585 // Ensure that there are no problems if existing
586
587 Path jmod = MODS_DIR.resolve("testTmpFileAlreadyExists.jmod");
588 Path tmpdir = Paths.get(System.getProperty("java.io.tmpdir"));
589 Path tmp = tmpdir.resolve("testTmpFileAlreadyExists.jmod.tmp");
590 FileUtils.deleteFileIfExistsWithRetry(jmod);
591 FileUtils.deleteFileIfExistsWithRetry(tmp);
592 Files.createFile(tmp);
593 String cp = EXPLODED_DIR.resolve("foo").resolve("classes").toString();
594
595 jmod("create",
596 "--class-path", cp,
597 jmod.toString())
598 .assertSuccess()
599 .resultChecker(r ->
600 assertTrue(Files.notExists(tmp), "Unexpected tmp file:" + tmp)
601 );
602 }
603
604 @Test
605 public void testTmpFileRemoved() throws IOException {
606 // Implementation detail: jmod tool creates <jmod-file>.tmp
607 // Ensure that it is removed in the event of a failure.
608 // The failure in this case is a class in the unnamed package.
609
|