### Question:
ColumnHeaderParser { public EntityTypeField readFieldColumn(String name) { if (StringUtils.isBlank(name)) { throw new MetadataReadingException("Missing column name."); } String[] chunks = name.split(NAME_DELIMITER); if (chunks.length == 1) { return new EntityTypeField(chunks[0]); } else if (chunks.length == PATH_COLUMN_PARTS && chunks[1].equals(PATH_TYPE)) { return new EntityTypeField(chunks[0], PATH_TYPE); } else if (chunks.length == REFERENCE_COLUMN_PARTS) { if (!REFERENCE_SUFFIX.equals(chunks[chunks.length - 1])) { throw new MetadataReadingException("Reference field column must match format: 'Name:Type:ID'."); } return new EntityTypeField(chunks[0], chunks[1], true, false); } else if (chunks.length == MEMBERSHIP_COLUMN_PARTS && MEMBERSHIP_PREFIX.equals(chunks[0])) { if (!REFERENCE_SUFFIX.equals(chunks[chunks.length - 1])) { throw new MetadataReadingException( "Membership field column must match format: 'membership:Name:Type:ID'."); } return new EntityTypeField(chunks[1], chunks[2], true, true); } throw new MetadataReadingException("Unknown field column format"); }  String readClassColumn(String name); EntityTypeField readFieldColumn(String name);  }### Answer:
@Test public void readFieldColumn() throws Exception { EntityTypeField expectedSimple = new EntityTypeField(SIMPLE_ATTRIBUTE, EntityTypeField.DEFAULT_TYPE, false, false); EntityTypeField simpleField = parser.readFieldColumn(SIMPLE_ATTRIBUTE); assertEquals(expectedSimple, simpleField); EntityTypeField expectedReference = new EntityTypeField("patient", "Participant", true, false); EntityTypeField referenceField = parser.readFieldColumn(REFERENCE_ATTRIBUTE); assertEquals(expectedReference, referenceField); EntityTypeField expectedMembership = new EntityTypeField("samples", "SampleSet", true, true); EntityTypeField membershipField = parser.readFieldColumn(MEMBERSHIP_ATTRIBUTE); assertEquals(expectedMembership, membershipField); EntityTypeField expectedPath = new EntityTypeField("read1", "Path", false, false); EntityTypeField pathField = parser.readFieldColumn(PATH_ATTRIBUTE); assertEquals(expectedPath, pathField); }
@Test(expected = MetadataReadingException.class) public void readInvalidColumn() throws Exception { parser.readFieldColumn(INVALID_ATTRIBUTE); }