Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensuring no-generic-type-parms validator called/tested for theories #572

Merged
merged 1 commit into from
Dec 13, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my information, did you make this change by hand, or automatically by running ant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By running ant.

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