I have a problem with java, it gives me an error inside my code when I run a test for writing to a file. It isn’t finished yet but in the test I create a sort of ‘mock’ temporary file where I write a string. **as my code shouldn't be allowed to read strings
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
@Test
public void testWrite() throws IOException {
// Create a temporary file.
final File tempFile = tempFolder.newFile("tempFile.txt");
// Write something to it.
FileUtils.writeStringToFile(tempFile, "hello world");
}
Unfortunately the FileUtils seems not to be recognised. Relating to that the import:
import org.apache.commons.io.FileUtils;
Isn’t recognised either.
Aucun commentaire:
Enregistrer un commentaire