### Question:
HadoopFsProfile { public static HadoopFsProfile convert(Configuration configuration, ResourceProfile profile) throws IOException { if (configuration == null) { throw new IllegalArgumentException("configuration must not be null"); } if (profile == null) { throw new IllegalArgumentException("profile must not be null"); } String name = profile.getName(); Path basePath = extractBasePath(configuration, profile); extractCompressionCodec(configuration, profile); return new HadoopFsProfile(name, basePath); } @Deprecated  HadoopFsProfile(
            String resourceName,
            Path basePath,
            CompressionCodec compressionCodec);  HadoopFsProfile(String resourceName, Path basePath); static HadoopFsProfile convert(Configuration configuration, ResourceProfile profile); String getResourceName(); Path getBasePath(); @Deprecated CompressionCodec getCompressionCodec(); static final String KEY_BASE_PATH; static final String KEY_COMPRESSION; }### Answer:
@Test public void convert() throws Exception { hadoopConf.set("fs.default.name", "file:/"); Map<String, String> conf = new HashMap<>(); ResourceProfile resourceProfile = new ResourceProfile( "testing", HadoopFsProvider.class, new ProfileContext(getClass().getClassLoader(), new ParameterList()), conf); HadoopFsProfile profile = HadoopFsProfile.convert(hadoopConf, resourceProfile); assertThat(profile.getResourceName(), is("testing")); assertThat(profile.getBasePath().toUri().getScheme(), is("file")); }
@Test(expected = IllegalArgumentException.class) public void convert_basePath_unresolved() throws Exception { Map<String, String> conf = new HashMap<>(); conf.put(HadoopFsProfile.KEY_BASE_PATH, "${__UNDEFINED__}"); ResourceProfile resourceProfile = new ResourceProfile( "testing", HadoopFsProvider.class, new ProfileContext(getClass().getClassLoader(), new ParameterList()), conf); HadoopFsProfile.convert(hadoopConf, resourceProfile); }
@Test(expected = IOException.class) public void convert_basePath_invalid() throws Exception { Map<String, String> conf = new HashMap<>(); conf.put(HadoopFsProfile.KEY_BASE_PATH, "INVALIDFS:UNKNOWN"); ResourceProfile resourceProfile = new ResourceProfile( "testing", HadoopFsProvider.class, new ProfileContext(getClass().getClassLoader(), new ParameterList()), conf); HadoopFsProfile.convert(hadoopConf, resourceProfile); }