### Question:
SimulationEventComparator implements Comparator<SimulationEvent> { @Override public int compare(SimulationEvent o1, SimulationEvent o2) { if (o1.getSimulationTime() < o2.getSimulationTime()) return -1; if (o1.getSimulationTime() > o2.getSimulationTime()) return 1; if (o1.getPriority() < o2.getPriority()) return -1; if (o1.getPriority() > o2.getPriority()) return 1; return 0; }  @Override int compare(SimulationEvent o1, SimulationEvent o2);  }### Answer:
@Test public void testCompare() throws Exception { SimulationEvent event1_0 = new SimulationEvent.Builder("type").simulationTime(0).build(); SimulationEvent eq1_0 = new SimulationEvent.Builder("type").simulationTime(0).build(); SimulationEvent event1_1 = new SimulationEvent.Builder("type").simulationTime(0).priority(1).build(); SimulationEvent event2 = new SimulationEvent.Builder("type").simulationTime(1).build(); assertEquals(0, comparator.compare(event1_0, eq1_0)); assertEquals(-1, comparator.compare(event1_0, event2)); assertEquals(1, comparator.compare(event2, event1_0)); assertEquals(-1, comparator.compare(event1_0, event1_1)); assertEquals(1, comparator.compare(event1_1, event1_0)); assertEquals(-1, comparator.compare(event1_1, event2)); assertEquals(1, comparator.compare(event2, event1_1)); }
@Test public void testCompare() throws Exception { SimulationEvent event1_0 = new SimulationEvent.Builder("type").simulationTime(0).build(); SimulationEvent eq1_0 = new SimulationEvent.Builder("type").simulationTime(0).build(); SimulationEvent event1_1 = new SimulationEvent.Builder("type").simulationTime(0).priority(1).build(); SimulationEvent event2 = new SimulationEvent.Builder("type").simulationTime(1).build(); assertThat(comparator.compare(event1_0, eq1_0)).isZero(); assertThat(comparator.compare(event1_0, event2)).isEqualTo(-1); assertThat(comparator.compare(event2, event1_0)).isEqualTo(1); assertThat(comparator.compare(event1_0, event1_1)).isEqualTo(-1); assertThat(comparator.compare(event1_1, event1_0)).isEqualTo(1); assertThat(comparator.compare(event1_1, event2)).isEqualTo(-1); assertThat(comparator.compare(event2, event1_1)).isEqualTo(1); }