OSGIServiceComparator implements Comparator<ServiceReference> { public static int getPriority(Object o) { return getPriority(o.getClass()); }  @Override int compare(ServiceReference o1, ServiceReference o2); static int getPriority(Object o); static int getPriority(Class<? extends Object> type);  }
@Test public void testGetPriority_Object() { ServiceReference low = new MockLowPriorityServiceReference(); assertThat(OSGIServiceComparator.getPriority(low)).isEqualTo(1); ServiceReference nullPriority = new MockServiceReference(); assertThat(OSGIServiceComparator.getPriority(nullPriority)).isEqualTo(1); ServiceReference high = new MockHighPriorityServiceReference(); assertThat(OSGIServiceComparator.getPriority(high)).isEqualTo(10); }
@Test public void testGetPriority_Class() { assertThat(OSGIServiceComparator.getPriority(MockHighPriorityServiceReference.class)).isEqualTo(10); assertThat(OSGIServiceComparator.getPriority(MockLowPriorityServiceReference.class)).isEqualTo(1); assertThat(OSGIServiceComparator.getPriority(MockServiceReference.class)).isEqualTo(1); }