// Path: lib/src/main/java/com/sandwich/koan/KoanMethod.java
// public class KoanMethod {
// 	
// 	private final transient Method method;
// 	private final String lesson;
// 	private final boolean displayIncompleteException;
// 	private static final KoanSuiteCompilationListener listener = new KoanSuiteCompilationListener();
// 	
// 	private KoanMethod(KoanElementAttributes koanAttributes) throws SecurityException, NoSuchMethodException{
// 		this(null, koanAttributes);
// 	}
// 	
// 	public static KoanMethod getInstance(KoanElementAttributes koanAttributes){
// 		try {
// 			return new KoanMethod(koanAttributes);
// 		} catch (Exception e) {
// 			throw new RuntimeException(e);
// 		}
// 	}
// 	
// 	public static KoanMethod getInstance(Method method){
// 		return new KoanMethod(null, method, true);
// 	}
// 	
// 	public static KoanMethod getInstance(String lesson, Method method){
// 		return new KoanMethod(lesson, method, true);
// 	}
// 	
// 	private KoanMethod(String lesson, Method method, boolean displayIncompleteException){
// 		if(method == null){
// 			throw new IllegalArgumentException("method may not be null");
// 		}
// 		this.method = method;
// 		this.lesson = new RbVariableInjector(lesson, method).injectLessonVariables();
// 		this.displayIncompleteException = displayIncompleteException;
// 	}
// 
// 	public KoanMethod(String lesson, KoanElementAttributes koanAttributes) throws SecurityException, NoSuchMethodException {
// 		this(	lesson, 
// 				KoanClassLoader.getInstance().loadClass(koanAttributes.className, listener)
// 					.getMethod(koanAttributes.name),
// 				!"false".equalsIgnoreCase(koanAttributes.displayIncompleteKoanException));
// 	}
// 
// 	public String getLesson() {
// 		return lesson;
// 	}
// 
// 	public Method getMethod() {
// 		return method;
// 	}
// 	
// 	public boolean displayIncompleteException() {
// 		return displayIncompleteException;
// 	}
// 	
// 	public KoanMethod clone(Method method){
// 		return new KoanMethod(lesson, method, displayIncompleteException);
// 	}
// 	
// 	@Override public String toString(){
// 		return "{"+getMethod().getName()
// 				+" : "+ (lesson.length() > 20 ? lesson.substring(0, 20) + "..." : lesson)+"}";
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = 1;
// 		result = prime * result + (displayIncompleteException ? 1231 : 1237);
// 		result = prime * result + ((lesson == null) ? 0 : lesson.hashCode());
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (obj == null)
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		KoanMethod other = (KoanMethod) obj;
// 		if (displayIncompleteException != other.displayIncompleteException)
// 			return false;
// 		if (lesson == null) {
// 			if (other.lesson != null)
// 				return false;
// 		} else if (!lesson.equals(other.lesson))
// 			return false;
// 		return true;
// 	}
// 	
// 	
// }


