@Test public void testBind() { final String messageId = DirectoryNotEmptyException.class.getName() + ".0"; final String uuid = randomUUID().toString(); final String message = Messages.bind(messageId, uuid); logger.debug("Message: {}", message); assertNotNull(message); assertTrue(message.contains(uuid)); assertFalse(message.contains(messageId)); }
public static String bind(final String msgId, final Object... args) { final String pattern = getMessage(msgId); if (null == pattern) { final StringJoiner joiner = new StringJoiner(","); stream(args).map(Object::toString).forEach(joiner::add); return "!!" + msgId + "!!: " + joiner.toString(); } return MessageFormat.format(pattern, args); }
Messages { public static String bind(final String msgId, final Object... args) { final String pattern = getMessage(msgId); if (null == pattern) { final StringJoiner joiner = new StringJoiner(","); stream(args).map(Object::toString).forEach(joiner::add); return "!!" + msgId + "!!: " + joiner.toString(); } return MessageFormat.format(pattern, args); } }
Messages { public static String bind(final String msgId, final Object... args) { final String pattern = getMessage(msgId); if (null == pattern) { final StringJoiner joiner = new StringJoiner(","); stream(args).map(Object::toString).forEach(joiner::add); return "!!" + msgId + "!!: " + joiner.toString(); } return MessageFormat.format(pattern, args); }  }
Messages { public static String bind(final String msgId, final Object... args) { final String pattern = getMessage(msgId); if (null == pattern) { final StringJoiner joiner = new StringJoiner(","); stream(args).map(Object::toString).forEach(joiner::add); return "!!" + msgId + "!!: " + joiner.toString(); } return MessageFormat.format(pattern, args); }  static boolean exists(final String msgId); static String getMessage(final String msgId); static String bind(final String msgId, final Object... args); }
Messages { public static String bind(final String msgId, final Object... args) { final String pattern = getMessage(msgId); if (null == pattern) { final StringJoiner joiner = new StringJoiner(","); stream(args).map(Object::toString).forEach(joiner::add); return "!!" + msgId + "!!: " + joiner.toString(); } return MessageFormat.format(pattern, args); }  static boolean exists(final String msgId); static String getMessage(final String msgId); static String bind(final String msgId, final Object... args);  }