### Question:
ShiroAuthToken implements AuthenticationToken { @Override public String toString() { if ( authToken.isEmpty() ) { return "{}"; } List<String> keys = new ArrayList<>( authToken.keySet() ); int schemeIndex = keys.indexOf( AuthToken.SCHEME_KEY ); if ( schemeIndex > 0 ) { keys.set( schemeIndex, keys.get( 0 ) ); keys.set( 0, AuthToken.SCHEME_KEY ); } return keys.stream() .map( this::keyValueString ) .collect( joining( PAIR_DELIMITER, "{ ", " }" ) ); } ShiroAuthToken( Map<String,Object> authToken ); @Override Object getPrincipal(); @Override Object getCredentials(); String getScheme(); String getSchemeSilently(); Map<String,Object> getAuthTokenMap(); boolean supportsRealm( String realm ); @Override String toString();  }### Answer:
@Test public void shouldHaveStringRepresentationWithNullRealm() throws Exception { ShiroAuthToken token = new ShiroAuthToken( AuthToken.newBasicAuthToken( USERNAME, PASSWORD, null ) ); testBasicAuthToken( token, USERNAME, PASSWORD, AuthToken.BASIC_SCHEME ); String stringRepresentation = token.toString(); assertThat( stringRepresentation, containsString( "realm='null'" ) ); }