@Test
public void testConjureFieldDeprecation() {

    ConjureSourceFile conjure = ConjureParser.parse(new File("src/test/resources/example-deprecation.yml"));
    ObjectTypeDefinition object = conjure.types()
            .definitions()
            .objects()
            .get(TypeName.of("BeanWithDeprecatedField"))
            .visit(new TypeDefinitionVisitor<ObjectTypeDefinition>() {
                @Override
                public ObjectTypeDefinition visit(AliasTypeDefinition _def) {
                    throw new SafeIllegalArgumentException("Expected ObjectTypeDefinition");
                }
                @Override
                public ObjectTypeDefinition visit(EnumTypeDefinition _def) {
                    throw new SafeIllegalArgumentException("Expected ObjectTypeDefinition");
                }
                @Override
                public ObjectTypeDefinition visit(ObjectTypeDefinition def) {
                    return def;
                }
                @Override
                public ObjectTypeDefinition visit(UnionTypeDefinition _def) {
                    throw new SafeIllegalArgumentException("Expected ObjectTypeDefinition");
                }
            });
    assertThat(object.fields().get(FieldName.of("old")).deprecated()).hasValue("Test deprecated.");
}