Skip to content

Commit

Permalink
Take care of the TODO to make the inner class static.
Browse files Browse the repository at this point in the history
  • Loading branch information
Berin Loritsch authored and dsaff committed Apr 8, 2010
1 parent a21ce24 commit 309edad
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/java/org/junit/experimental/theories/Theories.java
Expand Up @@ -18,6 +18,7 @@
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
import org.junit.runners.model.TestClass;

public class Theories extends BlockJUnit4ClassRunner {
public Theories(Class<?> klass) throws InitializationError {
Expand Down Expand Up @@ -63,21 +64,26 @@ protected List<FrameworkMethod> computeTestMethods() {

@Override
public Statement methodBlock(final FrameworkMethod method) {
return new TheoryAnchor(method);
return new TheoryAnchor(method, getTestClass());
}

// TODO: this should be static
public class TheoryAnchor extends Statement {
public static class TheoryAnchor extends Statement {
private int successes= 0;

private FrameworkMethod fTestMethod;
private TestClass fTestClass;

private List<AssumptionViolatedException> fInvalidParameters= new ArrayList<AssumptionViolatedException>();

public TheoryAnchor(FrameworkMethod method) {
public TheoryAnchor(FrameworkMethod method, TestClass testClass) {
fTestMethod= method;
fTestClass= testClass;
}

private TestClass getTestClass() {
return fTestClass;
}

@Override
public void evaluate() throws Throwable {
runWithAssignment(Assignments.allUnassigned(
Expand Down Expand Up @@ -190,4 +196,4 @@ protected void handleDataPointSuccess() {
successes++;
}
}
}
}

0 comments on commit 309edad

Please sign in to comment.