### Question:
Classes { public static int howFar(Class<?> from, Class<?> to) { Args.checkNotNull(from); Args.checkNotNull(to); if (from == to) return 0; if (!to.isAssignableFrom(from)) return -1; int distance = 0; Class<?> hierarchyExplorer = from; while (hierarchyExplorer != null && hierarchyExplorer != to) { hierarchyExplorer = hierarchyExplorer.getSuperclass(); if (hierarchyExplorer != null) { distance++; } else { assert false; } } return distance; } private  Classes(); static ClassLoader preferredClassLoader(); @SuppressWarnings("unchecked") static Class<T> forName(String className); @SuppressWarnings("unchecked") static Class<T> forName(String className, ClassLoader loader); static int howFar(Class<?> from, Class<?> to);  }### Answer:
@Test public void 距離0のhowFarテスト() { int distance = Classes.howFar(Object.class, Object.class); assertEquals(0, distance); }
@Test public void 距離なしのhowFarテスト() { int distance = Classes.howFar(JFrame.class, SwingUtilities.class); assertEquals(-1, distance); }
@Test public void 距離1のhowFarテスト() { int distance = Classes.howFar(JPanel.class, JComponent.class); assertEquals(1, distance); }
@Test public void 距離4のhowFarテスト() { int distance = Classes.howFar(JPanel.class, Object.class); assertEquals(4, distance); }