@Test public void sort() {

    Graph g = new Graph(2);
    g.addAtom(mock(Atom.class));
    g.addAtom(mock(Atom.class));
    g.addAtom(mock(Atom.class));
    g.addAtom(mock(Atom.class));
    g.addEdge(new Edge(3, 2, Bond.IMPLICIT));
    g.addEdge(new Edge(1, 2, Bond.IMPLICIT));
    g.addEdge(new Edge(0, 3, Bond.IMPLICIT));
    g.addEdge(new Edge(0, 1, Bond.IMPLICIT));
    assertThat(g.edges(0), CoreMatchers
            .<List<Edge>>is(Arrays.asList(new Edge(0, 3, Bond.IMPLICIT),
                                          new Edge(0, 1, Bond.IMPLICIT))));
    assertThat(g.edges(1), CoreMatchers
            .<List<Edge>>is(Arrays.asList(new Edge(1, 2, Bond.IMPLICIT),
                                          new Edge(1, 0, Bond.IMPLICIT))));
    assertThat(g.edges(2), CoreMatchers
            .<List<Edge>>is(Arrays.asList(new Edge(2, 3, Bond.IMPLICIT),
                                          new Edge(2, 1, Bond.IMPLICIT))));
    assertThat(g.edges(3), CoreMatchers
            .<List<Edge>>is(Arrays.asList(new Edge(3, 2, Bond.IMPLICIT),
                                          new Edge(3, 0, Bond.IMPLICIT))));
    g.sort(new Graph.CanOrderFirst());
    assertThat(g.edges(0), CoreMatchers
            .<List<Edge>>is(Arrays.asList(new Edge(0, 1, Bond.IMPLICIT),
                                          new Edge(0, 3, Bond.IMPLICIT))));
    assertThat(g.edges(1), CoreMatchers
            .<List<Edge>>is(Arrays.asList(new Edge(1, 0, Bond.IMPLICIT),
                                          new Edge(1, 2, Bond.IMPLICIT))));
    assertThat(g.edges(2), CoreMatchers
            .<List<Edge>>is(Arrays.asList(new Edge(2, 1, Bond.IMPLICIT),
                                          new Edge(2, 3, Bond.IMPLICIT))));
    assertThat(g.edges(3), CoreMatchers
            .<List<Edge>>is(Arrays.asList(new Edge(3, 0, Bond.IMPLICIT),
                                          new Edge(3, 2, Bond.IMPLICIT))));
}