Skip to content

Commit

Permalink
Merge pull request #572 from pholser/master
Browse files Browse the repository at this point in the history
Ensuring no-generic-type-parms validator called/tested for theories
  • Loading branch information
David Saff committed Dec 13, 2012
2 parents 345ba45 + 80b7fba commit 1b7312e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/main/java/junit/runner/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* This class defines the current version of JUnit
*/
public class Version {
private Version() {
// don't instantiate
}
private Version() {
// don't instantiate
}

public static String id() {
return "4.11-SNAPSHOT";
}

public static void main(String[] args) {
System.out.println(id());
}
public static String id() {
return "4.12-SNAPSHOT";
}
public static void main(String[] args) {
System.out.println(id());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ protected void validateTestMethods(List<Throwable> errors) {
for (FrameworkMethod each : computeTestMethods()) {
if (each.getAnnotation(Theory.class) != null) {
each.validatePublicVoid(false, errors);
each.validateNoTypeParametersOnArgs(errors);
} else {
each.validatePublicVoidNoArg(false, errors);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.junit.tests.experimental.theories.runner.WithDataPointMethod;
import org.junit.tests.experimental.theories.runner.WithExtendedParameterSources;
import org.junit.tests.experimental.theories.runner.WithOnlyTestAnnotations;
import org.junit.tests.experimental.theories.runner.WithUnresolvedGenericTypeVariablesOnTheoryParms;

@RunWith(Suite.class)
@SuiteClasses({ParameterizedAssertionErrorTest.class,
Expand All @@ -22,7 +23,8 @@
ResultMatchersTest.class, WithDataPointMethod.class,
ParameterSignatureTest.class, WhenNoParametersMatch.class,
WithExtendedParameterSources.class, StubbedTheoriesTest.class,
WithOnlyTestAnnotations.class})
WithOnlyTestAnnotations.class,
WithUnresolvedGenericTypeVariablesOnTheoryParms.class})
public class ExperimentalTests {

}
9 changes: 5 additions & 4 deletions src/test/java/org/junit/tests/experimental/MatcherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@
@RunWith(Theories.class)
public class MatcherTest {
@DataPoint
public static Matcher<?> SINGLE_FAILURE = hasSingleFailureContaining("cheese");
public static Matcher<Object> SINGLE_FAILURE = hasSingleFailureContaining("cheese");

@DataPoint
public static Matcher<?> ANY_FAILURE = hasFailureContaining("cheese");
public static Matcher<PrintableResult> ANY_FAILURE = hasFailureContaining("cheese");

@DataPoint
public static PrintableResult TWO_FAILURES_ONE_CHEESE = new PrintableResult(
Arrays.asList(failure("cheese"), failure("mustard")));

@Theory
public <T> void differentMatchersHaveDifferentDescriptions(
Matcher<T> matcher1, Matcher<T> matcher2, T value) {
@SuppressWarnings("unchecked")
public void differentMatchersHaveDifferentDescriptions(
Matcher matcher1, Matcher matcher2, Object value) {
assumeThat(value, matcher1);
assumeThat(value, not(matcher2));
assertThat(matcher1.toString(), not(matcher2.toString()));
Expand Down

0 comments on commit 1b7312e

Please sign in to comment.