### Question:
SearchConfigurationFilesUtils { public static void copyResource(Resource source, File target) { try { FileUtils.copyInputStreamToFile(source.getInputStream(), target); } catch (IOException e) { throw new SolrConfigurationException("Unable to create configuration file " + target.getAbsolutePath(), e); } } private  SearchConfigurationFilesUtils(); static void copyProperties(Properties properties, File target); static void copyResource(Resource source, File target);  }### Answer:
@Test public void copyResource() throws IOException { File tmpDir = Files.createTempDir(); File targetFile = new File(tmpDir, "someFile.txt"); Resource resource = new ByteArrayResource("some resource".getBytes()); SearchConfigurationFilesUtils.copyResource(resource, targetFile); assertFile(targetFile, "some resource"); FileUtils.deleteDirectory(tmpDir); }