-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #551 from zalando/fix_npe
fix NullPointerException
- Loading branch information
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); | ||
} | ||
} |