use of org.jacoco.agent.rt.internal.output.IAgentOutput in project jacoco by jacoco.
the class AgentTest method shutdown_should_log_exception.
@Test
public void shutdown_should_log_exception() throws Exception {
final Exception expected = new Exception();
Agent agent = new Agent(options, this) {
@Override
IAgentOutput createAgentOutput() {
return new IAgentOutput() {
public void startup(AgentOptions options, RuntimeData data) {
}
public void shutdown() throws Exception {
throw expected;
}
public void writeExecutionData(boolean reset) {
}
};
}
};
agent.startup();
agent.shutdown();
assertSame(expected, loggedException);
}
use of org.jacoco.agent.rt.internal.output.IAgentOutput in project jacoco by jacoco.
the class AgentTest method startup_should_log_exception.
@Test
public void startup_should_log_exception() throws Exception {
final Exception expected = new Exception();
Agent agent = new Agent(options, this) {
@Override
IAgentOutput createAgentOutput() {
return new IAgentOutput() {
public void startup(AgentOptions options, RuntimeData data) throws Exception {
throw expected;
}
public void shutdown() {
}
public void writeExecutionData(boolean reset) {
}
};
}
};
agent.startup();
assertSame(expected, loggedException);
}
use of org.jacoco.agent.rt.internal.output.IAgentOutput in project jacoco by jacoco.
the class AgentTest method startup_should_log_and_rethrow_exception.
@Test
public void startup_should_log_and_rethrow_exception() throws Exception {
final Exception expected = new Exception();
Agent agent = new Agent(options, this) {
@Override
IAgentOutput createAgentOutput() {
return new IAgentOutput() {
public void startup(AgentOptions options, RuntimeData data) throws Exception {
throw expected;
}
public void shutdown() {
}
public void writeExecutionData(boolean reset) {
}
};
}
};
try {
agent.startup();
fail("Exception expected");
} catch (Exception actual) {
assertSame(expected, actual);
assertSame(expected, loggedException);
}
}
Aggregations