Skip to content

Commit

Permalink
Merge pull request #961 from stefanbirkner/intellij
Browse files Browse the repository at this point in the history
Restore field names with f prefix. Fixes #960.
  • Loading branch information
kcooney committed Jul 24, 2014
2 parents 817ea24 + ef7b30f commit 74b11e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
12 changes: 9 additions & 3 deletions src/main/java/org/junit/internal/requests/ClassRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@

public class ClassRequest extends Request {
private final Object runnerLock = new Object();
private final Class<?> testClass;

/*
* We have to use the f prefix, because IntelliJ's JUnit4IdeaTestRunner uses
* reflection to access this field. See
* https://github.com/junit-team/junit/issues/960
*/
private final Class<?> fTestClass;
private final boolean canUseSuiteMethod;
private volatile Runner runner;

public ClassRequest(Class<?> testClass, boolean canUseSuiteMethod) {
this.testClass = testClass;
this.fTestClass = testClass;
this.canUseSuiteMethod = canUseSuiteMethod;
}

Expand All @@ -24,7 +30,7 @@ public Runner getRunner() {
if (runner == null) {
synchronized (runnerLock) {
if (runner == null) {
runner = new AllDefaultPossibilitiesBuilder(canUseSuiteMethod).safeRunnerForClass(testClass);
runner = new AllDefaultPossibilitiesBuilder(canUseSuiteMethod).safeRunnerForClass(fTestClass);
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/org/junit/internal/requests/FilterRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
*/
public final class FilterRequest extends Request {
private final Request request;
private final Filter filter;
/*
* We have to use the f prefix, because IntelliJ's JUnit4IdeaTestRunner uses
* reflection to access this field. See
* https://github.com/junit-team/junit/issues/960
*/
private final Filter fFilter;

/**
* Creates a filtered Request
Expand All @@ -22,18 +27,18 @@ public final class FilterRequest extends Request {
*/
public FilterRequest(Request request, Filter filter) {
this.request = request;
this.filter = filter;
this.fFilter = filter;
}

@Override
public Runner getRunner() {
try {
Runner runner = request.getRunner();
filter.apply(runner);
fFilter.apply(runner);
return runner;
} catch (NoTestsRemainException e) {
return new ErrorReportingRunner(Filter.class, new Exception(String
.format("No tests found matching %s from %s", filter
.format("No tests found matching %s from %s", fFilter
.describe(), request.toString())));
}
}
Expand Down

0 comments on commit 74b11e0

Please sign in to comment.