| 
					
				 | 
			
			
				@@ -94,6 +94,35 @@ public class ReactorContextTestExecutionListenerTests { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		assertAuthentication(expectedAuthentication); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public void beforeTestMethodWhenCustomContext() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		TestingAuthenticationToken expectedAuthentication = new TestingAuthenticationToken("user", "password", "ROLE_USER"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SecurityContext context = new CustomContext(expectedAuthentication); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		TestSecurityContextHolder.setContext(context); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		this.listener.beforeTestMethod(this.testContext); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		assertSecurityContext(context); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	static class CustomContext implements SecurityContext { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		private Authentication authentication; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		CustomContext(Authentication authentication) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			this.authentication = authentication; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		public Authentication getAuthentication() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return this.authentication; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		public void setAuthentication(Authentication authentication) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			this.authentication = authentication; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public void beforeTestMethodWhenExistingAuthenticationThenReactorContextHasOriginalAuthentication() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		TestingAuthenticationToken expectedAuthentication = new TestingAuthenticationToken("user", "password", "ROLE_USER"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -175,4 +204,13 @@ public class ReactorContextTestExecutionListenerTests { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			.expectNext(expected) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			.verifyComplete(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private void assertSecurityContext(SecurityContext expected) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Mono<SecurityContext> securityContext = ReactiveSecurityContextHolder.getContext(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		StepVerifier.create(securityContext) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			.expectNext(expected) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			.verifyComplete(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |