use of com.teamscale.jacoco.agent.JacocoRuntimeController in project teamscale-jacoco-agent by cqse.
the class CoverageToTeamscaleStrategyTest method testValidCallSequence.
@Test
public void testValidCallSequence() throws Exception {
List<PrioritizableTestCluster> clusters = Collections.singletonList(new PrioritizableTestCluster("cluster", Collections.singletonList(new PrioritizableTest("mytest"))));
when(client.getImpactedTests(any(), any(), any(), any(), anyBoolean(), anyBoolean(), anyBoolean())).thenReturn(Response.success(clusters));
TestwiseCoverage testwiseCoverage = getDummyTestwiseCoverage("mytest");
when(reportGenerator.convert(any(File.class))).thenReturn(testwiseCoverage);
AgentOptions options = mockOptions();
JacocoRuntimeController controller = mock(JacocoRuntimeController.class);
CoverageToTeamscaleStrategy strategy = new CoverageToTeamscaleStrategy(controller, options, reportGenerator);
strategy.testRunStart(Collections.singletonList(new ClusteredTestDetails("mytest", "mytest", "content", "cluster")), false, true, true, null);
strategy.testStart("mytest");
strategy.testEnd("mytest", new TestExecution("mytest", 0L, ETestExecutionResult.PASSED));
strategy.testRunEnd();
verify(client).uploadReport(eq(EReportFormat.TESTWISE_COVERAGE), matches("\\Q{\"tests\":[{\"content\":\"content\",\"duration\":\\E[^,]*\\Q,\"paths\":[{\"files\":[{\"coveredLines\":\"1-4\",\"fileName\":\"Main.java\"}],\"path\":\"src/main/java\"}],\"result\":\"PASSED\",\"sourcePath\":\"mytest\",\"uniformPath\":\"mytest\"}]}\\E"), any(), any(), any(), any());
}
Aggregations