assertEquals(3, recordType.getFieldTypeEntries().size());
}
@Test
public void testRecordTypeBuilderBasics() throws Exception {
RecordTypeBuilder builder = typeManager.recordTypeBuilder();
try {
builder.create();
fail("Exception expected since name of recordType is not specified");
} catch (Exception expected) {
}
QName rtName = new QName("builderNS", "builderName");
builder.name(rtName);
builder.field(fieldType1.getId(), false);
builder.field(fieldType2.getId(), true);
RecordType recordType = builder.create();
RecordType readRecordType = typeManager.getRecordTypeByName(rtName, null);
assertEquals(recordType, readRecordType);
assertFalse(readRecordType.getFieldTypeEntry(fieldType1.getId()).isMandatory());
assertTrue(readRecordType.getFieldTypeEntry(fieldType2.getId()).isMandatory());
builder.reset();
builder.id(recordType.getId());
recordType = builder.update();
readRecordType = typeManager.getRecordTypeByName(rtName, null);
assertEquals(recordType, readRecordType);
assertEquals(Long.valueOf(2), readRecordType.getVersion());
assertNull(readRecordType.getFieldTypeEntry(fieldType1.getId()));
}