### Question:
ReferenceAttributeConverter implements AttributeConverter<Reference, String> { @Override public Reference convertToEntityAttribute( String dbData ) { if ( dbData == null ) { return null; } final int index = dbData.indexOf( SEPARATOR ); if ( (index <= 0) || (index + 1 == dbData.length()) ) { throw new IllegalArgumentException( "Reference does not include required separator: " + dbData ); } return new Reference( dbData.substring( index + 1 ), NameUtils.toEnumValue( ReferenceType.class, dbData.substring( 0, index ) ) ); }  @Override String convertToDatabaseColumn( Reference attribute ); @Override Reference convertToEntityAttribute( String dbData ); static final String SEPARATOR; }### Answer:
@Test public void convertToEntityAttributeNull() { Assert.assertNull( converter.convertToEntityAttribute( null ) ); }
@Test public void convertToEntityAttribute() { Assert.assertEquals( new Reference( "678", ReferenceType.CODE ), converter.convertToEntityAttribute( "CODE:678" ) ); }
@Test( expected = IllegalArgumentException.class ) public void convertToEntityAttributeInvalidCode() { converter.convertToEntityAttribute( "COD:678" ); }
@Test( expected = IllegalArgumentException.class ) public void convertToEntityAttributeInvalidValue() { converter.convertToEntityAttribute( "COD:" ); }
@Test( expected = IllegalArgumentException.class ) public void convertToEntityAttributeInvalid() { converter.convertToEntityAttribute( "CODE678" ); }