@Test
public void messageSource() throws IOException {

  String message = "Hola";
  String code = "sayHi";
  String defaultMessage = null;
  // Options
  Object[] params = {};
  @SuppressWarnings("unchecked")
  Map<String, Object> hash = createMock(Map.class);
  expect(hash.get("default")).andReturn(defaultMessage);
  Handlebars hbs = createMock(Handlebars.class);
  Context ctx = createMock(Context.class);
  Template fn = createMock(Template.class);
  Options options = new Options.Builder(hbs, "messageSource", TagType.VAR, ctx, fn)
      .setParams(params)
      .setHash(hash)
      .build();
  MessageSource messageSource = createMock(MessageSource.class);
  expect(messageSource.getMessage(eq(code), eq(params), eq(defaultMessage),
      isA(Locale.class))).andReturn(message);
  replay(messageSource, hash);
  Object result =
      new MessageSourceHelper(messageSource).apply(code, options);
  assertEquals(message, result);
  verify(messageSource, hash);
}