Package br.com.caelum.vraptor.validator

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


 
  HttpServletResponse response = mock(HttpServletResponse.class);
  when(response.getWriter()).thenReturn(new PrintWriter(stream));
  DefaultTypeNameExtractor extractor = new DefaultTypeNameExtractor();
    HibernateProxyInitializer initializer = new HibernateProxyInitializer();
    XStreamBuilder builder = XStreamBuilderImpl.cleanInstance(new MessageConverter());
    XStreamJSONSerialization jsonSerialization = new XStreamJSONSerialization(response, extractor, initializer, builder);
    XStreamXMLSerialization xmlSerialization = new XStreamXMLSerialization(response, extractor, initializer, builder);
   
    Container container = mock(Container.class);
    when(container.instanceFor(JSONSerialization.class)).thenReturn(jsonSerialization);
View Full Code Here


  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));
   
    String serialized = result.serializedResult();
View Full Code Here

  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() {
          public String getAcceptFormat() {
            return "json";
View Full Code Here

TOP

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

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.