use of io.swagger.models.HibernateBeanValidationsModel in project swagger-core by swagger-api.
the class HibernateBeanValidationsTest method readHibernateValidations.
@Test(description = "it should read hibernate validations")
public void readHibernateValidations() {
final Map<String, Model> schemas = ModelConverters.getInstance().readAll(HibernateBeanValidationsModel.class);
final Map<String, Property> properties = schemas.get("HibernateBeanValidationsModel").getProperties();
final IntegerProperty age = (IntegerProperty) properties.get("age");
assertEquals(age.getMinimum().doubleValue(), 13.0, 0.01);
assertEquals(age.getMaximum().doubleValue(), 99.0, 0.01);
final StringProperty password = (StringProperty) properties.get("password");
assertEquals((int) password.getMinLength(), 6);
assertEquals((int) password.getMaxLength(), 20);
assertTrue(((DoubleProperty) properties.get("minBalance")).getExclusiveMinimum());
assertTrue(((DoubleProperty) properties.get("maxBalance")).getExclusiveMaximum());
}
use of io.swagger.models.HibernateBeanValidationsModel in project swagger-core by swagger-api.
the class HibernateBeanValidationsTest method shouldUnderstandNotEmpty.
@Test
public void shouldUnderstandNotEmpty() {
final Map<String, Model> schemas = ModelConverters.getInstance().readAll(HibernateBeanValidationsModel.class);
final Map<String, Property> properties = schemas.get("HibernateBeanValidationsModel").getProperties();
final StringProperty notEmptyString = (StringProperty) properties.get("notEmptyString");
assertEquals((int) notEmptyString.getMinLength(), 1);
final ArrayProperty notEmptyArray = (ArrayProperty) properties.get("notEmptyArray");
assertEquals((int) notEmptyArray.getMinItems(), 1);
}
Aggregations