AmbariAuthentication implements Authentication, UserIdAuthentication { @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authentication.getAuthorities(); } AmbariAuthentication(Authentication authentication, Integer userId); @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override Object getCredentials(); @Override Object getDetails(); @Override Object getPrincipal(); @Override boolean isAuthenticated(); @Override void setAuthenticated(boolean isAuthenticated); @Override String getName(); @Override boolean equals(Object o); @Override int hashCode(); @Override Integer getUserId();  }
@Test public void testGetAuthorities() throws Exception { Authentication authentication = new TestingAuthenticationToken("user", "password", "test_role"); Authentication ambariAuthentication = new AmbariAuthentication(authentication, DEFAULT_USER_ID); Collection<?> grantedAuthorities = ambariAuthentication.getAuthorities(); Collection<?> expectedAuthorities = authentication.getAuthorities(); assertSame(expectedAuthorities, grantedAuthorities); }