### Question:
ActionComparator implements Comparator<ConnectorAction> { private static String name(final ConnectorAction action) { return trimToNull(action.getName()); } private  ActionComparator(); @Override int compare(final ConnectorAction left, final ConnectorAction right); static final Comparator<ConnectorAction> INSTANCE; }### Answer:
@Test public void shouldOrderActionsBasedOnTagsAndName() { final ConnectorAction a = new ConnectorAction.Builder().name("a").addTag("a").build(); final ConnectorAction b = new ConnectorAction.Builder().name("b").addTag("b").build(); final ConnectorAction c = new ConnectorAction.Builder().name("c").addTag("b").build(); final ConnectorAction noTagsA = new ConnectorAction.Builder().name("a").build(); final ConnectorAction noTagsB = new ConnectorAction.Builder().name("b").build(); final ConnectorAction noTagsNoName = new ConnectorAction.Builder().build(); final List<ConnectorAction> actions = new ArrayList<>(Arrays.asList(c, noTagsA, a, noTagsB, b, noTagsNoName)); Collections.shuffle(actions); actions.sort(ActionComparator.INSTANCE); assertThat(actions).containsExactly(a, b, c, noTagsA, noTagsB, noTagsNoName); }