CustomPrincipal extends KafkaPrincipal { @Override public String toString() { return "CustomPrincipal{" + "oauthBearerTokenJwt=" + oauthBearerTokenJwt + "} " + super.toString(); } CustomPrincipal(String principalType, String name); OAuthBearerTokenJwt getOauthBearerTokenJwt(); void setOauthBearerTokenJwt(OAuthBearerTokenJwt oauthBearerTokenJwt); @Override String toString();  }
@Test public void toStringTest() { CustomPrincipal customPrincipal = new CustomPrincipal("User", "TEST"); OAuthBearerTokenJwt jwt = new OAuthBearerTokenJwt("token", 1, 1, "User"); customPrincipal.setOauthBearerTokenJwt(jwt); assertTrue(customPrincipal.toString().equals("CustomPrincipal{oauthBearerTokenJwt=OauthBearerTokenJwt {value='token', lifetimeMs=1001, " + "principalName='User', startTimeMs=1, scope=null, expirationTime=1001, jti='null'}} User:TEST")); }