AnonSecurityContext implements SecurityContext { @Override public Principal getUserPrincipal() { return null; } AnonSecurityContext();  AnonSecurityContext(boolean secure); @Override Principal getUserPrincipal(); @Override boolean isUserInRole(String role); @Override boolean isSecure(); @Override String getAuthenticationScheme();  }
@Test public void getUserPrincipal_ShouldAlwaysBeNull() { assertNull(new AnonSecurityContext().getUserPrincipal()); }