@Test
public void testCircularReferenceExceptionA() {

    List<String> fragmentList = new ArrayList<String>();
    for (int i = 0; i < 2; i++) {
        fragmentList.add(String.valueOf((char) ('A' + i)));
    }
    CircularReferencesException actualException = null;
    try {
        SortUtils.sort(fragmentList, new Visitor<String>() {
            @Override
            public boolean afterOthers(String t) {
                return false;
            }
            @Override
            public boolean beforeOthers(String t) {
                return false;
            }
            @Override
            public List<String> getAfterNames(String t) {
                if (t.equals("A")) {
                    return Arrays.asList("B");
                } else {
                    return Collections.emptyList();
                }
            }
            @Override
            public List<String> getBeforeNames(String t) {
                if (t.equals("A")) {
                    return Arrays.asList("B");
                } else {
                    return Collections.emptyList();
                }
            }
            @Override
            public String getName(String t) {
                return t;
            }
        });
    } catch (IllegalNodeConfigException e) {
        Assert.fail("Should not get IllegalNodeConfigException here");
    } catch (CircularReferencesException e) {
        actualException = e;
    }
    Assert.assertNotNull("Should get an CircularReferencesException", actualException);
}