assertThat(actual, is(equalTo("test")));
}
@Test
public void shouldSupportTopLevelObjectWithArgumentsWhenBackedWithObjectMessageSource() throws Exception {
ObjectMessageSource objectMessageSource = mock(ObjectMessageSource.class);
MessageSourceMap map = new TestMessageSourceMap(objectMessageSource);
ObjectResolvable resolvable = new ObjectResolvable();
String expected = "test";
given(objectMessageSource.getMessage((Object) eq("y"), emptyObjectArray(), nullLocale())).willReturn("y2");
given(objectMessageSource.getMessage((Object) eq("z"), emptyObjectArray(), nullLocale())).willThrow(
new NoSuchObjectMessageException("z", null));
given(objectMessageSource.getMessage(eq(resolvable), eq(new Object[] { "y2", "z" }), nullLocale())).willReturn(
expected);
String actual = map.get(resolvable, "y", "z").toString();
assertThat(actual, is(equalTo(expected)));
}