import static org.junit.Assert.assertSame;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import com.sandwich.koan.Koan;
import com.sandwich.koan.KoanMethod;
import com.sandwich.koan.path.CommandLineTestCase;
		}.getClass().getDeclaredMethod("someMethod");
		KoanComparator comparator = new KoanComparator();
		try{
			comparator.compare(KoanMethod.getInstance("2",m), KoanMethod.getInstance("1",m));
		}catch(RuntimeException fileNotFound){}
	}
	
	@Test
	public void testComparatorRanksByOrder() throws Exception {
		Class<? extends Object> clazz = new Object(){
			@Koan public void someMethodOne(){}
			@Koan public void someMethodTwo(){}
		}.getClass();
		KoanMethod m1 = KoanMethod.getInstance("",clazz.getDeclaredMethod("someMethodOne"));
		KoanMethod m2 = KoanMethod.getInstance("",clazz.getDeclaredMethod("someMethodTwo"));
		List<KoanMethod> methods = Arrays.asList(m2,m1);
		Collections.sort(methods, new KoanComparator());
		assertSame(m1,methods.get(0));
		assertSame(m2,methods.get(1));
	}
	
    @Test
    public void testVariableNamesArentConfusedAsKoanMethodsWhenSorting() throws Exception {
        Class<? extends Object> clazz = new Object(){
            @SuppressWarnings("unused")
            String foo;
            @Koan public void bar(){}
            @Koan public void foo(){}
        }.getClass();
        KoanMethod m1 = KoanMethod.getInstance("", clazz.getDeclaredMethod("bar"));
// Path: lib/src/main/java/com/sandwich/koan/KoanMethod.java
// public class KoanMethod {
// 	
// 	private final transient Method method;
// 	private final String lesson;
// 	private final boolean displayIncompleteException;
// 	private static final KoanSuiteCompilationListener listener = new KoanSuiteCompilationListener();
// 	
// 	private KoanMethod(KoanElementAttributes koanAttributes) throws SecurityException, NoSuchMethodException{
// 		this(null, koanAttributes);
// 	}
// 	
// 	public static KoanMethod getInstance(KoanElementAttributes koanAttributes){
// 		try {
// 			return new KoanMethod(koanAttributes);
// 		} catch (Exception e) {
// 			throw new RuntimeException(e);
// 		}
// 	}
// 	
// 	public static KoanMethod getInstance(Method method){
// 		return new KoanMethod(null, method, true);
// 	}
// 	
// 	public static KoanMethod getInstance(String lesson, Method method){
// 		return new KoanMethod(lesson, method, true);
// 	}
// 	
// 	private KoanMethod(String lesson, Method method, boolean displayIncompleteException){
// 		if(method == null){
// 			throw new IllegalArgumentException("method may not be null");
// 		}
// 		this.method = method;
// 		this.lesson = new RbVariableInjector(lesson, method).injectLessonVariables();
// 		this.displayIncompleteException = displayIncompleteException;
// 	}
// 
// 	public KoanMethod(String lesson, KoanElementAttributes koanAttributes) throws SecurityException, NoSuchMethodException {
// 		this(	lesson, 
// 				KoanClassLoader.getInstance().loadClass(koanAttributes.className, listener)
// 					.getMethod(koanAttributes.name),
// 				!"false".equalsIgnoreCase(koanAttributes.displayIncompleteKoanException));
// 	}
// 
// 	public String getLesson() {
// 		return lesson;
// 	}
// 
// 	public Method getMethod() {
// 		return method;
// 	}
// 	
// 	public boolean displayIncompleteException() {
// 		return displayIncompleteException;
// 	}
// 	
// 	public KoanMethod clone(Method method){
// 		return new KoanMethod(lesson, method, displayIncompleteException);
// 	}
// 	
// 	@Override public String toString(){
// 		return "{"+getMethod().getName()
// 				+" : "+ (lesson.length() > 20 ? lesson.substring(0, 20) + "..." : lesson)+"}";
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = 1;
// 		result = prime * result + (displayIncompleteException ? 1231 : 1237);
// 		result = prime * result + ((lesson == null) ? 0 : lesson.hashCode());
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (obj == null)
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		KoanMethod other = (KoanMethod) obj;
// 		if (displayIncompleteException != other.displayIncompleteException)
// 			return false;
// 		if (lesson == null) {
// 			if (other.lesson != null)
// 				return false;
// 		} else if (!lesson.equals(other.lesson))
// 			return false;
// 		return true;
// 	}
// 	
// 	
// }


// Path: lib/src/test/java/com/sandwich/util/KoanComparatorTest.java
import static org.junit.Assert.assertSame;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import com.sandwich.koan.Koan;
import com.sandwich.koan.KoanMethod;
import com.sandwich.koan.path.CommandLineTestCase;

		}.getClass().getDeclaredMethod("someMethod");
		KoanComparator comparator = new KoanComparator();
		try{
			comparator.compare(KoanMethod.getInstance("2",m), KoanMethod.getInstance("1",m));
		}catch(RuntimeException fileNotFound){}
	}
	
	@Test
	public void testComparatorRanksByOrder() throws Exception {
		Class<? extends Object> clazz = new Object(){
			@Koan public void someMethodOne(){}
			@Koan public void someMethodTwo(){}
		}.getClass();
		KoanMethod m1 = KoanMethod.getInstance("",clazz.getDeclaredMethod("someMethodOne"));
		KoanMethod m2 = KoanMethod.getInstance("",clazz.getDeclaredMethod("someMethodTwo"));
		List<KoanMethod> methods = Arrays.asList(m2,m1);
		Collections.sort(methods, new KoanComparator());
		assertSame(m1,methods.get(0));
		assertSame(m2,methods.get(1));
	}
	
    @Test
    public void testVariableNamesArentConfusedAsKoanMethodsWhenSorting() throws Exception {
        Class<? extends Object> clazz = new Object(){
            @SuppressWarnings("unused")
            String foo;
            @Koan public void bar(){}
            @Koan public void foo(){}
        }.getClass();
        KoanMethod m1 = KoanMethod.getInstance("", clazz.getDeclaredMethod("bar"));
        KoanMethod m2 = KoanMethod.getInstance("", clazz.getDeclaredMethod("foo"));