Examples of KoanMethod


Examples of com.sandwich.koan.KoanMethod

    }
    displayMessage(sb.toString());
  }
 
  protected void printSuggestion(KoanSuiteResult result) {
    KoanMethod failedKoan = result.getFailingMethod();
    StringBuilder sb =   buildLessonLine(failedKoan);
    buildInvestigateLine(sb, result.getFailingCase(),failedKoan.getMethod().getName());
    sb.append(EOL).append(EOL);
    buildLineClue(sb, result);
    displayMessage(sb.toString());
  }
View Full Code Here

Examples of com.sandwich.koan.KoanMethod

  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("someMethodOne","someMethodTwo"));
    assertSame(m1,methods.get(0));
    assertSame(m2,methods.get(1));
  }
View Full Code Here

Examples of com.sandwich.koan.KoanMethod

  public void testComparatorRanksByOrder() throws Exception {
    Class<? extends Object> clazz = new Object(){
      @SuppressWarnings("unused") @Koan public void someMethodOne(){}
      @SuppressWarnings("unused") @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("someMethodOne","someMethodTwo"));
    assertSame(m1,methods.get(0));
    assertSame(m2,methods.get(1));
  }
View Full Code Here

Examples of com.sandwich.koan.KoanMethod

      final List<KoanElementAttributes> attributes, String onlyMethodNameToRun) {
    final List<KoanMethod> methods = new ArrayList<KoanMethod>();
    final List<String> methodNames = new ArrayList<String>();
    for(KoanElementAttributes attributeSet : attributes){
      if(isMethodEligibleForRunning(onlyMethodNameToRun, attributeSet.name)){
        KoanMethod method = KoanMethod.getInstance(attributeSet);
        methods.add(method);
        methodNames.add(method.getMethod().getName());
      }
    }
    for(Method method : suite.getClass().getMethods()){
      if(!methodNames.contains(method.getName()) &&
          isMethodEligibleForRunning(onlyMethodNameToRun, method.getName()) &&
          method.getAnnotation(Koan.class) != null){
        methods.add(KoanMethod.getInstance(method));
      }
    }
    return methods;
  }
View Full Code Here

Examples of com.sandwich.koan.KoanMethod

  public void defaultKoanDescriptions() throws Exception {
    StringBuilder exceptionStringBuilder = new StringBuilder(KoanConstants.EOL);
    for (Entry<String, Map<String, KoanElementAttributes>> suiteAndKoans :
      PathToEnlightenment.getPathToEnlightenment().getKoanMethodsBySuiteByPackage().next().getValue().entrySet()) {
      for(Entry<String, KoanElementAttributes> koanEntry : suiteAndKoans.getValue().entrySet()){
        KoanMethod koan = KoanMethod.getInstance(koanEntry.getValue());
        Koan annotation = koan.getMethod().getAnnotation(Koan.class);
        if (annotation != null && KoanConstants.DEFAULT_KOAN_DESC.equals(koan.getLesson())) {
          exceptionStringBuilder.append(suiteAndKoans.getKey().getClass().getName()).append('.')
              .append(koan.getMethod().getName()).append(KoanConstants.EOL);
        }
      }
    }
    String exceptionString = exceptionStringBuilder.toString();
    if(exceptionString.trim().length() != 0){
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.