-
Notifications
You must be signed in to change notification settings - Fork 68
Provide an extension point to allow filtering/skipping specification examples #267
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ba5d39f
Provide an extension point to allow filtering/skipping specification …
chiknrice 130d337
Changed ExampleFilter to ImplementationStatusModifier and changed SKI…
chiknrice fb5b535
Removed dependency to JUnit @Ignore annotation
chiknrice b8bf761
Introduced abstraction to the underlying example element to reduce co…
chiknrice 7354d57
Fixed (jdk6 related) bug
chiknrice 5a8debc
Prevent calls to @BeforeExample and @AfterExample annotated methods f…
chiknrice 760e294
Merge branch 'master' of https://github.com/concordion/concordion int…
chiknrice 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.concordion.api; | ||
|
||
/** | ||
* An interface to access example element's name and attributes for use mainly in {@link ImplementationStatusModifier}. | ||
* | ||
* @author <a href="mailto:chiknrice@gmail.com">Ian Bondoc</a> | ||
*/ | ||
public interface ExampleDefinition { | ||
|
||
/** | ||
* Accessor to get the example's name | ||
* | ||
* @return the example's name | ||
*/ | ||
String getName(); | ||
|
||
/** | ||
* Accessor to the example's attribute given the name | ||
* | ||
* @param name the name of the attribute | ||
* @return the attribute value | ||
*/ | ||
String getAttributeValue(String name); | ||
|
||
/** | ||
* Accessor to the example's attribute given the name and namespace | ||
* | ||
* @param localName the name of the attribute | ||
* @param namespaceURI the namespace of the attribute | ||
* @return the attribute value | ||
*/ | ||
String getAttributeValue(String localName, String namespaceURI); | ||
|
||
} |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.concordion.api; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface IgnoredExample { | ||
} |
This file contains hidden or 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
20 changes: 20 additions & 0 deletions
20
src/main/java/org/concordion/api/ImplementationStatusModifier.java
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.concordion.api; | ||
|
||
/** | ||
* Examples can be marked as {@code Unimplemented}, {@code ExpectedToFail}, or {@code Ignored} declaratively via | ||
* c:status attribute. If the status needs to be determined at runtime, this extension point can be used. | ||
* | ||
* @author <a href="mailto:chiknrice@gmail.com">Ian Bondoc</a> | ||
* @see ImplementationStatus | ||
*/ | ||
public interface ImplementationStatusModifier { | ||
|
||
/** | ||
* Determine an example element's {@code ImplementationStatus} | ||
* | ||
* @param exampleDefinition the definition of the example to evaluate | ||
* @return the status based on the exampleDefinition | ||
*/ | ||
ImplementationStatus getStatusForExample(ExampleDefinition exampleDefinition); | ||
|
||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
66 changes: 66 additions & 0 deletions
66
src/test/java/spec/concordion/common/extension/ImplementationStatusModifierTest.java
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package spec.concordion.common.extension; | ||
|
||
import org.concordion.api.*; | ||
import org.concordion.api.extension.ConcordionExtender; | ||
import org.concordion.api.extension.ConcordionExtension; | ||
import org.concordion.integration.junit4.ConcordionRunner; | ||
import org.concordion.internal.ConcordionBuilder; | ||
import org.junit.runner.RunWith; | ||
import test.concordion.ProcessingResult; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by bondocaadmin on 10/05/2018. | ||
*/ | ||
@RunWith(ConcordionRunner.class) | ||
@FullOGNL | ||
public class ImplementationStatusModifierTest extends AbstractExtensionTestCase { | ||
|
||
public void addExtension() { | ||
setExtension(new ConcordionExtension() { | ||
@Override | ||
public void addTo(ConcordionExtender concordionExtender) { | ||
concordionExtender.withImplementationStatusModifier(new ImplementationStatusModifier() { | ||
@Override | ||
public ImplementationStatus getStatusForExample(ExampleDefinition exampleDefinition) { | ||
if (exampleDefinition.getName().endsWith("Ignored")) { | ||
return ImplementationStatus.IGNORED; | ||
} else { | ||
return null; | ||
} | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public ProcessingResult getProcessingResult() { | ||
return super.getProcessingResult(); | ||
} | ||
|
||
private final List<String> beforeExampleCapturedNames = new ArrayList<String>(); | ||
private final List<String> afterExampleCapturedNames = new ArrayList<String>(); | ||
|
||
@BeforeExample | ||
public void saveNameBeforeExample(@ExampleName String name) { | ||
beforeExampleCapturedNames.add(name); | ||
} | ||
|
||
@AfterExample | ||
public void saveNameAfterExample(@ExampleName String name) { | ||
afterExampleCapturedNames.add(name); | ||
} | ||
|
||
public List<String> getBeforeExampleCapturedNames() { | ||
return beforeExampleCapturedNames; | ||
} | ||
|
||
public List<String> getAfterExampleCapturedNames() { | ||
return afterExampleCapturedNames; | ||
} | ||
|
||
|
||
} |
This file contains hidden or 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 hidden or 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 hidden or 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.
So here we have skipped being processed as ignored for the results. So another indicator they are probably the same concept. I've read your comment about the conceptual mismatch with jUnit - it's a good point and I'll have a think about it (woke up early today and brain not yet working!)