### Question:
KoanComparator implements Comparator<KoanMethod> { public int compare(KoanMethod arg0, KoanMethod arg1) { Class<?> declaringClass0 = arg0.getMethod().getDeclaringClass(); Class<?> declaringClass1 = arg1.getMethod().getDeclaringClass(); if(declaringClass0 != declaringClass1){ Logger.getAnonymousLogger().severe("no idea how to handle comparing the classes: " + declaringClass0 + " and: "+declaringClass1); return 0; } String contentsOfOriginalJavaFile = FileCompiler.getContentsOfJavaFile(DirectoryManager.getSourceDir(), declaringClass0.getName()); String pattern = ".*\\s%s(\\(|\\s*\\))"; Integer index0 = indexOfMatch(contentsOfOriginalJavaFile, String.format(pattern, arg0.getMethod().getName())); Integer index1 = indexOfMatch(contentsOfOriginalJavaFile, String.format(pattern, arg1.getMethod().getName())); return index0.compareTo(index1); }  int compare(KoanMethod arg0, KoanMethod arg1);  }### Answer:
@Test public void testThatKomparatorBombsWhenNotFound() throws Exception { Method m = new Object(){ @Koan public void someMethod(){} }.getClass().getDeclaredMethod("someMethod"); KoanComparator comparator = new KoanComparator(); try{ comparator.compare(KoanMethod.getInstance("2",m), KoanMethod.getInstance("1",m)); }catch(RuntimeException fileNotFound){} }