Search in sources :

Example 6 with FloatProperty

use of io.swagger.models.properties.FloatProperty in project swagger-core by swagger-api.

the class FloatPropertyTest method testEquals.

@Test
public void testEquals() {
    final FloatProperty prop1 = new FloatProperty();
    prop1.setName(PROP_1);
    prop1.setRequired(true);
    final FloatProperty prop2 = new FloatProperty();
    prop2.setName(PROP_2);
    assertNotEquals(prop1, prop2);
    prop2.setName(PROP_1);
    prop2.setRequired(true);
    assertEquals(prop1, prop2);
}
Also used : FloatProperty(io.swagger.models.properties.FloatProperty) Test(org.testng.annotations.Test)

Example 7 with FloatProperty

use of io.swagger.models.properties.FloatProperty in project swagger-parser by swagger-api.

the class ModelPropertyConverterTest method convertFloatModelProperty.

@Test
public void convertFloatModelProperty() throws Exception {
    ModelProperty property = new ModelProperty();
    property.setType("number");
    property.setFormat(Format.FLOAT);
    property.setDescription("a simple float property");
    property.setMinimum("1.23");
    property.setMaximum("4.56");
    Property converted = converter.convertProperty(property);
    assertEquals(converted.getClass(), FloatProperty.class);
    assertEquals(converted.getType(), "number");
    assertEquals(converted.getFormat(), "float");
    FloatProperty prop = (FloatProperty) converted;
    assertEquals(prop.getMinimum(), new BigDecimal("1.23"));
    assertEquals(prop.getMaximum(), new BigDecimal("4.56"));
}
Also used : ModelProperty(io.swagger.models.apideclaration.ModelProperty) FloatProperty(io.swagger.models.properties.FloatProperty) DoubleProperty(io.swagger.models.properties.DoubleProperty) FloatProperty(io.swagger.models.properties.FloatProperty) StringProperty(io.swagger.models.properties.StringProperty) ArrayProperty(io.swagger.models.properties.ArrayProperty) DateTimeProperty(io.swagger.models.properties.DateTimeProperty) IntegerProperty(io.swagger.models.properties.IntegerProperty) ModelProperty(io.swagger.models.apideclaration.ModelProperty) LongProperty(io.swagger.models.properties.LongProperty) RefProperty(io.swagger.models.properties.RefProperty) Property(io.swagger.models.properties.Property) BigDecimal(java.math.BigDecimal) Test(org.testng.annotations.Test)

Aggregations

FloatProperty (io.swagger.models.properties.FloatProperty)7 ArrayProperty (io.swagger.models.properties.ArrayProperty)5 DoubleProperty (io.swagger.models.properties.DoubleProperty)5 IntegerProperty (io.swagger.models.properties.IntegerProperty)5 LongProperty (io.swagger.models.properties.LongProperty)5 StringProperty (io.swagger.models.properties.StringProperty)5 Property (io.swagger.models.properties.Property)4 RefProperty (io.swagger.models.properties.RefProperty)4 Test (org.testng.annotations.Test)4 BooleanProperty (io.swagger.models.properties.BooleanProperty)3 Response (io.swagger.models.Response)2 DateTimeProperty (io.swagger.models.properties.DateTimeProperty)2 ArrayList (java.util.ArrayList)2 ArrayModel (io.swagger.models.ArrayModel)1 Operation (io.swagger.models.Operation)1 Path (io.swagger.models.Path)1 RefModel (io.swagger.models.RefModel)1 ModelProperty (io.swagger.models.apideclaration.ModelProperty)1 AbstractSerializableParameter (io.swagger.models.parameters.AbstractSerializableParameter)1 BodyParameter (io.swagger.models.parameters.BodyParameter)1