Package br.com.caelum.vraptor.validator

Examples of br.com.caelum.vraptor.validator.SingletonResourceBundle


   
    Container container = mock(Container.class);
    when(container.instanceFor(JSONSerialization.class)).thenReturn(jsonSerialization);
    when(container.instanceFor(XMLSerialization.class)).thenReturn(xmlSerialization);
   
    MockLocalization mockLocalization = new MockLocalization(new SingletonResourceBundle("message.cat", "Just another {0} in {1}"));

    serialization = new I18nMessageSerialization(container , mockLocalization);
 
  }
View Full Code Here


  @Test
  public void shouldSerializeErrorMessages() throws Exception {
    Message normal = new ValidationMessage("The message", "category");
    I18nMessage i18ned = new I18nMessage("category", "message");
    i18ned.setBundle(new SingletonResourceBundle("message", "Something else"));
   
    MockSerializationResult result = new MockSerializationResult(XStreamBuilderImpl.cleanInstance(new MessageConverter()));
    DefaultStatus status = new DefaultStatus(response, result, config, new JavassistProxifier(new ObjenesisInstanceCreator()), router);
   
    status.badRequest(Lists.newArrayList(normal, i18ned));
View Full Code Here

  }
  @Test
  public void shouldSerializeErrorMessagesInJSON() throws Exception {
    Message normal = new ValidationMessage("The message", "category");
    I18nMessage i18ned = new I18nMessage("category", "message");
    i18ned.setBundle(new SingletonResourceBundle("message", "Something else"));

    MockSerializationResult result = new MockSerializationResult(XStreamBuilderImpl.cleanInstance(new MessageConverter())) {
      @Override
      public <T extends View> T use(Class<T> view) {
        return view.cast(new DefaultRepresentationResult(new FormatResolver() {
View Full Code Here

    Container container = mock(Container.class);
    when(container.instanceFor(JSONSerialization.class)).thenReturn(jsonSerialization);
    when(container.instanceFor(XMLSerialization.class)).thenReturn(xmlSerialization);

    ResourceBundle bundle = new SingletonResourceBundle("message.cat", "Just another {0} in {1}");
    serialization = new I18nMessageSerialization(container , bundle);
  }
View Full Code Here

  @Test
  public void shouldSerializeErrorMessages() throws Exception {
    Message normal = new SimpleMessage("category", "The message");
    I18nMessage i18ned = new I18nMessage("category", "message");
    i18ned.setBundle(new SingletonResourceBundle("message", "Something else"));

    XStreamBuilder xstreamBuilder = cleanInstance(new MessageConverter());
    MockSerializationResult result = new MockSerializationResult(null, xstreamBuilder, null, null);
    DefaultStatus status = new DefaultStatus(response, result, config, new JavassistProxifier(), router);
View Full Code Here

  @Test
  public void shouldSerializeErrorMessagesInJSON() throws Exception {
    Message normal = new SimpleMessage("category", "The message");
    I18nMessage i18ned = new I18nMessage("category", "message");
    i18ned.setBundle(new SingletonResourceBundle("message", "Something else"));

    List<JsonSerializer<?>> gsonSerializers = new ArrayList<>();
    List<JsonDeserializer<?>> gsonDeserializers = new ArrayList<>();
    gsonSerializers.add(new MessageGsonConverter());
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.validator.SingletonResourceBundle

Copyright © 2018 www.massapicom. 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.