SEC-2682: DelegatingSecurityContextRunnable/Callable delegate toString()
This commit is contained in:
parent
05882b5f24
commit
3089f1603e
|
@ -64,6 +64,10 @@ public final class DelegatingSecurityContextCallable<V> implements Callable<V> {
|
|||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link DelegatingSecurityContextCallable} and with the given {@link Callable} and
|
||||
* {@link SecurityContext}, but if the securityContext is null will defaults to the current {@link SecurityContext}
|
||||
|
|
|
@ -61,6 +61,10 @@ public final class DelegatingSecurityContextRunnable implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for creating a {@link DelegatingSecurityContextRunnable}.
|
||||
*
|
||||
|
|
|
@ -126,6 +126,15 @@ public class DelegatingSecurityContextCallableTests {
|
|||
assertWrapped(callable.call());
|
||||
}
|
||||
|
||||
// --- toString
|
||||
|
||||
// SEC-2682
|
||||
@Test
|
||||
public void toStringDelegates() {
|
||||
callable = new DelegatingSecurityContextCallable<Object>(delegate, securityContext);
|
||||
assertThat(callable.toString()).isEqualTo(delegate.toString());
|
||||
}
|
||||
|
||||
private void assertWrapped(Object actualResult) throws Exception {
|
||||
assertThat(actualResult).isEqualTo(callableResult);
|
||||
verify(delegate).call();
|
||||
|
|
|
@ -127,6 +127,15 @@ public class DelegatingSecurityContextRunnableTests {
|
|||
assertWrapped();
|
||||
}
|
||||
|
||||
// --- toString
|
||||
|
||||
// SEC-2682
|
||||
@Test
|
||||
public void toStringDelegates() {
|
||||
runnable = new DelegatingSecurityContextRunnable(delegate, securityContext);
|
||||
assertThat(runnable.toString()).isEqualTo(delegate.toString());
|
||||
}
|
||||
|
||||
private void assertWrapped() {
|
||||
verify(delegate).run();
|
||||
assertThat(SecurityContextHolder.getContext()).isEqualTo(SecurityContextHolder.createEmptyContext());
|
||||
|
|
Loading…
Reference in New Issue