Polish ReactorContextTestExecutionListenerTests
Code Style fixes
This commit is contained in:
parent
4fd17e4c2e
commit
f59fc357b8
|
@ -28,15 +28,16 @@ import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.runners.MockitoJUnitRunner;
|
||||||
|
import reactor.core.publisher.Hooks;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
import reactor.test.StepVerifier;
|
||||||
|
|
||||||
import org.springframework.core.OrderComparator;
|
import org.springframework.core.OrderComparator;
|
||||||
import org.springframework.security.authentication.TestingAuthenticationToken;
|
import org.springframework.security.authentication.TestingAuthenticationToken;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextImpl;
|
import org.springframework.security.core.context.SecurityContextImpl;
|
||||||
import org.springframework.security.test.context.TestSecurityContextHolder;
|
import org.springframework.security.test.context.TestSecurityContextHolder;
|
||||||
import org.springframework.test.context.TestContext;
|
import org.springframework.test.context.TestContext;
|
||||||
import reactor.core.publisher.Hooks;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
import reactor.test.StepVerifier;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ public class ReactorContextTestExecutionListenerTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void beforeTestMethodWhenSecurityContextEmptyThenReactorContextNull() throws Exception {
|
public void beforeTestMethodWhenSecurityContextEmptyThenReactorContextNull() throws Exception {
|
||||||
listener.beforeTestMethod(testContext);
|
this.listener.beforeTestMethod(this.testContext);
|
||||||
|
|
||||||
assertThat(Mono.currentContext().block().isEmpty()).isTrue();
|
assertThat(Mono.currentContext().block().isEmpty()).isTrue();
|
||||||
}
|
}
|
||||||
|
@ -66,7 +67,7 @@ public class ReactorContextTestExecutionListenerTests {
|
||||||
public void beforeTestMethodWhenNullAuthenticationThenReactorContextNull() throws Exception {
|
public void beforeTestMethodWhenNullAuthenticationThenReactorContextNull() throws Exception {
|
||||||
TestSecurityContextHolder.setContext(new SecurityContextImpl());
|
TestSecurityContextHolder.setContext(new SecurityContextImpl());
|
||||||
|
|
||||||
listener.beforeTestMethod(testContext);
|
this.listener.beforeTestMethod(this.testContext);
|
||||||
|
|
||||||
assertThat(Mono.currentContext().block().isEmpty()).isTrue();
|
assertThat(Mono.currentContext().block().isEmpty()).isTrue();
|
||||||
}
|
}
|
||||||
|
@ -79,23 +80,23 @@ public class ReactorContextTestExecutionListenerTests {
|
||||||
context.setAuthentication(expectedAuthentication);
|
context.setAuthentication(expectedAuthentication);
|
||||||
TestSecurityContextHolder.setContext(context);
|
TestSecurityContextHolder.setContext(context);
|
||||||
|
|
||||||
listener.beforeTestMethod(testContext);
|
this.listener.beforeTestMethod(this.testContext);
|
||||||
|
|
||||||
assertAuthentication(expectedAuthentication);
|
assertAuthentication(expectedAuthentication);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void afterTestMethodWhenSecurityContextEmptyThenNoError() throws Exception {
|
public void afterTestMethodWhenSecurityContextEmptyThenNoError() throws Exception {
|
||||||
listener.beforeTestMethod(testContext);
|
this.listener.beforeTestMethod(this.testContext);
|
||||||
|
|
||||||
listener.afterTestMethod(testContext);
|
this.listener.afterTestMethod(this.testContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void afterTestMethodWhenSetupThenReactorContextNull() throws Exception {
|
public void afterTestMethodWhenSetupThenReactorContextNull() throws Exception {
|
||||||
beforeTestMethodWhenAuthenticationThenReactorContextHasAuthentication();
|
beforeTestMethodWhenAuthenticationThenReactorContextHasAuthentication();
|
||||||
|
|
||||||
listener.afterTestMethod(testContext);
|
this.listener.afterTestMethod(this.testContext);
|
||||||
|
|
||||||
assertThat(Mono.currentContext().block().isEmpty()).isTrue();
|
assertThat(Mono.currentContext().block().isEmpty()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue