Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- TestListeners Registration can be performed using the Launcher API
- Loading branch information
1 parent
36f0d62
commit 55a73e4
Showing
5 changed files
with
31 additions
and
9 deletions.
There are no files selected for viewing
12 changes: 7 additions & 5 deletions
12
junit-engine-api/src/main/java/org/junit/gen5/engine/TestListenerRegistry.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
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,6 +1,7 @@ | |||
dependencies { | dependencies { | ||
testCompile(project(':sample-extension')) | testCompile(project(':sample-extension')) | ||
testCompile(project(':junit-launcher')) | testCompile(project(':junit-launcher')) | ||
testCompile(project(':junit-console')) | |||
testCompile(project(':junit5-api')) | testCompile(project(':junit5-api')) | ||
testRuntime(project(':junit5-engine')) | testRuntime(project(':junit5-engine')) | ||
} | } |
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
17 changes: 13 additions & 4 deletions
17
sample-project/src/test/java/com/example/SampleTestCase.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,21 +1,30 @@ | |||
package com.example; | package com.example; | ||
|
|
||
import org.junit.gen5.api.Test; | import org.junit.gen5.api.Test; | ||
import org.opentestalliance.TestAbortedException; | |||
import org.opentestalliance.TestSkippedException; | |||
|
|
||
/** | /** | ||
* Named *TestCase so Gradle will not try to run it. | * Named *TestCase so Gradle will not try to run it. | ||
*/ | */ | ||
class SampleTestCase { | class SampleTestCase { | ||
@Test | |||
void skippingTest() { | |||
throw new TestSkippedException("This test will be skipped!"); | |||
} | |||
|
|||
@Test | |||
void abortedTest() { | |||
throw new TestAbortedException("This test will be aborted!"); | |||
} | |||
|
|
||
@Test | @Test | ||
void failingTest() { | void failingTest() { | ||
throw new AssertionError("this test should fail"); | throw new AssertionError("This test will always fail!"); | ||
} | } | ||
|
|
||
@Test | @Test | ||
void succeedingTest() { | void succeedingTest() { | ||
// no-op | // no-op | ||
System.out.println("success"); | |||
} | } | ||
|
} | ||
} |