BinaryHeapQueue implements
        Queue,
        Externalizable { @Override public String toString() { return Stream.of( elements ).filter(Objects::nonNull).collect(toList() ).toString(); } BinaryHeapQueue();  BinaryHeapQueue(final Comparator<Activation> comparator);  BinaryHeapQueue(final Comparator<Activation> comparator,
                           final int capacity); void readExternal(ObjectInput in); void writeExternal(ObjectOutput out); void clear(); Activation[] getAndClear(); boolean isEmpty(); boolean isFull(); int size(); Activation peek(); void enqueue(final Activation element); Activation dequeue(); Activation dequeue(Activation activation); Object[] toArray(Object[] a); @Override String toString();  }
@Test public void testShuffled() { for ( Integer[] perm : perms ) { Group group = new Group( "group" ); for ( Integer i : perm ) { Item item = new Item( group, i ); group.add( item ); } Activation[] elems = group.getQueue(); for (Activation elem : elems ) { Item item = (Item) elem; if ( item.getQueueIndex() % 2 == 0 ) { group.remove( item ); group.add( item ); } } boolean ok = true; StringBuilder sb = new StringBuilder( "queue:" ); for ( int i = max - 1; i >= 0; i-- ) { int sal = group.getNext().getSalience(); sb.append( " " ).append( sal ); if ( sal != i ) ok = false; } assertTrue( "incorrect order in " + sb.toString(), ok ); } }