@Test
public void testCompare() {

    TestConstant a = pool.valueOf("a_alpha");
    TestConstant b = pool.valueOf("b_beta");
    TestConstant c = pool.valueOf("c_gamma");
    TestConstant d = pool.valueOf("d_delta");
    TestConstant e = pool.valueOf("e_epsilon");
    Set<TestConstant> set = new TreeSet<TestConstant>();
    set.add(b);
    set.add(c);
    set.add(e);
    set.add(d);
    set.add(a);
    TestConstant[] array = set.toArray(new TestConstant[5]);
    assertThat(array.length, is(5));
    // Sort by name
    Arrays.sort(array, new Comparator<TestConstant>() {
        @Override
        public int compare(TestConstant o1, TestConstant o2) {
            return o1.name().compareTo(o2.name());
        }
    });
    assertThat(array[0], is(sameInstance(a)));
    assertThat(array[1], is(sameInstance(b)));
    assertThat(array[2], is(sameInstance(c)));
    assertThat(array[3], is(sameInstance(d)));
    assertThat(array[4], is(sameInstance(e)));
}