use of org.jacoco.agent.rt.internal.output.FileOutput in project jacoco by jacoco.
the class FileOutputTest method testWriteData.
@Test
public void testWriteData() throws Exception {
File destFile = folder.newFile("jacoco.exec");
AgentOptions options = new AgentOptions();
options.setDestfile(destFile.getAbsolutePath());
FileOutput controller = new FileOutput();
controller.startup(options, new RuntimeData());
controller.writeExecutionData(false);
controller.shutdown();
assertTrue("Execution data file should be created", destFile.exists());
assertTrue("Execution data file should have contents", destFile.length() > 0);
}
use of org.jacoco.agent.rt.internal.output.FileOutput in project jacoco by jacoco.
the class FileOutputTest method testCreateDestFileOnStartup.
@Test
public void testCreateDestFileOnStartup() throws Exception {
File destFile = folder.newFile("jacoco.exec");
AgentOptions options = new AgentOptions();
options.setDestfile(destFile.getAbsolutePath());
FileOutput controller = new FileOutput();
controller.startup(options, new RuntimeData());
assertTrue("Execution data file should be created", destFile.exists());
assertEquals("Execution data file should be empty", 0, destFile.length());
}
use of org.jacoco.agent.rt.internal.output.FileOutput in project jacoco by jacoco.
the class FileOutputTest method testInvalidDestFile.
@Test(expected = IOException.class)
public void testInvalidDestFile() throws Exception {
AgentOptions options = new AgentOptions();
options.setDestfile(folder.newFolder("folder").getAbsolutePath());
FileOutput controller = new FileOutput();
// Startup should fail as the file can not be created:
controller.startup(options, new RuntimeData());
}
Aggregations