Package org.springframework.context.support

Examples of org.springframework.context.support.StaticMessageSource.addMessage()


    @BeforeClass
    public static void setUpClass() throws Exception {
        translator = new TranslatorImpl();
        StaticMessageSource messageSource = new StaticMessageSource();
        messageSource.addMessage(message, en, "First test");
        messageSource.addMessage(message, es, "Primer test");
        messageSource.addMessage("test.other", es, "Otro test");
        translator.setMessageSource(messageSource);
    }
View Full Code Here


    @BeforeClass
    public static void setUpClass() throws Exception {
        translator = new TranslatorImpl();
        StaticMessageSource messageSource = new StaticMessageSource();
        messageSource.addMessage(message, en, "First test");
        messageSource.addMessage(message, es, "Primer test");
        messageSource.addMessage("test.other", es, "Otro test");
        translator.setMessageSource(messageSource);
    }

    @Test
View Full Code Here

    public static void setUpClass() throws Exception {
        translator = new TranslatorImpl();
        StaticMessageSource messageSource = new StaticMessageSource();
        messageSource.addMessage(message, en, "First test");
        messageSource.addMessage(message, es, "Primer test");
        messageSource.addMessage("test.other", es, "Otro test");
        translator.setMessageSource(messageSource);
    }

    @Test
    public void testTranslate() {
View Full Code Here

public class DefaultMessageContextTests extends TestCase {
  private DefaultMessageContext context;

  protected void setUp() {
    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("message", Locale.getDefault(), "Hello world resolved!");
    messageSource.addMessage("argmessage", Locale.getDefault(), "Hello world {0}!");
    context = new DefaultMessageContext(messageSource);
  }

  public void testCreateMessageContext() {
View Full Code Here

  private DefaultMessageContext context;

  protected void setUp() {
    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("message", Locale.getDefault(), "Hello world resolved!");
    messageSource.addMessage("argmessage", Locale.getDefault(), "Hello world {0}!");
    context = new DefaultMessageContext(messageSource);
  }

  public void testCreateMessageContext() {
    context.addMessage(new MessageBuilder().defaultText("Hello world!").build());
View Full Code Here

import org.springframework.validation.MapBindingResult;

public class MessageContextErrorsTests extends TestCase {
  public void testReject() {
    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("foo", Locale.getDefault(), "bar");
    messageSource.addMessage("bar", Locale.getDefault(), "{0}");

    DefaultMessageContext context = new DefaultMessageContext(messageSource);
    Object object = new Object();
    MessageContextErrors errors = new MessageContextErrors(context, "object", object, null, null);
View Full Code Here

public class MessageContextErrorsTests extends TestCase {
  public void testReject() {
    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("foo", Locale.getDefault(), "bar");
    messageSource.addMessage("bar", Locale.getDefault(), "{0}");

    DefaultMessageContext context = new DefaultMessageContext(messageSource);
    Object object = new Object();
    MessageContextErrors errors = new MessageContextErrors(context, "object", object, null, null);
    errors.reject("foo");
View Full Code Here

    assertEquals(Severity.ERROR, msg.getSeverity());
  }

  public void testRejectValue() {
    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("foo", Locale.getDefault(), "bar");
    messageSource.addMessage("bar", Locale.getDefault(), "{0}");

    DefaultMessageContext context = new DefaultMessageContext(messageSource);
    Object object = new Object();
    MessageContextErrors errors = new MessageContextErrors(context, "object", object, null, null);
View Full Code Here

  }

  public void testRejectValue() {
    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("foo", Locale.getDefault(), "bar");
    messageSource.addMessage("bar", Locale.getDefault(), "{0}");

    DefaultMessageContext context = new DefaultMessageContext(messageSource);
    Object object = new Object();
    MessageContextErrors errors = new MessageContextErrors(context, "object", object, null, null);
    errors.rejectValue("field", "foo");
View Full Code Here

    assertEquals(Severity.ERROR, msg.getSeverity());
  }

  public void testAddAllErrors() {
    StaticMessageSource messageSource = new StaticMessageSource();
    messageSource.addMessage("foo", Locale.getDefault(), "bar");
    messageSource.addMessage("bar", Locale.getDefault(), "{0}");

    DefaultMessageContext context = new DefaultMessageContext(messageSource);
    Object object = new Object();
    MessageContextErrors errors = new MessageContextErrors(context, "object", object, null, null);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.