-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ContractExclude annotation to fix Issue #12
- Loading branch information
Showing
22 changed files
with
364 additions
and
46 deletions.
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
50 changes: 50 additions & 0 deletions
50
junit/src/main/java/org/xenei/junit/contract/ContractExclude.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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.xenei.junit.contract; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Repeatable; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Annotation to exclude specific test methods from the contract suite. | ||
* May be used multiple times. | ||
* <p> | ||
* For example | ||
* | ||
* <pre> | ||
* | ||
* @RunWith( ContractSuite.class ) | ||
* @ContractImpl( FooImpl.class ) | ||
* @ContractExclude( ExpertFooTests.class, fns="{barTest,bazTest} ) | ||
* public class Foo_Test {...} | ||
* </pre> | ||
* <p> | ||
* Declares that in the <code>ExpertFooTests</code> class the | ||
* <code>barTest</code>, and <code>bazTest</code> methods should not | ||
* be executed. | ||
* </p> | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Repeatable(ContractExcludes.class) | ||
public @interface ContractExclude | ||
{ | ||
/** | ||
* The Contract test implementation (annotated with | ||
* @Contract) that declares the methods that should not be executed. | ||
* | ||
* @return The Contract test class. | ||
*/ | ||
Class<?> value(); | ||
|
||
/** | ||
* The list of interface classes for which tests should be skipped. | ||
* This list are interfaces that the class under tests implements but that should | ||
* not be tested. | ||
* | ||
* @return The interfaces to skip testing. | ||
*/ | ||
String[] methods(); | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
junit/src/main/java/org/xenei/junit/contract/ContractExcludes.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.xenei.junit.contract; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* The container for repeated ContractExclude annotations. | ||
* | ||
* | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ContractExcludes | ||
{ | ||
/** | ||
* | ||
* The list of ContractExclude annotations. | ||
*/ | ||
ContractExclude[] 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
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.