@Test
public void shouldCreateCorrectSchemaFromInsertJson() {

    for (Entry<String, BsonValue> entry : val.entrySet()) {
        converter.addFieldSchema(entry, builder);
    }
    Schema finalSchema = builder.build();
    assertThat(finalSchema).isEqualTo(
            SchemaBuilder.struct().name("pub")
                    .field("address", SchemaBuilder.struct().name("pub.address").optional()
                            .field("building", Schema.OPTIONAL_STRING_SCHEMA)
                            .field("floor", SchemaBuilder.struct().name("pub.address.floor").optional()
                                    .field("level", Schema.OPTIONAL_INT32_SCHEMA)
                                    .field("description", Schema.OPTIONAL_STRING_SCHEMA)
                                    .build())
                            .field("coord", SchemaBuilder.array(Schema.OPTIONAL_FLOAT64_SCHEMA).optional().build())
                            .field("street", Schema.OPTIONAL_STRING_SCHEMA)
                            .field("zipcode", Schema.OPTIONAL_STRING_SCHEMA)
                            .build())
                    .field("borough", Schema.OPTIONAL_STRING_SCHEMA)
                    .field("cuisine", Schema.OPTIONAL_STRING_SCHEMA)
                    .field("grades", SchemaBuilder.array(SchemaBuilder.struct().name("pub.grades").optional()
                            .field("date", Timestamp.builder().optional().build())
                            .field("grade", Schema.OPTIONAL_STRING_SCHEMA)
                            .field("score", Schema.OPTIONAL_INT32_SCHEMA)
                            .build())
                            .optional()
                            .build())
                    .field("name", Schema.OPTIONAL_STRING_SCHEMA)
                    .field("restaurant_id", Schema.OPTIONAL_STRING_SCHEMA)
                    .build());
}