-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
158de7f
commit 2da77e1
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
Submodule integrations-core
updated
3586 files
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
utils/test-utils/src/main/groovy/datadog/trace/test/util/TestSourceFileExtension.groovy
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 datadog.trace.test.util | ||
|
||
import org.junit.jupiter.api.extension.ExtensionContext | ||
import org.junit.jupiter.api.extension.TestWatcher | ||
|
||
class TestSourceFileExtension implements TestWatcher { | ||
TestSourceFileExtension() { | ||
System.out.println("TestSourceFileExtension initialized!") | ||
} | ||
|
||
@Override | ||
void testSuccessful(ExtensionContext context) { | ||
System.out.println("test was successful!") | ||
getTestData(context) | ||
} | ||
|
||
@Override | ||
void testFailed(ExtensionContext context, Throwable cause) { | ||
System.out.println("test failed!") | ||
getTestData(context) | ||
} | ||
|
||
@Override | ||
void testAborted(ExtensionContext context, Throwable cause) { | ||
System.out.println("test aborted!") | ||
getTestData(context) | ||
} | ||
|
||
@Override | ||
void testDisabled(ExtensionContext context, Optional<String> reason) { | ||
System.out.println("test disabled!") | ||
getTestData(context) | ||
} | ||
|
||
private static void getTestData(ExtensionContext context) { | ||
String testClassName = context.getTestClass().get().getSimpleName() | ||
String testMethodName = context.getTestMethod().get().getName() | ||
String className = context.getClass() | ||
String requiredTestClassName = context.getRequiredTestClass().getName() | ||
String requiredTestMethodName = context.getRequiredTestMethod().getName() | ||
|
||
System.out.println("--------------------------") | ||
System.out.println("testClassName: " + testClassName) | ||
System.out.println("testMethodName: " + testMethodName) | ||
System.out.println("className: " + className) | ||
System.out.println("requiredTestClassName: " + requiredTestClassName) | ||
System.out.println("requiredTestMethodName: " + requiredTestMethodName) | ||
System.out.println("--------------------------") | ||
} | ||
} |