Use ReflectionTestUtils rather than Whitebox
This is better because it no longer uses Mockito's internal API Fixes gh-4305
This commit is contained in:
@@ -26,10 +26,10 @@ import org.junit.rules.ExpectedException;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.internal.WhiteboxImpl;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.security.config.util.InMemoryXmlApplicationContext;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public class SecurityNamespaceHandlerTests {
|
||||
|
||||
Log logger = mock(Log.class);
|
||||
SecurityNamespaceHandler handler = new SecurityNamespaceHandler();
|
||||
WhiteboxImpl.setInternalState(handler, Log.class, logger);
|
||||
ReflectionTestUtils.setField(handler, "logger", logger);
|
||||
|
||||
handler.init();
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.internal.util.reflection.Whitebox;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.security.access.AccessDecisionManager;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
@@ -74,7 +74,8 @@ public class DefaultFilterChainValidatorTests {
|
||||
AnyRequestMatcher.INSTANCE, aaf, etf, fsi);
|
||||
fcp = new FilterChainProxy(securityChain);
|
||||
validator = new DefaultFilterChainValidator();
|
||||
Whitebox.setInternalState(validator, "logger", logger);
|
||||
|
||||
ReflectionTestUtils.setField(validator, "logger", logger);
|
||||
}
|
||||
|
||||
// SEC-1878
|
||||
|
||||
Reference in New Issue
Block a user