Skip to content

Commit

Permalink
Add missing test for empty SensorContext
Browse files Browse the repository at this point in the history
  • Loading branch information
tamasvajk committed Oct 10, 2016
1 parent af9cd0d commit 5b56ef1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/java/org/sonar/plugins/csharp/CSharpSensorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,16 @@ public void endStepAnalysisNotCalledWhenBuildPhaseComputedMetrics() throws Excep
verify(spy, times(1)).importResults(tester, outputDir, false);
}

@Test
public void noAnalysisIsExecutedOnEmptyContext() throws Exception {
tester = SensorContextTester.create(new File("src/test/resources"));

CSharpSensor spy = spy(sensor);
spy.execute(tester);

verify(spy, never()).executeInternal(tester);
}

private static String readFile(Path directory, String fileName) throws Exception {
return new String(Files.readAllBytes(directory.resolve(fileName)));
}
Expand Down

0 comments on commit 5b56ef1

Please sign in to comment.