### Question:
ListenerPriorityComparator implements Comparator<Object> { @Override public int compare(Object o1, Object o2) { return Integer.compare(getPriority(o2), getPriority(o1)); }  @Override int compare(Object o1, Object o2);  }### Answer:
@Test public void shouldReturnPositiveNumberWhenSecondArgumentPriorityIsGreaterThanFirst() { String aString = "a_string"; TestListener testListener = new TestListener(); ListenerPriorityComparator comparator = new ListenerPriorityComparator(); assertThat(comparator.compare(aString, testListener)).isEqualTo(1); }
@Test public void shouldReturnNegativeNumberWhenFirstArgumentPriorityIsGreaterThanSecond() { String aString = "a_string"; TestListener testListener = new TestListener(); ListenerPriorityComparator comparator = new ListenerPriorityComparator(); assertThat(comparator.compare(testListener, aString)).isEqualTo(-1); }
@Test public void shouldReturnZeroArgumentsPriorityEqual() { String aString = "a_string"; String anotherString = "another_string"; ListenerPriorityComparator comparator = new ListenerPriorityComparator(); assertThat(comparator.compare(aString, anotherString)).isEqualTo(0); }