Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@zalando.de>
- Loading branch information
1 parent
314c659
commit 54de9cd
Showing
2 changed files
with
31 additions
and
7 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
23 changes: 23 additions & 0 deletions
23
...rc/test/java/org/zalando/opentracing/spring/webflux/extension/ErrorSpanDecoratorTest.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,23 @@ | ||
package org.zalando.opentracing.spring.webflux.extension; | ||
|
||
import io.opentracing.mock.MockSpan; | ||
import io.opentracing.mock.MockTracer; | ||
import static org.assertj.core.api.Assertions.*; | ||
import org.junit.jupiter.api.Test; | ||
import static org.mockito.Mockito.*; | ||
import org.springframework.http.server.reactive.ServerHttpResponse; | ||
import org.springframework.web.server.ServerWebExchange; | ||
|
||
class ErrorSpanDecoratorTest { | ||
|
||
@Test | ||
void onTagNullStatusCode() { | ||
ServerWebExchange exchange = mock(ServerWebExchange.class); | ||
when(exchange.getResponse()).thenReturn(mock(ServerHttpResponse.class)); | ||
|
||
MockSpan span = new MockTracer().buildSpan("span").start(); | ||
new ErrorSpanDecorator().onResponse(exchange, span); | ||
|
||
assertThat(span.tags().get("error")).isEqualTo(true); | ||
} | ||
} |