@Test public void expectedMessageCall() { String testedString = "Some string {change}"; MessageSource mock = mock(MessageSource.class); Locale locale = new Locale("en", mock); Object[] replaceArgs = {"replace"}; locale.message(testedString, replaceArgs); verify(mock, times(1)).getMessage(eq(testedString), eq(replaceArgs), eq(java.util.Locale.ENGLISH)); }
public String message(String s, Object... objects) { return messageSource.getMessage(s, objects, nativeLocale); }
Locale { public String message(String s, Object... objects) { return messageSource.getMessage(s, objects, nativeLocale); } }
Locale { public String message(String s, Object... objects) { return messageSource.getMessage(s, objects, nativeLocale); } @Autowired  Locale(@Value("#{localeCodeSource.code}") String code, MessageSource messageSource); }
Locale { public String message(String s, Object... objects) { return messageSource.getMessage(s, objects, nativeLocale); } @Autowired  Locale(@Value("#{localeCodeSource.code}") String code, MessageSource messageSource); String message(String s, Object... objects); String message(String s); }
Locale { public String message(String s, Object... objects) { return messageSource.getMessage(s, objects, nativeLocale); } @Autowired  Locale(@Value("#{localeCodeSource.code}") String code, MessageSource messageSource); String message(String s, Object... objects); String message(String s);  }