|  | @@ -15,9 +15,6 @@
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  package org.springframework.security.test.web.servlet.response;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import static org.springframework.test.util.AssertionErrors.assertEquals;
 | 
	
		
			
				|  |  | -import static org.springframework.test.util.AssertionErrors.assertTrue;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.Collection;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -32,6 +29,9 @@ import org.springframework.test.web.servlet.MockMvc;
 | 
	
		
			
				|  |  |  import org.springframework.test.web.servlet.MvcResult;
 | 
	
		
			
				|  |  |  import org.springframework.test.web.servlet.ResultMatcher;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import static org.springframework.test.util.AssertionErrors.assertEquals;
 | 
	
		
			
				|  |  | +import static org.springframework.test.util.AssertionErrors.assertTrue;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * Security related {@link MockMvc} {@link ResultMatcher}s.
 | 
	
		
			
				|  |  |   *
 | 
	
	
		
			
				|  | @@ -78,8 +78,8 @@ public final class SecurityMockMvcResultMatchers {
 | 
	
		
			
				|  |  |  	 * @author Rob Winch
 | 
	
		
			
				|  |  |  	 * @since 4.0
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  | -	public static final class AuthenticatedMatcher extends
 | 
	
		
			
				|  |  | -			AuthenticationMatcher<AuthenticatedMatcher> {
 | 
	
		
			
				|  |  | +	public static final class AuthenticatedMatcher
 | 
	
		
			
				|  |  | +			extends AuthenticationMatcher<AuthenticatedMatcher> {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		private SecurityContext expectedContext;
 | 
	
		
			
				|  |  |  		private Authentication expectedAuthentication;
 | 
	
	
		
			
				|  | @@ -87,6 +87,7 @@ public final class SecurityMockMvcResultMatchers {
 | 
	
		
			
				|  |  |  		private String expectedAuthenticationName;
 | 
	
		
			
				|  |  |  		private Collection<? extends GrantedAuthority> expectedGrantedAuthorities;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +		@Override
 | 
	
		
			
				|  |  |  		public void match(MvcResult result) throws Exception {
 | 
	
		
			
				|  |  |  			SecurityContext context = load(result);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -109,10 +110,11 @@ public final class SecurityMockMvcResultMatchers {
 | 
	
		
			
				|  |  |  			if (this.expectedAuthenticationPrincipal != null) {
 | 
	
		
			
				|  |  |  				assertTrue("Authentication cannot be null",
 | 
	
		
			
				|  |  |  						context.getAuthentication() != null);
 | 
	
		
			
				|  |  | -				assertEquals(this.expectedAuthenticationPrincipal + " does not equal "
 | 
	
		
			
				|  |  | -						+ context.getAuthentication().getPrincipal(),
 | 
	
		
			
				|  |  | -						this.expectedAuthenticationPrincipal, context.getAuthentication()
 | 
	
		
			
				|  |  | -								.getPrincipal());
 | 
	
		
			
				|  |  | +				assertEquals(
 | 
	
		
			
				|  |  | +						this.expectedAuthenticationPrincipal + " does not equal "
 | 
	
		
			
				|  |  | +								+ context.getAuthentication().getPrincipal(),
 | 
	
		
			
				|  |  | +						this.expectedAuthenticationPrincipal,
 | 
	
		
			
				|  |  | +						context.getAuthentication().getPrincipal());
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  			if (this.expectedAuthenticationName != null) {
 | 
	
	
		
			
				|  | @@ -126,8 +128,9 @@ public final class SecurityMockMvcResultMatchers {
 | 
	
		
			
				|  |  |  				assertTrue("Authentication cannot be null", auth != null);
 | 
	
		
			
				|  |  |  				Collection<? extends GrantedAuthority> authorities = auth
 | 
	
		
			
				|  |  |  						.getAuthorities();
 | 
	
		
			
				|  |  | -				assertTrue(authorities + " does not contain the same authorities as "
 | 
	
		
			
				|  |  | -						+ this.expectedGrantedAuthorities,
 | 
	
		
			
				|  |  | +				assertTrue(
 | 
	
		
			
				|  |  | +						authorities + " does not contain the same authorities as "
 | 
	
		
			
				|  |  | +								+ this.expectedGrantedAuthorities,
 | 
	
		
			
				|  |  |  						authorities.containsAll(this.expectedGrantedAuthorities));
 | 
	
		
			
				|  |  |  				assertTrue(this.expectedGrantedAuthorities
 | 
	
		
			
				|  |  |  						+ " does not contain the same authorities as " + authorities,
 | 
	
	
		
			
				|  | @@ -195,7 +198,8 @@ public final class SecurityMockMvcResultMatchers {
 | 
	
		
			
				|  |  |  		 * @param expected the {@link Authentication#getAuthorities()}
 | 
	
		
			
				|  |  |  		 * @return the {@link AuthenticatedMatcher} for further customization
 | 
	
		
			
				|  |  |  		 */
 | 
	
		
			
				|  |  | -		public AuthenticatedMatcher withAuthorities(Collection<? extends GrantedAuthority> expected) {
 | 
	
		
			
				|  |  | +		public AuthenticatedMatcher withAuthorities(
 | 
	
		
			
				|  |  | +				Collection<? extends GrantedAuthority> expected) {
 | 
	
		
			
				|  |  |  			this.expectedGrantedAuthorities = expected;
 | 
	
		
			
				|  |  |  			return this;
 | 
	
		
			
				|  |  |  		}
 |