Skip to content

Commit

Permalink
More assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
George Nyakundi committed Oct 24, 2023
1 parent 49fba35 commit 71db033
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,18 @@ public void testFromModel() {
final MapSchema mapSchema = new MapSchema();
mapSchema.additionalProperties(objectSchema);

final MapSchema mapSchema1 = new MapSchema();
mapSchema1.setDescription("Sample ObjectSchema");
mapSchema1.additionalProperties(new StringSchema());

final Schema schema = new Schema()
.description("a sample model")
.addProperty("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT))
.addProperty("name", new StringSchema())
.addProperty("content", objectSchema)
.addProperty("nested", nestedArraySchema)
.addProperty("map", mapSchema)
.addProperty("secondMap", mapSchema1)
.addRequiredItem("id")
.addRequiredItem("name")
.name("sample")
Expand All @@ -204,7 +209,7 @@ public void testFromModel() {
assertEquals(cm.name, "sample");
assertEquals(cm.classname, "Sample");
assertEquals(cm.description, "a sample model");
assertEquals(cm.vars.size(), 5);
assertEquals(cm.vars.size(), 6);
assertEquals(cm.getDiscriminatorName(),"test");

final CodegenProperty property1 = cm.vars.get(0);
Expand Down Expand Up @@ -257,8 +262,21 @@ public void testFromModel() {
assertFalse(property5.required);
assertTrue(property5.isContainer);
assertTrue(property5.isFreeFormObject);
assertTrue(property5.isMap);
assertTrue(property5.items.isFreeFormObject);

final CodegenProperty property6 = cm.vars.get(5);
assertEquals(property6.baseName, "secondMap");
assertEquals(property6.dataType, "[String: String]");
assertEquals(property6.name, "secondMap");
assertNull(property6.defaultValue);
assertEquals(property6.baseType, "Dictionary");
assertFalse(property6.required);
assertTrue(property6.isContainer);
assertTrue(property6.isMap);
assertFalse(property6.isFreeFormObject);
assertFalse(property6.items.isFreeFormObject);

}

@Test
Expand Down

0 comments on commit 71db033

Please sign in to comment.