@Test
@SuppressWarnings ( "unchecked" )
public void getFieldsByContentletField () {
//Getting a known structure
Structure structure = structures.iterator().next();
//Getting the fields for this structure
Collection<Field> fields = FieldsCache.getFieldsByStructureInode( structure.getInode() );
//Validations
assertTrue( fields != null && !fields.isEmpty() );
Iterator<Field> iterator = fields.iterator();
Field field = iterator.next();
//Search by the field contentlet
//TODO: The data type is used everywhere instead the field.getFieldContentlet() as the method name, parameter and even te query suggested...
Collection<Field> fieldsByContentlet = FieldFactory.getFieldsByContentletField( Field.DataType.TEXT.toString(), field.getInode(), structure.getInode() );
//Validations
assertTrue( fieldsByContentlet != null && !fieldsByContentlet.isEmpty() );
//Search by the field contentlet and with an Inode null
//TODO: The data type is used everywhere instead the field.getFieldContentlet() as the method name, parameter and even te query suggested...
fieldsByContentlet = FieldFactory.getFieldsByContentletField( Field.DataType.TEXT.toString(), null, structure.getInode() );
//Validations
assertTrue( fieldsByContentlet != null && !fieldsByContentlet.isEmpty() );
}