MessageBase implements Message<T, R> { @NonNull protected static String logParam(Object parameter, int level) { if (level == SecureParameter.LEVEL_NO_INFO) { return "<value>"; } if (parameter == null) { return "null"; } if (parameter instanceof CharSequence) { if (TextUtils.isEmpty((CharSequence) parameter)) { return "''"; } if (level == SecureParameter.LEVEL_NULL_OR_EMPTY_STRING) { return "<not empty string>"; } return "'" + parameter + "'"; } if (level != SecureParameter.LEVEL_FULL_INFO) { return "<not null value>"; } return String.valueOf(parameter); } protected  MessageBase(@NonNull ActorInvokeException exception); @NonNull @Override ActorInvokeException exception();  }
@Test public void logParam_value_primitiveLevelNoInfo() { Assert.assertEquals("<value>", MessageBase.logParam(10, SecureParameter.LEVEL_NO_INFO)); }
@Test public void logParam_value_objectNoSecurityLevel() { Object value = new Object() { @Override public String toString() { return "{Test object}"; } }; Assert.assertEquals("{Test object}", MessageBase.logParam(value, SecureParameter.LEVEL_FULL_INFO)); }
@Test public void logParam_value_objectLevelBasicInfo() { Object value = new Object() { @Override public String toString() { return "{Test object}"; } }; Assert.assertEquals("<not null value>", MessageBase.logParam(value, SecureParameter.LEVEL_NULL_OR_EMPTY_STRING)); }
@Test public void logParam_value_objectLevelNoInfo() { Object value = new Object() { @Override public String toString() { return "{Test object}"; } }; Assert.assertEquals("<value>", MessageBase.logParam(value, SecureParameter.LEVEL_NO_INFO)); }
@Test public void logParam_value_notEmptyCharSequenceNoSecurityLevel() { StringBuilder value = new StringBuilder("Test string"); Assert.assertEquals("'Test string'", MessageBase.logParam(value, SecureParameter.LEVEL_FULL_INFO)); }
@Test public void logParam_value_notEmptyCharSequenceLevelBasicInfo() { StringBuilder value = new StringBuilder("Test string"); Assert.assertEquals("<not empty string>", MessageBase.logParam(value, SecureParameter.LEVEL_NULL_OR_EMPTY_STRING)); }
@Test public void logParam_value_notEmptyCharSequenceLevelNoInfo() { StringBuilder value = new StringBuilder("Test string"); Assert.assertEquals("<value>", MessageBase.logParam(value, SecureParameter.LEVEL_NO_INFO)); }
@Test public void logParam_value_emptyCharSequenceNoSecurityLevel() { StringBuilder value = new StringBuilder(); Assert.assertEquals("''", MessageBase.logParam(value, SecureParameter.LEVEL_FULL_INFO)); }
@Test public void logParam_value_emptyCharSequenceLevelBasicInfo() { StringBuilder value = new StringBuilder(); Assert.assertEquals("''", MessageBase.logParam(value, SecureParameter.LEVEL_NULL_OR_EMPTY_STRING)); }
@Test public void logParam_value_emptyCharSequenceLevelNoInfo() { StringBuilder value = new StringBuilder(); Assert.assertEquals("<value>", MessageBase.logParam(value, SecureParameter.LEVEL_NO_INFO)); }
@Test public void logParam_value_nullNoSecurityLevel() { Assert.assertEquals("null", MessageBase.logParam(null, SecureParameter.LEVEL_FULL_INFO)); }
@Test public void logParam_value_nullLevelBasicInfo() { Assert.assertEquals("null", MessageBase.logParam(null, SecureParameter.LEVEL_NULL_OR_EMPTY_STRING)); }
@Test public void logParam_value_nullLevelNoInfo() { Assert.assertEquals("<value>", MessageBase.logParam(null, SecureParameter.LEVEL_NO_INFO)); }
@Test public void logParam_value_primitiveNoSecurityLevel() { Assert.assertEquals("10", MessageBase.logParam(10, SecureParameter.LEVEL_FULL_INFO)); }
@Test public void logParam_value_primitiveLevelBasicInfo() { Assert.assertEquals("<not null value>", MessageBase.logParam(10, SecureParameter.LEVEL_NULL_OR_EMPTY_STRING)); }