@@ -68,51 +68,51 @@ private void executeCallableAndExpectError(Callable<Object> callable, Throwable
6868
6969 @ Test
7070 public void getCurrentSpan_WhenNoContext () {
71- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
71+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
7272 }
7373
7474 @ Test
7575 public void getCurrentSpan () {
76- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
77- Context origContext = Context .current (). withValue ( ContextUtils . CONTEXT_SPAN_KEY , span ).attach ();
76+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
77+ Context origContext = ContextUtils . withValue ( Context .current (), span ).attach ();
7878 // Make sure context is detached even if test fails.
7979 try {
8080 assertThat (CurrentSpanUtils .getCurrentSpan ()).isSameAs (span );
8181 } finally {
8282 Context .current ().detach (origContext );
8383 }
84- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
84+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
8585 }
8686
8787 @ Test
8888 public void withSpan_CloseDetaches () {
89- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
89+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
9090 Scope ws = CurrentSpanUtils .withSpan (span , false );
9191 try {
9292 assertThat (CurrentSpanUtils .getCurrentSpan ()).isSameAs (span );
9393 } finally {
9494 ws .close ();
9595 }
96- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
96+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
9797 verifyZeroInteractions (span );
9898 }
9999
100100 @ Test
101101 public void withSpan_CloseDetachesAndEndsSpan () {
102- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
102+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
103103 Scope ss = CurrentSpanUtils .withSpan (span , true );
104104 try {
105105 assertThat (CurrentSpanUtils .getCurrentSpan ()).isSameAs (span );
106106 } finally {
107107 ss .close ();
108108 }
109- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
109+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
110110 verify (span ).end (same (EndSpanOptions .DEFAULT ));
111111 }
112112
113113 @ Test
114114 public void withSpanRunnable () {
115- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
115+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
116116 Runnable runnable =
117117 new Runnable () {
118118 @ Override
@@ -123,12 +123,12 @@ public void run() {
123123 };
124124 CurrentSpanUtils .withSpan (span , false , runnable ).run ();
125125 verifyZeroInteractions (span );
126- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
126+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
127127 }
128128
129129 @ Test
130130 public void withSpanRunnable_EndSpan () {
131- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
131+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
132132 Runnable runnable =
133133 new Runnable () {
134134 @ Override
@@ -139,13 +139,13 @@ public void run() {
139139 };
140140 CurrentSpanUtils .withSpan (span , true , runnable ).run ();
141141 verify (span ).end (EndSpanOptions .DEFAULT );
142- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
142+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
143143 }
144144
145145 @ Test
146146 public void withSpanRunnable_WithError () {
147147 final AssertionError error = new AssertionError ("MyError" );
148- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
148+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
149149 Runnable runnable =
150150 new Runnable () {
151151 @ Override
@@ -158,13 +158,13 @@ public void run() {
158158 executeRunnableAndExpectError (runnable , error );
159159 verify (span ).setStatus (Status .UNKNOWN .withDescription ("MyError" ));
160160 verify (span ).end (EndSpanOptions .DEFAULT );
161- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
161+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
162162 }
163163
164164 @ Test
165165 public void withSpanRunnable_WithErrorNoMessage () {
166166 final AssertionError error = new AssertionError ();
167- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
167+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
168168 Runnable runnable =
169169 new Runnable () {
170170 @ Override
@@ -177,13 +177,13 @@ public void run() {
177177 executeRunnableAndExpectError (runnable , error );
178178 verify (span ).setStatus (Status .UNKNOWN .withDescription ("AssertionError" ));
179179 verify (span ).end (EndSpanOptions .DEFAULT );
180- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
180+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
181181 }
182182
183183 @ Test
184184 public void withSpanCallable () throws Exception {
185185 final Object ret = new Object ();
186- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
186+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
187187 Callable <Object > callable =
188188 new Callable <Object >() {
189189 @ Override
@@ -195,13 +195,13 @@ public Object call() throws Exception {
195195 };
196196 assertThat (CurrentSpanUtils .withSpan (span , false , callable ).call ()).isEqualTo (ret );
197197 verifyZeroInteractions (span );
198- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
198+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
199199 }
200200
201201 @ Test
202202 public void withSpanCallable_EndSpan () throws Exception {
203203 final Object ret = new Object ();
204- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
204+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
205205 Callable <Object > callable =
206206 new Callable <Object >() {
207207 @ Override
@@ -213,13 +213,13 @@ public Object call() throws Exception {
213213 };
214214 assertThat (CurrentSpanUtils .withSpan (span , true , callable ).call ()).isEqualTo (ret );
215215 verify (span ).end (EndSpanOptions .DEFAULT );
216- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
216+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
217217 }
218218
219219 @ Test
220220 public void withSpanCallable_WithException () {
221221 final Exception exception = new Exception ("MyException" );
222- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
222+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
223223 Callable <Object > callable =
224224 new Callable <Object >() {
225225 @ Override
@@ -232,13 +232,13 @@ public Object call() throws Exception {
232232 executeCallableAndExpectError (callable , exception );
233233 verify (span ).setStatus (Status .UNKNOWN .withDescription ("MyException" ));
234234 verify (span ).end (EndSpanOptions .DEFAULT );
235- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
235+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
236236 }
237237
238238 @ Test
239239 public void withSpanCallable_WithExceptionNoMessage () {
240240 final Exception exception = new Exception ();
241- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
241+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
242242 Callable <Object > callable =
243243 new Callable <Object >() {
244244 @ Override
@@ -251,13 +251,13 @@ public Object call() throws Exception {
251251 executeCallableAndExpectError (callable , exception );
252252 verify (span ).setStatus (Status .UNKNOWN .withDescription ("Exception" ));
253253 verify (span ).end (EndSpanOptions .DEFAULT );
254- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
254+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
255255 }
256256
257257 @ Test
258258 public void withSpanCallable_WithError () {
259259 final AssertionError error = new AssertionError ("MyError" );
260- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
260+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
261261 Callable <Object > callable =
262262 new Callable <Object >() {
263263 @ Override
@@ -270,13 +270,13 @@ public Object call() throws Exception {
270270 executeCallableAndExpectError (callable , error );
271271 verify (span ).setStatus (Status .UNKNOWN .withDescription ("MyError" ));
272272 verify (span ).end (EndSpanOptions .DEFAULT );
273- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
273+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
274274 }
275275
276276 @ Test
277277 public void withSpanCallable_WithErrorNoMessage () {
278278 final AssertionError error = new AssertionError ();
279- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
279+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
280280 Callable <Object > callable =
281281 new Callable <Object >() {
282282 @ Override
@@ -289,6 +289,6 @@ public Object call() throws Exception {
289289 executeCallableAndExpectError (callable , error );
290290 verify (span ).setStatus (Status .UNKNOWN .withDescription ("AssertionError" ));
291291 verify (span ).end (EndSpanOptions .DEFAULT );
292- assertThat (CurrentSpanUtils .getCurrentSpan ()).isNull ( );
292+ assertThat (CurrentSpanUtils .getCurrentSpan ()).isEqualTo ( BlankSpan . INSTANCE );
293293 }
294294}
0 commit comments