test_class.declarator: logTester = new LogTester()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public LogTester logTester = new LogTester();
test_class.type: LogTester
test_class.var_name: logTester
test_class.file: sonar-ansible-api/src/test/java/com/github/sbaudoin/sonar/plugins/ansible/util/FileSystemTest.java
test_class.identifier: FileSystemTest
test_case.body: @Test
      public void testConstructor() throws NoSuchFieldException, IllegalAccessException, URISyntaxException, IOException {
          Field defaultFS = FileSystem.class.getDeclaredField("defaultFileSystem");
          defaultFS.setAccessible(true);
          Field fsField = FileSystem.class.getDeclaredField("fs");
          fsField.setAccessible(true);
  
          // Test with an existing, non-default provider
          FileSystem fs = new FileSystem(new URI("sftp://localhost/"));
          assertFalse((Boolean)defaultFS.get(fs));
          assertNotEquals(FileSystems.getDefault(), fsField.get(fs));
          fs.close();
  
          // Test with an invalid URI
          fs = new FileSystem(Paths.get("src").toUri());
          assertEquals(1, logTester.logs(LoggerLevel.WARN).size());
          assertTrue(logTester.logs(LoggerLevel.WARN).get(0).startsWith("Using default FS because of an error: "));
          assertTrue((Boolean)defaultFS.get(fs));
          assertEquals(FileSystems.getDefault(), fsField.get(fs));
  
          logTester.clear();
          FileSystem fs2 = new FileSystem(new URI("file:///"));
          assertEquals(1, logTester.logs(LoggerLevel.WARN).size());
          assertTrue(logTester.logs(LoggerLevel.WARN).get(0).startsWith("FS already exists for URI: "));
          assertEquals(fsField.get(fs), fsField.get(fs2));
      }
test_case.class_method_signature: FileSystemTest.testConstructor()
test_case.full_signature: @Test public void testConstructor()
test_case.identifier: testConstructor
test_case.invocations: getDeclaredField setAccessible getDeclaredField setAccessible assertFalse get assertNotEquals getDefault get close toUri get assertEquals size logs assertTrue startsWith get logs assertTrue get assertEquals getDefault get clear assertEquals size logs assertTrue startsWith get logs assertEquals get get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testConstructor()
focal_class.declarator: LOGGER = Loggers.get(FileSystem.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Loggers.get(FileSystem.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: defaultFileSystem = false
focal_class.modifier: private
focal_class.original_string: private boolean defaultFileSystem = false;
focal_class.type: boolean
focal_class.var_name: defaultFileSystem
focal_class.declarator: fs
focal_class.modifier: private
focal_class.original_string: private java.nio.file.FileSystem fs;
focal_class.type: java.nio.file.FileSystem
focal_class.var_name: fs
focal_class.file: sonar-ansible-api/src/main/java/com/github/sbaudoin/sonar/plugins/ansible/util/FileSystem.java
focal_class.identifier: FileSystem
focal_class.interfaces: implements Closeable
focal_class.class_method_signature: FileSystem.FileSystem(URI uri)
focal_class.full_signature: public  FileSystem(URI uri)
focal_class.identifier: FileSystem
focal_class.modifiers: public
focal_class.parameters: (URI uri)
focal_class.signature:  FileSystem(URI uri)
focal_class.class_method_signature: FileSystem.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: FileSystem.readDirectory(URI uri)
focal_class.full_signature: public Stream<Path> readDirectory(URI uri)
focal_class.identifier: readDirectory
focal_class.modifiers: public
focal_class.parameters: (URI uri)
focal_class.return: Stream<Path>
focal_class.signature: Stream<Path> readDirectory(URI uri)
focal_method.body: @Override
      public void close() throws IOException {
          // The default file system is actually not closeable, see https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileSystem.html
          if (!defaultFileSystem) {
              fs.close();
          }
      }
focal_method.class_method_signature: FileSystem.close()
focal_method.full_signature: @Override public void close()
focal_method.identifier: close
focal_method.invocations: close
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void close()