### Question:
WisdomMessageResolver extends AbstractMessageResolver implements IMessageResolver { @Override public MessageResolution resolveMessage(Arguments arguments, String key, Object[] messageParameters) { Locale[] locales = getLocales(); String message = i18n.get(locales, key, messageParameters); if (message == null) { return null; } return new MessageResolution(message); }  @Override MessageResolution resolveMessage(Arguments arguments, String key, Object[] messageParameters);  }### Answer:
@Test public void testMessageWhenNoI18N() { WisdomMessageResolver resolver = new WisdomMessageResolver(); resolver.i18n = mock(InternationalizationService.class); MessageResolution resolution = resolver.resolveMessage(null, "welcome", null); assertThat(resolution).isNull(); }
@Test public void testMessageWithAI18NButNoMessage() { WisdomMessageResolver resolver = new WisdomMessageResolver(); resolver.i18n = mock(InternationalizationService.class); when(resolver.i18n.get(locales, "welcome", NULL_ARRAY)).thenReturn("welcome"); MessageResolution resolution = resolver.resolveMessage(null, "welcome", null); assertThat(resolution).isNotNull(); assertThat(resolution.getResolvedMessage()).isEqualTo("welcome"); resolution = resolver.resolveMessage(null, "missing", null); assertThat(resolution).isNull(); }
@Test public void testMessageWithParameters() { WisdomMessageResolver resolver = new WisdomMessageResolver(); resolver.i18n = mock(InternationalizationService.class); when(resolver.i18n.get(locales, "welcome", "wisdom")).thenReturn("welcome wisdom"); when(resolver.i18n.get(locales, "welcome", NULL_ARRAY)).thenReturn("welcome"); MessageResolution resolution = resolver.resolveMessage(null, "welcome", null); assertThat(resolution).isNotNull(); assertThat(resolution.getResolvedMessage()).isEqualTo("welcome"); resolution = resolver.resolveMessage(null, "welcome", new Object[] {"wisdom"}); assertThat(resolution).isNotNull(); assertThat(resolution.getResolvedMessage()).isEqualTo("welcome wisdom"); }