TracingState extends Pair<Deque<Span>, Map<String, String>> { @Override public Map<String, String> setValue(Map<String, String> value) { throw new UnsupportedOperationException("TracingState is immutable - please create a new TracingState instead"); } TracingState(Deque<Span> spanStack, Map<String, String> mdcInfo); static TracingState getCurrentThreadTracingState(); @Override Deque<Span> getLeft(); @Override Map<String, String> getRight(); @Override Map<String, String> setValue(Map<String, String> value); @Nullable Span getActiveSpan(); final Deque<Span> spanStack; final Map<String, String> mdcInfo; }
@Test public void setValue_throws_UnsupportedOperationException() { Throwable ex = catchThrowable(new ThrowingCallable() { @Override public void call() throws Throwable { tracingState.setValue(mock(Map.class)); } }); assertThat(ex).isInstanceOf(UnsupportedOperationException.class); }