public void testIsCyclic_nonCyclicXref() throws MolgenisModelException
{
Vector<Field> fields = new Vector<Field>();
Field field1 = new Field(mock(Entity.class), "field1", mock(FieldType.class));
fields.add(field1);
Field field2 = new Field(mock(Entity.class), "field2", new XrefField());
field2.setXRefEntity("field4");
fields.add(field2);
Field field3 = new Field(mock(Entity.class), "field3", new MrefField());
field3.setXRefEntity("field5");
fields.add(field3);
Entity xrefEntity = mock(Entity.class);
when(xrefEntity.getAllFields()).thenReturn(fields);
Entity rootEntity = mock(Entity.class);
when(rootEntity.get("xrefEntity")).thenReturn(xrefEntity);
Entity entity = mock(Entity.class);
when(entity.getRoot()).thenReturn(rootEntity);
Field field = new Field(entity, "field", new XrefField());
field.setXRefEntity("xrefEntity");
assertFalse(field.isCyclic());
}