Skip to content

Commit f7f0386

Browse files
committed
Improve coverage for #35.
1 parent 24783f7 commit f7f0386

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/main/java/fr/cnes/sonar/plugins/icode/check/ICodeSensor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ protected void executeICode(final SensorContext sensorContext) {
166166
LOGGER.info("Auto-launch successfully executed i-Code CNES.");
167167
} catch (InterruptedException | IOException | ICodeException e) {
168168
LOGGER.error(e.getMessage(), e);
169-
sensorContext.newAnalysisError().message(e.getMessage()).save();
170169
}
171170
}
172171

src/test/java/fr/cnes/sonar/plugins/icode/check/ICodeSensorTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,34 @@ protected int runICode(final String command) {
144144
assert(true);
145145
}
146146

147+
@Test
148+
public void test_normal_work_with_icode_launch_other_exit() {
149+
final ICodeSensor sensor = new ICodeSensor() {
150+
@Override
151+
protected int runICode(final String command) {
152+
return 2;
153+
}
154+
};
155+
156+
final MapSettings settings = new MapSettings();
157+
settings.setProperty("sonar.icode.launch",true);
158+
context.setSettings(settings);
159+
160+
sensor.execute(context);
161+
assert(true);
162+
}
163+
164+
165+
166+
@Test
167+
public void test_run_a_command() throws IOException, InterruptedException {
168+
final ICodeSensor sensor = new ICodeSensor();
169+
170+
final int value = sensor.runICode("java --version");
171+
172+
Assert.assertEquals(1, value);
173+
}
174+
147175
@Test
148176
public void test_get_scanned_files() {
149177
final ICodeSensor sensor = new ICodeSensor();

0 commit comments

Comments
 (0)