source: class HdfsBootstrapTest {
  
      static private Configuration configuration;
  
      @Test
      public void hdfsShouldStart() throws Exception {
  
target: 
          Assertions.assertThat(Utils.available("127.0.0.1", 20112)).isFalse();
  
          // Write a file to HDFS containing the test string
          FileSystem hdfsFsHandle = ((HdfsBootstrap) HadoopBootstrap.INSTANCE.getService("HDFS")).getHdfsFileSystemHandle();
          FSDataOutputStream writer = hdfsFsHandle.create(
                  new Path(configuration.getString(HdfsConfig.HDFS_TEST_FILE_KEY)));
          writer.writeUTF(configuration.getString(HdfsConfig.HDFS_TEST_STRING_KEY));
          writer.close();
  
          // Read the file and compare to test string
          FSDataInputStream reader = hdfsFsHandle.open(
                  new Path(configuration.getString(HdfsConfig.HDFS_TEST_FILE_KEY)));
          assertEquals(reader.readUTF(), configuration.getString(HdfsConfig.HDFS_TEST_STRING_KEY));
          reader.close();
          hdfsFsHandle.close();
  
          URL url = new URL(
                  String.format("http://localhost:%s/webhdfs/v1?op=GETHOMEDIRECTORY&user.name=guest",
                          configuration.getInt(HdfsConfig.HDFS_NAMENODE_HTTP_PORT_KEY)));
          URLConnection connection = url.openConnection();
          connection.setRequestProperty("Accept-Charset", "UTF-8");
          BufferedReader response = new BufferedReader(new InputStreamReader(connection.getInputStream()));
          String line = response.readLine();
          response.close();
          assertThat("{\"Path\":\"/user/guest\"}").isEqualTo(line);
  
      }
  
  }