Skip to content

traceunit/traceunit-junit5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TraceUnit extension for Junit5

TraceUnit is a library that helps with Opentelemetry tracing mocking/testing

How to:

Add dependency to your project

For maven:

<dependency>
  <groupId>io.github.traceunit</groupId>
  <artifactId>traceunit-junit5</artifactId>
  <version>0.0.4</version>
  <scope>test</scope>
</dependency>

For Gradle:

testImplementation 'io.github.traceunit:traceunit-junit5:0.0.4'
  1. Extend your test class with TraceUnitExtension:
@ExtendWith({TraceUnitExtension.class})

Span.current() will be automatically mocked after this step

  1. Annotate Tracer mock with @MockTracer
@MockTracer
Tracer tracer;
  1. Inject mocked item into any test class:
    @BeforeEach
    void setUp() {
        testService = new TestService();
        testService.tracer = tracer;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages