@@ -0,0 +1,1364 @@
+package interviewquestions;%0A%0Aimport java.util.Iterator;%0A%0A/**%0A * A layman version of junit (just because I don't want to include a dependency)%0A */%0Apublic abstract class TestCase %7B%0A  public static void assertTrue(boolean condition) %7B%0A    // assertions are disabled by default in java, mimic their behaviour here%0A    if (!condition) %7B%0A      throw new AssertionError(%22invalid test%22);%0A    %7D%0A  %7D%0A%0A  public static void assertEquals(int i1, int i2) %7B%0A    if (i1 != i2) %7B%0A      throw new AssertionError(String.format(%22%25d != %25d%22, i1, i2));%0A    %7D%0A  %7D%0A%0A  public static void assertEquals(long i1, long i2) %7B%0A    if (i1 != i2) %7B%0A      throw new AssertionError(String.format(%22%25d != %25d%22, i1, i2));%0A    %7D%0A  %7D%0A%0A  public static void assertEquals(float i1, float i2) %7B%0A    if (i1 != i2) %7B%0A      throw new AssertionError(String.format(%22%25.5f != %25.5f%22, i1, i2));%0A    %7D%0A  %7D%0A%0A  public static void assertEquals(double i1, double i2) %7B%0A    if (i1 != i2) %7B%0A      throw new AssertionError(String.format(%22%25.5f != %25.5f%22, i1, i2));%0A    %7D%0A  %7D%0A%0A  public static %3CE%3E void assertEquals(Iterable%3CE%3E i1, Iterable%3CE%3E i2) %7B%0A    Iterator%3CE%3E it1 = i1.iterator();%0A    Iterator%3CE%3E it2 = i2.iterator();%0A%0A    while (it1.hasNext() && it2.hasNext()) %7B%0A      E e1 = it1.next();%0A      E e2 = it2.next();%0A%0A      assertTrue(e1.equals(e2));%0A    %7D%0A%0A    assertTrue(!it1.hasNext());%0A    assertTrue(!it2.hasNext());%0A  %7D%0A%7D%0A

Include a common ABC for test cases, so I don't have to copy test() everywhere