}
@SuppressWarnings("unchecked")
@Test
public void shouldOrderAvailabiltyAndGroupAndName() {
final RosterGroup myGroup = new RosterGroup(eventBus, "myGroup");
myGroup.add(RosterItemHelper.createItem("test2@test", "test2", true, "myGroup"));
myGroup.add(RosterItemHelper.createItem("test1@test", "test1", false, "other"));
myGroup.add(RosterItemHelper.createItem("test3@test", "test3", true));
final Comparator<RosterItem> order = RosterItemsOrder.order(RosterItemsOrder.byAvailability, RosterItemsOrder.groupedFirst, RosterItemsOrder.byName);
final ArrayList<RosterItem> list = myGroup.getItemList(order);
// available and grouped
assertEquals("test2", list.get(0).getName());
// available
assertEquals("test3", list.get(1).getName());
// not available