### Question:
Providers { public static <P extends WeaveLifecycleProvider<?>> Iterable<P> sort(final Iterable<P> providers) { return new SortWorker<P>().sort(providers); } private  Providers(); static Iterable<P> sort(final Iterable<P> providers);  }### Answer:
@Test(expected = NullPointerException.class) public void testSortNull() { Providers.sort(null); }
@Test(expected = IllegalArgumentException.class) public void testSortNullElement() { Providers.sort(Arrays.asList((Weaver) null)); }
@Test public void testSort() { assertThat(Providers.sort(Arrays.asList(b, a, c)), IsIterableContainingInOrder.contains(a, b, c)); assertThat(Providers.sort(Arrays.asList(y, w, x, z)), IsIterableContainingInOrder.contains(z, y, x, w)); }
@Test(expected = IllegalStateException.class) public void testCircularSort() { Providers.sort(Arrays.asList(y, z, monkeywrench)); }