### Question:
I18nBase { public String formatMessage(String theMessage, Object... theMessageArguments) { String message = theMessage; if (messageExistsForLocale(theMessage, (theMessageArguments != null && theMessageArguments.length > 0))) { if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) { message = MessageFormat.format(i18nMessages.getString(theMessage), theMessageArguments); } else { message = i18nMessages.getString(theMessage); } } return message; }  Locale getLocale(); void setLocale(Locale locale); String formatMessage(String theMessage, Object... theMessageArguments); void setValidationMessageLanguage(Locale locale); boolean isWarnAboutMissingMessages(); void setWarnAboutMissingMessages(boolean warnAboutMissingMessages);  }### Answer:
@Test @DisplayName("Test argument substitution without initializing Locale.") void testFormatMessageWithoutInitLocale() { I18nTestClass testClass = new I18nTestClass(); ResourceBundle loadedBundle = ResourceBundle.getBundle("Messages", Locale.US); String result = testClass.formatMessage(I18nConstants.BUNDLE_BUNDLE_MULTIPLEMATCHES, ARG_1); MessageFormat form = new MessageFormat(loadedBundle.getString(I18nConstants.BUNDLE_BUNDLE_MULTIPLEMATCHES)); Object[] testArgs = {ARG_1}; Assertions.assertEquals(form.format(testArgs), result); }
@Test @DisplayName("Assert no string modification is done when no match is found.") void testFormatMessageForNonExistentMessage() { I18nTestClass testClass = new I18nTestClass(); Assertions.assertEquals(BAD_STRING_ARG, testClass.formatMessage(BAD_STRING_ARG, ARG_1)); }