Search in sources :

Example 1 with BooleanProperty

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

the class BooleanPropertyTest method testEquals.

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

Example 2 with BooleanProperty

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

the class ModelPropertyTest method testIssue1743.

@Test
public void testIssue1743() {
    final Map<String, Model> models = ModelConverters.getInstance().readAll(ModelWithBooleanProperty.class);
    final Model model = models.get("ModelWithBooleanProperty");
    assertNotNull(model);
    BooleanProperty bp = (BooleanProperty) model.getProperties().get("isGreat");
    assertTrue(bp.getEnum().size() == 1);
    assertEquals(bp.getEnum().get(0), Boolean.TRUE);
}
Also used : ModelWithBooleanProperty(io.swagger.models.ModelWithBooleanProperty) BooleanProperty(io.swagger.models.properties.BooleanProperty) Model(io.swagger.models.Model) Test(org.testng.annotations.Test)

Example 3 with BooleanProperty

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

the class ResponseTest method testHeader.

@Test
public void testHeader() {
    // given
    Response response = new Response();
    String name = "name";
    Property property = new BooleanProperty();
    // when
    response.header(name, property);
    // then
    assertEquals(response.getHeaders().get("name"), property, "The retrieved property must be the same as the set one");
}
Also used : BooleanProperty(io.swagger.models.properties.BooleanProperty) BooleanProperty(io.swagger.models.properties.BooleanProperty) Property(io.swagger.models.properties.Property) Test(org.testng.annotations.Test)

Example 4 with BooleanProperty

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

the class AbstractSerializableParameterTest method testGetDefaultWithBooleanProperty.

@Test
public void testGetDefaultWithBooleanProperty() {
    // given
    instance.setProperty(new BooleanProperty());
    defaultValue = true;
    // when
    instance.setDefault(defaultValue);
    // then
    assertEquals(instance.getDefault(), true, "The get default must be the same as the set one");
}
Also used : BooleanProperty(io.swagger.models.properties.BooleanProperty) Test(org.testng.annotations.Test)

Example 5 with BooleanProperty

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

the class AbstractSerializableParameterTest method testGetExampleWithBooleanProperty.

@Test
public void testGetExampleWithBooleanProperty() {
    // given
    instance.setProperty(new BooleanProperty());
    example = "true";
    // when
    instance.setExample(example);
    assertEquals(instance.getExample(), true, "The get example must be the same as the set one");
}
Also used : BooleanProperty(io.swagger.models.properties.BooleanProperty) Test(org.testng.annotations.Test)

Aggregations

BooleanProperty (io.swagger.models.properties.BooleanProperty)14 Property (io.swagger.models.properties.Property)8 StringProperty (io.swagger.models.properties.StringProperty)8 Test (org.testng.annotations.Test)8 ArrayProperty (io.swagger.models.properties.ArrayProperty)7 IntegerProperty (io.swagger.models.properties.IntegerProperty)7 LongProperty (io.swagger.models.properties.LongProperty)4 RefProperty (io.swagger.models.properties.RefProperty)4 DoubleProperty (io.swagger.models.properties.DoubleProperty)3 FloatProperty (io.swagger.models.properties.FloatProperty)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Model (io.swagger.models.Model)2 RefModel (io.swagger.models.RefModel)2 Response (io.swagger.models.Response)2 BodyParameter (io.swagger.models.parameters.BodyParameter)2 PathParameter (io.swagger.models.parameters.PathParameter)2 DateTimeProperty (io.swagger.models.properties.DateTimeProperty)2 DecimalProperty (io.swagger.models.properties.DecimalProperty)2 BigDecimal (java.math.BigDecimal)2