Skip to content

Commit 0d96164

Browse files
committed
Change RunResult to never be null in AbstractJavaPlugin
1 parent 573dbaf commit 0d96164

File tree

11 files changed

+21
-15
lines changed

11 files changed

+21
-15
lines changed

build-tools/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>fi.helsinki.cs.tmc</groupId>
44
<artifactId>build-tools</artifactId>
5-
<version>0.7.5-SNAPSHOT</version>
5+
<version>0.7.6-SNAPSHOT</version>
66
<name>build-tools</name>
77

88
<!-- Deploy to maven.testmycode.net/nexus -->

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>fi.helsinki.cs.tmc</groupId>
55
<artifactId>tmc-langs</artifactId>
6-
<version>0.7.5-SNAPSHOT</version>
6+
<version>0.7.6-SNAPSHOT</version>
77
<packaging>pom</packaging>
88
<name>tmc-langs</name>
99
<url>http://testmycode.net</url>

tmc-langs-cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<artifactId>tmc-langs</artifactId>
66
<groupId>fi.helsinki.cs.tmc</groupId>
7-
<version>0.7.5-SNAPSHOT</version>
7+
<version>0.7.6-SNAPSHOT</version>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
1010

tmc-langs-framework/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>fi.helsinki.cs.tmc</groupId>
66
<artifactId>tmc-langs</artifactId>
7-
<version>0.7.5-SNAPSHOT</version>
7+
<version>0.7.6-SNAPSHOT</version>
88
<relativePath>../</relativePath>
99
</parent>
1010
<properties>

tmc-langs-java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>fi.helsinki.cs.tmc</groupId>
66
<artifactId>tmc-langs</artifactId>
7-
<version>0.7.5-SNAPSHOT</version>
7+
<version>0.7.6-SNAPSHOT</version>
88
</parent>
99

1010
<properties>

tmc-langs-java/src/main/java/fi/helsinki/cs/tmc/langs/java/AbstractJavaPlugin.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,14 @@ public RunResult runTests(Path projectRootPath) {
133133
RunResult result = resultParser.parseTestResult(results);
134134
results.getTestResultsFile().delete();
135135
return result;
136-
} catch (TestRunnerException | TestScannerException ex) {
136+
} catch (TestRunnerException ex) {
137137
log.error("Unable to create run result file", ex);
138-
return null;
138+
return new RunResult(RunResult.Status.TESTRUN_INTERRUPTED,
139+
ImmutableList.<TestResult>of(), ImmutableMap.<String, byte[]>of());
140+
} catch (TestScannerException ex) {
141+
log.error("Unable to create run result file", ex);
142+
return new RunResult(RunResult.Status.COMPILE_FAILED, ImmutableList.<TestResult>of(),
143+
ImmutableMap.<String, byte[]>of());
139144
}
140145
}
141146

tmc-langs-java/src/test/java/fi/helsinki/cs/tmc/langs/java/AbstractJavaPluginTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import fi.helsinki.cs.tmc.langs.abstraction.ValidationResult;
1515
import fi.helsinki.cs.tmc.langs.domain.CompileResult;
1616
import fi.helsinki.cs.tmc.langs.domain.ExerciseDesc;
17+
import fi.helsinki.cs.tmc.langs.domain.RunResult;
1718
import fi.helsinki.cs.tmc.langs.io.StudentFilePolicy;
1819
import fi.helsinki.cs.tmc.langs.io.sandbox.StudentFileAwareSubmissionProcessor;
1920
import fi.helsinki.cs.tmc.langs.io.sandbox.SubmissionProcessor;
@@ -139,7 +140,7 @@ protected ClassPath getProjectClassPath(Path path) throws IOException {
139140
}
140141

141142
@Test
142-
public void testRunnerExceptionDuringRunTestsReturnsNull() {
143+
public void testRunnerExceptionDuringRunTestsReturnsStatusTestRunInterrupted() {
143144
AbstractJavaPlugin plugin =
144145
new StubLanguagePlugin(Paths.get("")) {
145146
@Override
@@ -149,11 +150,11 @@ protected TestRunFileAndLogs createRunResultFile(Path path)
149150
}
150151
};
151152

152-
assertNull(plugin.runTests(null));
153+
assertEquals(plugin.runTests(null).status, RunResult.Status.TESTRUN_INTERRUPTED);
153154
}
154155

155156
@Test
156-
public void testScannerExceptionDuringRunTestsReturnsNull() {
157+
public void testScannerExceptionDuringRunTestsReturnsStatusCompileFailed() {
157158
AbstractJavaPlugin plugin =
158159
new StubLanguagePlugin(Paths.get("")) {
159160
@Override
@@ -163,7 +164,7 @@ protected TestRunFileAndLogs createRunResultFile(Path path)
163164
}
164165
};
165166

166-
assertNull(plugin.runTests(null));
167+
assertEquals(plugin.runTests(null).status, RunResult.Status.COMPILE_FAILED);
167168
}
168169

169170
@Test

tmc-langs-make/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>fi.helsinki.cs.tmc</groupId>
66
<artifactId>tmc-langs</artifactId>
7-
<version>0.7.5-SNAPSHOT</version>
7+
<version>0.7.6-SNAPSHOT</version>
88
</parent>
99

1010
<properties>

tmc-langs-notests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>fi.helsinki.cs.tmc</groupId>
66
<artifactId>tmc-langs</artifactId>
7-
<version>0.7.5-SNAPSHOT</version>
7+
<version>0.7.6-SNAPSHOT</version>
88
</parent>
99

1010
<properties>

tmc-langs-python3/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>fi.helsinki.cs.tmc</groupId>
66
<artifactId>tmc-langs</artifactId>
7-
<version>0.7.5-SNAPSHOT</version>
7+
<version>0.7.6-SNAPSHOT</version>
88
</parent>
99

1010
<properties>

0 commit comments

Comments
 (0)