You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/09/05 11:42:18 UTC

(groovy) 03/04: GroovyMainTest: import the file-permission and assumption types it spelled out in full

This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit e018eb58ac7a511d7b257813d0a7a3b68f5377a2
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Sep 5 21:35:08 2026 +1000

    GroovyMainTest: import the file-permission and assumption types it spelled out in full
---
 src/test/groovy/groovy/ui/GroovyMainTest.groovy | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/test/groovy/groovy/ui/GroovyMainTest.groovy b/src/test/groovy/groovy/ui/GroovyMainTest.groovy
index 3d9ca00b33..f652fee452 100644
--- a/src/test/groovy/groovy/ui/GroovyMainTest.groovy
+++ b/src/test/groovy/groovy/ui/GroovyMainTest.groovy
@@ -21,7 +21,12 @@ package groovy.ui
 import org.junit.jupiter.api.Disabled
 import org.junit.jupiter.api.Test
 
+import java.nio.file.FileSystems
+import java.nio.file.Files
+import java.nio.file.attribute.PosixFilePermissions
+
 import static groovy.test.GroovyAssert.shouldFail
+import static org.junit.jupiter.api.Assumptions.assumeTrue
 
 final class GroovyMainTest {
 
@@ -211,23 +216,23 @@ assert new MyConcreteClass() != null"""
     }
 
     private static boolean posix() {
-        java.nio.file.FileSystems.default.supportedFileAttributeViews().contains('posix')
+        FileSystems.default.supportedFileAttributeViews().contains('posix')
     }
 
     private static String modeOf(File f) {
-        java.nio.file.attribute.PosixFilePermissions.toString(
-            java.nio.file.Files.getPosixFilePermissions(f.toPath()))
+        PosixFilePermissions.toString(
+            Files.getPosixFilePermissions(f.toPath()))
     }
 
     private static void setMode(File f, String mode) {
-        java.nio.file.Files.setPosixFilePermissions(f.toPath(),
-            java.nio.file.attribute.PosixFilePermissions.fromString(mode))
+        Files.setPosixFilePermissions(f.toPath(),
+            PosixFilePermissions.fromString(mode))
     }
 
     // GROOVY-12337
     @Test
     void testInPlaceEditPreservesRestrictivePermissions() {
-        org.junit.jupiter.api.Assumptions.assumeTrue(posix())
+        assumeTrue(posix())
         def dir = File.createTempDir('groovy-main-inplace-perm-')
         def file = new File(dir, 'secret.txt')
         file.text = 'hello\n'
@@ -247,7 +252,7 @@ assert new MyConcreteClass() != null"""
     // GROOVY-12337
     @Test
     void testInPlaceEditWithBackupExtensionPreservesPermissions() {
-        org.junit.jupiter.api.Assumptions.assumeTrue(posix())
+        assumeTrue(posix())
         def dir = File.createTempDir('groovy-main-inplace-bakperm-')
         def file = new File(dir, 'secret.txt')
         file.text = 'hello\n'
@@ -267,7 +272,7 @@ assert new MyConcreteClass() != null"""
     // GROOVY-12337
     @Test
     void testInPlaceEditPreservesAnExecutableMode() {
-        org.junit.jupiter.api.Assumptions.assumeTrue(posix())
+        assumeTrue(posix())
         def dir = File.createTempDir('groovy-main-inplace-exec-')
         def file = new File(dir, 'script.sh')
         file.text = 'echo hi\n'