Skip to content

Commit

Permalink
StatementInterceptor takes Object target
Browse files Browse the repository at this point in the history
  • Loading branch information
David Saff committed Jul 7, 2009
1 parent 4b54936 commit 8e313a1
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Wed Jul 01 13:15:17 EDT 2009
#Mon Jul 06 21:57:53 EDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
Expand Down Expand Up @@ -46,7 +46,7 @@ org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
public class ExpectedException implements StatementInterceptor {
private Matcher<?> fMatcher= null;

public Statement intercept(Statement base, FrameworkMethod method) {
public Statement intercept(Statement base, FrameworkMethod method, Object target) {
return new ExpectedExceptionStatement(base);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public abstract class ExternalResource implements StatementInterceptor {
public final Statement intercept(final Statement base,
FrameworkMethod method) {
FrameworkMethod method, Object target) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
public interface StatementInterceptor {
// TODO (Jul 1, 2009 1:43:11 PM): add documentation to
// BlockJUnit4ClassRunner
Statement intercept(Statement base, FrameworkMethod method);
Statement intercept(Statement base, FrameworkMethod method, Object target);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class TestWatchman implements StatementInterceptor {
public Statement intercept(final Statement base,
final FrameworkMethod method) {
final FrameworkMethod method, Object target) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public Timeout(int millis) {
fMillis= millis;
}

public Statement intercept(Statement base, FrameworkMethod method) {
public Statement intercept(Statement base, FrameworkMethod method, Object target) {
return new FailOnTimeout(base, fMillis);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.junit.runners.model.Statement;

public class Verifier implements StatementInterceptor {
public Statement intercept(final Statement base, FrameworkMethod method) {
public Statement intercept(final Statement base, FrameworkMethod method, Object target) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/junit/experimental/max/MaxHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,15 @@ private static MaxHistory readHistory(File storedResults)

private final Map<String, Long> fFailureTimestamps= new HashMap<String, Long>();

// TODO (Jul 1, 2009 3:39:45 PM): rename. This ain't a folder.
private final File fFolder;
private final File fHistoryStore;

private MaxHistory(File storedResults) {
fFolder= storedResults;
fHistoryStore= storedResults;
}

private void save() throws IOException {
ObjectOutputStream stream= new ObjectOutputStream(new FileOutputStream(
fFolder));
fHistoryStore));
stream.writeObject(this);
stream.close();
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,11 @@ protected Statement withAfters(FrameworkMethod method, Object target,
new RunAfters(statement, afters, target);
}

private Statement withInterceptors(FrameworkMethod method, Object test,
private Statement withInterceptors(FrameworkMethod method, Object target,
Statement statement) {
Statement result= statement;
for (StatementInterceptor each : interceptors(test))
result= each.intercept(result, method);
for (StatementInterceptor each : interceptors(target))
result= each.intercept(result, method, target);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class ExampleTest {
@Interceptor
public StatementInterceptor example= new StatementInterceptor() {
public Statement intercept(final Statement base,
FrameworkMethod method) {
FrameworkMethod method, Object target) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
Expand Down Expand Up @@ -56,7 +56,7 @@ public void interceptorIsIntroducedAndEvaluated() {
public static class MultipleInterceptorTest {
private static class Incrementor implements StatementInterceptor {
public Statement intercept(final Statement base,
FrameworkMethod method) {
FrameworkMethod method, Object target) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
Expand Down

0 comments on commit 8e313a1

Please sign in to comment.