Median { public static int of(List<List<Integer>> ints) { int min = min(ints); int max = max(ints); for (int i = min; i <= max; i++) { final Ordinality ordinality = ordinality(i, ints); if (ordinality.isMedian()) { return i; } } throw new UnsupportedOperationException("Not found"); }  static int of(List<List<Integer>> ints); static int max(List<List<Integer>> lists); static int min(List<List<Integer>> lists); static Ordinality ordinality(int pivot, List<List<Integer>> lists);  }
@Test public void acceptance_test() { Assertions.assertThat(Median.of(Lists.<List<Integer>>newArrayList( Lists.newArrayList(4, 3, 1, 2), Lists.newArrayList(3, 4), Lists.newArrayList(7000000)))).isEqualTo(3); }
@Test public void median_of_a_list() { Assert.assertEquals(2, Median.of(Lists.<List<Integer>>newArrayList( Lists.newArrayList(1, 3, 2)))); }
@Test public void median_of_2_list() { Assert.assertEquals(3, Median.of(Lists.<List<Integer>>newArrayList( Lists.newArrayList(1, 3, 2, 5), Lists.newArrayList(2, 4, 7)))); }
@Test public void median_of_2_list_unbalanced() { Assert.assertEquals(2, Median.of(Lists.<List<Integer>>newArrayList( Lists.newArrayList(1, 3, 2, 2, 2, 2, 2, 2, 5, 4)))); }