AppProperties { @Override public String toString() { return "AppProperties{" + "name='" + name + '\'' + ", uploadPath='" + uploadPath + '\'' + ", appKey='XXXXXX'" + ", maxConcurrentWebSocketConsumers=" + maxConcurrentWebSocketConsumers + ", consumerIdPrefix='" + consumerIdPrefix + '\'' + ", requireSsl='" + requireSsl + '\'' + ", userAuthEnabled='" + userAuthEnabled + '\'' + '}'; }  String getName(); String getUploadPath(); String getAppKey(); Integer getMaxConcurrentWebSocketConsumers(); String getConsumerIdPrefix(); boolean isRequireSsl(); boolean isUserAuthEnabled(); LdapAppProperties getLdapProperties(); boolean isAvroIncludeSchema(); boolean isEnableMultiThreadedConsumer(); Integer getMaxConcurrentWebConsumers(); @Override String toString();  }
@Test public void testToString() throws NoSuchFieldException, IllegalAccessException { final String expectedSecret = "MySuperSecretKey"; final AppProperties appProperties = new AppProperties(); final Field field = appProperties.getClass().getDeclaredField("appKey"); field.setAccessible(true); field.set(appProperties, expectedSecret); final String result = appProperties.toString(); assertFalse("Should not contain our sensitive field", result.contains(expectedSecret)); }