@Test
public void checkSortingTwoSimpleGraphs()
        throws Exception {

    IBootstrapItem<String> item1 = mock(IBootstrapItem.class);
    IBootstrapItem<String> item2 = mock(IBootstrapItem.class);
    IBootstrapItem<String> item3 = mock(IBootstrapItem.class);
    IBootstrapItem<String> item4 = mock(IBootstrapItem.class);
    IBootstrapItem<String> item5 = mock(IBootstrapItem.class);
    when(item1.getItemName()).thenReturn("item1");
    when(item2.getItemName()).thenReturn("item2");
    when(item3.getItemName()).thenReturn("item3");
    when(item4.getItemName()).thenReturn("item4");
    when(item5.getItemName()).thenReturn("item5");
    when(item1.getAfterItems()).thenReturn(new ArrayList<String>(){{}});
    when(item2.getAfterItems()).thenReturn(new ArrayList<String>(){{add("item1");}});
    when(item3.getAfterItems()).thenReturn(new ArrayList<String>(){{add("item2");}});
    when(item4.getAfterItems()).thenReturn(new ArrayList<String>(){{}});
    when(item5.getAfterItems()).thenReturn(new ArrayList<String>(){{}});
    when(item1.getBeforeItems()).thenReturn(new ArrayList<String>(){{}});
    when(item2.getBeforeItems()).thenReturn(new ArrayList<String>(){{}});
    when(item3.getBeforeItems()).thenReturn(new ArrayList<String>(){{}});
    when(item4.getBeforeItems()).thenReturn(new ArrayList<String>(){{add("item5");}});
    when(item5.getBeforeItems()).thenReturn(new ArrayList<String>(){{}});
    List<IBootstrapItem<String>> list = new ArrayList<IBootstrapItem<String>>() {
        {
            add(item5);
            add(item2);
            add(item3);
            add(item4);
            add(item1);
        }
    };
    TopologicalSort ts = new TopologicalSort(list);
    List<IBootstrapItem<String>> result = ts.getOrderedList(false);
    assertEquals(result.get(0), item4);
    assertEquals(result.get(1), item5);
    assertEquals(result.get(2), item1);
    assertEquals(result.get(3), item2);
    assertEquals(result.get(4), item3);
    reset(item1);
    reset(item2);
    reset(item3);
    reset(item4);
    reset(item5);
}