Package org.jboss.resteasy.api.validation

Examples of org.jboss.resteasy.api.validation.ResteasyViolationException


      ClientResponse<?> response = request.get();
      String answer = response.getEntity(String.class);
      log.info("status: " + response.getStatus());
      log.info("entity: " + answer);
      assertEquals(500, response.getStatus());
      ResteasyViolationException e = new ResteasyViolationException(answer);
      countViolations(e, 1, 0, 0, 0, 0, 1);
      ResteasyConstraintViolation cv = e.getReturnValueViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 17"));
   }
View Full Code Here


      ClientResponse<?> response = request.get();
      String answer = response.getEntity(String.class);
      log.info("status: " + response.getStatus());
      log.info("entity: " + answer);
      assertEquals(400, response.getStatus());
      ResteasyViolationException e = new ResteasyViolationException(String.class.cast(answer));
      countViolations(e, 3, 1, 1, 1, 0, 0);
      ResteasyConstraintViolation cv = e.getFieldViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 3"));
      cv = e.getPropertyViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 5"));
      cv = e.getClassViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().indexOf("org.jboss.resteasy.ejb.validation.SumConstraint") > 0);
   }
View Full Code Here

      ClientResponse<?> response = request.get();
      String answer = response.getEntity(String.class);
      log.info("status: " + response.getStatus());
      log.info("entity: " + answer);
      assertEquals(400, response.getStatus());
      ResteasyViolationException e = new ResteasyViolationException(String.class.cast(answer));
      countViolations(e, 3, 1, 1, 1, 0, 0);
      ResteasyConstraintViolation cv = e.getFieldViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 3"));
      cv = e.getPropertyViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 5"));
      cv = e.getClassViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().indexOf("org.jboss.resteasy.ejb.validation.SumConstraint") > 0);
   }
View Full Code Here

      ClientResponse<?> response = request.get();
      System.out.println("Status: " + response.getStatus());
      System.out.println("Result: " + response.getEntity(String.class));
      String answer = response.getEntity(String.class);
      assertEquals(400, response.getStatus());
      ResteasyViolationException e = new ResteasyViolationException(answer);
      countViolations(e, 1, 0, 0, 0, 1, 0);
      ResteasyConstraintViolation cv = e.getParameterViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 7"));
   }
View Full Code Here

      ClientResponse<?> response = request.get();
      String answer = response.getEntity(String.class);
      log.info("status: " + response.getStatus());
      log.info("entity: " + answer);
      assertEquals(400, response.getStatus());
      ResteasyViolationException e = new ResteasyViolationException(String.class.cast(answer));
      countViolations(e, 1, 0, 0, 0, 1, 0);
      ResteasyConstraintViolation cv = e.getParameterViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 7"));
   }
View Full Code Here

      ClientResponse<?> response = request.get();
      String answer = response.getEntity(String.class);
      System.out.println("status: " + response.getStatus());
      System.out.println("entity: " + answer);
      assertEquals(400, response.getStatus());
      ResteasyViolationException e = new ResteasyViolationException(String.class.cast(answer));
      countViolations(e, 1, 0, 0, 0, 1, 0);
      ResteasyConstraintViolation cv = e.getParameterViolations().iterator().next();
      System.out.println(cv.getMessage());
      Assert.assertTrue(cv.getMessage().startsWith("size must be between 4 and"));
      Assert.assertTrue(answer.contains("size must be between 4 and"));
   }
View Full Code Here

      ClientResponse<?> response = request.get();
      System.out.println("Status: " + response.getStatus());
      System.out.println("Result: " + response.getEntity(String.class));
      String answer = response.getEntity(String.class);
      assertEquals(400, response.getStatus());
      ResteasyViolationException e = new ResteasyViolationException(answer);
      countViolations(e, 1, 0, 0, 0, 1, 0);
      ResteasyConstraintViolation cv = e.getParameterViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 7"));
   }
View Full Code Here

      ClientResponse<?> response = request.get();
      String answer = response.getEntity(String.class);
      System.out.println("status: " + response.getStatus());
      System.out.println("entity: " + answer);
      assertEquals(400, response.getStatus());
      ResteasyViolationException e = new ResteasyViolationException(String.class.cast(answer));
      countViolations(e, 1, 0, 0, 0, 1, 0);
      ResteasyConstraintViolation cv = e.getParameterViolations().iterator().next();
      System.out.println(cv.getMessage());
      Assert.assertTrue(cv.getMessage().startsWith("size must be between 4 and"));
      Assert.assertTrue(answer.contains("size must be between 4 and"));
   }
View Full Code Here

      Assert.assertNotNull(header);
      Assert.assertTrue(Boolean.valueOf(header));
      MediaType mediaType = response.getMediaType();
      String entity = response.getEntity(String.class);
      System.out.println("entity: " + entity);
      ResteasyViolationException e = new ResteasyViolationException(entity);
      after();
   }
View Full Code Here

//      request.accept(MediaType.APPLICATION_XML);
//      ClientResponse<?> response = request.get(ViolationReport.class);
//      ViolationReport report = response.getEntity(ViolationReport.class);
      ClientResponse<?> response = request.get();
      String report = response.getEntity(String.class);
      ResteasyViolationException e = new ResteasyViolationException(String.class.cast(report));
      log.info("status: " + response.getStatus());
      log.info("entity: " + report);
      assertEquals(400, response.getStatus());
//      countViolations(report, 1, 0, 0, 0, 1, 0);
//      ResteasyConstraintViolation cv = report.getParameterViolations().iterator().next();
      countViolations(e, 1, 0, 0, 0, 1, 0);
      ResteasyConstraintViolation cv = e.getParameterViolations().iterator().next();
      Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 11"));
   }
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.api.validation.ResteasyViolationException

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.