Skip to content

Commit f614df7

Browse files
committed
fixed JUnitErrorModelTest; JaCoCo now passes all tests.
1 parent 3212757 commit f614df7

3 files changed

Lines changed: 8 additions & 17 deletions

File tree

drjava/src/edu/rice/cs/drjava/model/junit/DefaultJUnitModel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ public void junit(OpenDefinitionsDocument doc) throws ClassNotFoundException, IO
257257
LinkedList<OpenDefinitionsDocument> lod = new LinkedList<OpenDefinitionsDocument>();
258258
lod.add(doc);
259259
junitOpenDefDocs(lod, false);
260+
debug.logEnd("junit(doc)");
260261
}
261262

262263
/** Ensures that all documents have been compiled since their last modification and then delegates the actual testing
@@ -268,7 +269,7 @@ private void junitOpenDefDocs(final List<OpenDefinitionsDocument> lod, final boo
268269

269270
// Check_testInProgress flag
270271
if (_testInProgress) return;
271-
272+
272273
// Reset the JUnitErrorModel, fixes bug #907211 "Test Failures Not Cleared Properly".
273274
_junitErrorModel = new JUnitErrorModel(new JUnitError[0], null, false);
274275

@@ -326,8 +327,7 @@ private void junitOpenDefDocs(final List<OpenDefinitionsDocument> lod, final boo
326327
* classes by searching the build directories for the documents. Note: caller must respond to thrown exceptions
327328
* by invoking _junitUnitInterrupted (to run hourglassOff() and reset the unit testing UI).
328329
*/
329-
private void _rawJUnitOpenDefDocs(List<OpenDefinitionsDocument>
330-
lod, final boolean allTests) {
330+
private void _rawJUnitOpenDefDocs(List<OpenDefinitionsDocument> lod, final boolean allTests) {
331331

332332
File buildDir = _model.getBuildDirectory();
333333

drjava/src/edu/rice/cs/drjava/model/junit/JUnitTestManager.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ public List<String> findTestClasses(final List<String> classNames,
229229
return false;
230230
}
231231
Map<String, List<String>> lineColors = null;
232+
this.lastResult = new JUnitResultTuple(true, null);
232233

233234
//Utilities.show("runTestSuite() in SlaveJVM called");
234235

@@ -300,7 +301,6 @@ public List<String> findTestClasses(final List<String> classNames,
300301
StringWriter stackTrace = new StringWriter();
301302
e.printStackTrace(new PrintWriter(stackTrace));
302303
//Utilities.show(stackTrace.toString());
303-
this.lastResult = new JUnitResultTuple(false, null);
304304
}
305305

306306
/* Reset the runtime */
@@ -309,10 +309,8 @@ public List<String> findTestClasses(final List<String> classNames,
309309
}
310310

311311
catch (Exception e) {
312-
this.lastResult = new JUnitResultTuple(false, null);
313312
JUnitError[] errors = new JUnitError[1];
314-
errors[0] = new JUnitError(null, -1, -1, e.getMessage(), false, "", "",
315-
e.toString(), e.getStackTrace());
313+
errors[0] = new JUnitError(null, -1, -1, e.getMessage(), false, "", "", e.toString(), e.getStackTrace());
316314
_reset();
317315
_jmc.testSuiteEnded(errors);
318316
//new ScrollableDialog(null, "Slave JVM: testSuite ended with errors", "", Arrays.toString(errors)).show();

drjava/src/edu/rice/cs/drjava/model/repl/newjvm/MainJVM.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -463,16 +463,9 @@ public boolean setPackageScope(String packageName) {
463463
public Option<List<String>> findTestClasses(List<String> classNames,
464464
List<File> files, CoverageMetadata coverageMetadata) {
465465
InterpreterJVMRemoteI remote = _state.value().interpreter(false);
466-
if (remote == null) {
467-
return Option.none();
468-
}
469-
470-
try {
471-
return Option.some(remote.findTestClasses(classNames, files, coverageMetadata));
472-
} catch (RemoteException e) {
473-
_handleRemoteException(e);
474-
return Option.none();
475-
}
466+
if (remote == null) { return Option.none(); }
467+
try { return Option.some(remote.findTestClasses(classNames, files, coverageMetadata)); }
468+
catch (RemoteException e) { _handleRemoteException(e); return Option.none(); }
476469
}
477470

478471
/**

0 commit comments

Comments
 (0)