-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Fixes for #637, making theory parameters assignment more consistent across sources #651
Merged
dsaff
merged 8 commits into
junit-team:master
from
pimterry:datapoint-result-reuse-#638
Mar 19, 2013
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2ade5fd
Changed AllMembersSupplier to call single-valued methods at parameter…
pimterry cc8497f
Parameters are now matched on value, not defined type, for array and …
pimterry e9d4de8
Single-datapoint methods are now only called if the return types coul…
pimterry 278d76f
Further theory optimisation to avoid calling datapoint methods for mu…
pimterry b1832b2
Moved instance initialisation for type conversion map into static method
pimterry 3209ce6
Minor tweak to improve symmetric set up of convertable types in Param…
pimterry ccf0c0a
Changed single-valued datapoints back to deferred execution
pimterry c60d087
Tiny whitespace fix
pimterry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 25 additions & 30 deletions
55
src/test/java/org/junit/tests/experimental/theories/AssumingInTheoriesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,42 @@ | ||
package org.junit.tests.experimental.theories; | ||
|
||
import static org.junit.tests.experimental.theories.TheoryTestUtils.runTheoryClass; | ||
import org.junit.Assert; | ||
import org.junit.Assume; | ||
import org.junit.Test; | ||
import org.junit.experimental.theories.DataPoint; | ||
import org.junit.experimental.theories.Theories; | ||
import org.junit.experimental.theories.Theory; | ||
import org.junit.runner.JUnitCore; | ||
import org.junit.runner.Request; | ||
import org.junit.runner.Result; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runner.Runner; | ||
import org.junit.runners.model.InitializationError; | ||
|
||
@RunWith(Theories.class) | ||
public class AssumingInTheoriesTest { | ||
|
||
@Test | ||
public void noTheoryAnnotationMeansAssumeShouldIgnore() { | ||
Assume.assumeTrue(false); | ||
} | ||
|
||
@Test | ||
public void theoryMeansOnlyAssumeShouldFail() throws InitializationError { | ||
JUnitCore junitRunner = new JUnitCore(); | ||
Runner theoryRunner = new Theories(TheoryWithNoUnassumedParameters.class); | ||
Request request = Request.runner(theoryRunner); | ||
Result result = junitRunner.run(request); | ||
Assert.assertEquals(1, result.getFailureCount()); | ||
} | ||
|
||
/** | ||
* Simple class that SHOULD fail because no parameters are met. | ||
*/ | ||
public static class TheoryWithNoUnassumedParameters { | ||
|
||
@DataPoint | ||
public final static boolean FALSE = false; | ||
|
||
@Theory | ||
public void theoryWithNoUnassumedParameters(boolean value) { | ||
Assume.assumeTrue(value); | ||
} | ||
} | ||
@Test | ||
public void noTheoryAnnotationMeansAssumeShouldIgnore() { | ||
Assume.assumeTrue(false); | ||
} | ||
|
||
@Test | ||
public void theoryMeansOnlyAssumeShouldFail() throws InitializationError { | ||
Result result = runTheoryClass(TheoryWithNoUnassumedParameters.class); | ||
Assert.assertEquals(1, result.getFailureCount()); | ||
} | ||
|
||
/** | ||
* Simple class that SHOULD fail because no parameters are met. | ||
*/ | ||
public static class TheoryWithNoUnassumedParameters { | ||
|
||
@DataPoint | ||
public final static boolean FALSE = false; | ||
|
||
@Theory | ||
public void theoryWithNoUnassumedParameters(boolean value) { | ||
Assume.assumeTrue(value); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since CONVERTABLE_TYPES_MAP is symmetric, and canAcceptType already checks one direction, we don't have to also check the other direction here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, I should have re-loaded the code into my wetware memory before commenting. No change needed here.