Skip to content

Commit 5f8a06a

Browse files
author
puny
committed
TestRunResult Status changed to compilationSucceeded boolean
1 parent 3a792a1 commit 5f8a06a

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

tmc-plugin/src/fi/helsinki/cs/tmc/data/TestRunResult.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,29 @@
44
import java.util.List;
55

66
public class TestRunResult {
7-
public static enum Status {
8-
PASSED,
9-
COMPILE_FAILED
10-
}
11-
127
private final List<TestCaseResult> testCaseResults;
13-
public final Status status;
8+
private final boolean compilationSucceeded;
149

1510
public TestRunResult(List<TestCaseResult> testCaseResults) {
16-
this.status = Status.PASSED;
11+
this.compilationSucceeded = true;
1712
this.testCaseResults = testCaseResults;
1813
}
1914

20-
public TestRunResult(Status status) {
21-
this.status = status;
15+
public TestRunResult(boolean compilationSucceeded) {
16+
this.compilationSucceeded = compilationSucceeded;
2217
this.testCaseResults = new ArrayList<TestCaseResult>();
2318
}
2419

25-
public TestRunResult(List<TestCaseResult> testCaseResults, Status status) {
20+
public TestRunResult(List<TestCaseResult> testCaseResults, boolean compilationSucceeded) {
2621
this.testCaseResults = testCaseResults;
27-
this.status = status;
22+
this.compilationSucceeded = compilationSucceeded;
2823
}
2924

3025
public List<TestCaseResult> getTestCaseResults() {
3126
return testCaseResults;
3227
}
28+
29+
public boolean getCompilationSuccess() {
30+
return compilationSucceeded;
31+
}
3332
}

tmc-plugin/src/fi/helsinki/cs/tmc/runners/AntExerciseRunner.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import fi.helsinki.cs.tmc.data.Exercise;
44
import fi.helsinki.cs.tmc.data.TestRunResult;
5-
import fi.helsinki.cs.tmc.data.TestRunResult.Status;
65
import fi.helsinki.cs.tmc.model.TmcProjectInfo;
76
import fi.helsinki.cs.tmc.model.UserVisibleException;
87
import fi.helsinki.cs.tmc.testscanner.TestMethod;
@@ -43,7 +42,7 @@ public TestRunResult call() throws Exception {
4342
log.log(Level.INFO, "Compile success for project {0}", projectInfo.toString());
4443
return runTests(projectInfo);
4544
} else {
46-
return new TestRunResult(Status.COMPILE_FAILED);
45+
return new TestRunResult(false);
4746
}
4847
}
4948
};

tmc-plugin/src/fi/helsinki/cs/tmc/runners/MakefileExerciseRunner.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import fi.helsinki.cs.tmc.data.Exercise;
44
import fi.helsinki.cs.tmc.data.TestRunResult;
5-
import fi.helsinki.cs.tmc.data.TestRunResult.Status;
65
import fi.helsinki.cs.tmc.model.TmcProjectInfo;
76
import fi.helsinki.cs.tmc.model.UserVisibleException;
87
import fi.helsinki.cs.tmc.utilities.process.ProcessResult;
@@ -49,7 +48,7 @@ public TestRunResult call() throws Exception {
4948
if (ret != 0) {
5049
io.select();
5150
log.log(Level.INFO, "Compile resulted in non-zero exit code {0}", result.statusCode);
52-
return new TestRunResult(Status.COMPILE_FAILED);
51+
return new TestRunResult(false);
5352
}
5453

5554
log.info("Running tests");

tmc-plugin/src/fi/helsinki/cs/tmc/runners/MavenExerciseRunner.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import fi.helsinki.cs.tmc.data.Exercise;
44
import fi.helsinki.cs.tmc.data.TestRunResult;
5-
import fi.helsinki.cs.tmc.data.TestRunResult.Status;
65
import fi.helsinki.cs.tmc.model.TmcProjectInfo;
76
import fi.helsinki.cs.tmc.utilities.maven.MavenRunBuilder;
87
import fi.helsinki.cs.tmc.utilities.process.ProcessResult;
@@ -47,7 +46,7 @@ public TestRunResult call() throws Exception {
4746
if (ret != 0) {
4847
inOut.select();
4948
log.log(Level.INFO, "Compile resulted in non-zero exit code {0}", result.statusCode);
50-
return new TestRunResult(Status.COMPILE_FAILED);
49+
return new TestRunResult(false);
5150
} else {
5251
log.log(Level.INFO, "Running tests");
5352
return runTests(projectInfo, inOut);

tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void performAction(final ResultCollector resultCollector, Project... proj
6060
BgTask.start("Running tests", runner.getTestRunningTask(projectInfo), new BgTaskListener<TestRunResult>() {
6161
@Override
6262
public void bgTaskReady(TestRunResult result) {
63-
if (result.status == TestRunResult.Status.COMPILE_FAILED) {
63+
if (!result.getCompilationSuccess()) {
6464
dialogDisplayer.displayError("The code did not compile.");
6565
return;
6666
}

0 commit comments

Comments
 (0)