@Test
public void nestedFieldIsType() {

    final DescriptorProtos.FileDescriptorProto file = TestRecordsDoubleNestedProto.getDescriptor().toProto();
    assertEquals(FieldTypeMatch.MATCHES,
            fieldIsType(file, "OuterRecord", "inner", "OuterRecord.MiddleRecord.InnerRecord"));
    assertEquals(FieldTypeMatch.MATCHES,
            fieldIsType(file, "OuterRecord", "inner", ".com.apple.foundationdb.record.test.doublenested.OuterRecord.MiddleRecord.InnerRecord"));
    assertEquals(FieldTypeMatch.MATCHES_AS_NESTED,
            fieldIsType(file, "OuterRecord", "inner", "OuterRecord"));
    assertEquals(FieldTypeMatch.MATCHES_AS_NESTED,
            fieldIsType(file, "OuterRecord", "inner", "OuterRecord.MiddleRecord"));
    assertEquals(FieldTypeMatch.MATCHES_AS_NESTED,
            fieldIsType(file, "OuterRecord", "inner", ".com.apple.foundationdb.record.test.doublenested.OuterRecord"));
    assertEquals(FieldTypeMatch.MATCHES_AS_NESTED,
            fieldIsType(file, "OuterRecord", "inner", ".com.apple.foundationdb.record.test.doublenested.OuterRecord.MiddleRecord"));
    assertEquals(FieldTypeMatch.MATCHES,
            fieldIsType(file, "MiddleRecord", "middle", "MiddleRecord"));
    assertEquals(FieldTypeMatch.DOES_NOT_MATCH,
            fieldIsType(file, "MiddleRecord", "middle", "OuterRecord.MiddleRecord"));
    assertEquals(FieldTypeMatch.DOES_NOT_MATCH,
            fieldIsType(file, "MiddleRecord", "other_middle", "MiddleRecord"));
    assertEquals(FieldTypeMatch.MATCHES,
            fieldIsType(file, "MiddleRecord", "other_middle", "OuterRecord.MiddleRecord"));
}