Package no.hal.jex

Examples of no.hal.jex.JavaClassTester


    } else if (junitTest instanceof TestCase) {
      String methodName = ((TestCase) junitTest).getName();
      if (isTestMethodName(methodName)) {
        String namePrefix = AbstractTestAnnotationsToModelConverter.TEST_METHOD_NAME_PREFIX;
        String testedMethodName = Character.toLowerCase(methodName.charAt(namePrefix.length())) + methodName.substring(namePrefix.length() + 1);
        JavaClassTester javaClassTester = (JavaClassTester) req.getJavaElement();
        createFromTestMethodAnnotations((TestCase) junitTest, testedMethodName, javaClassTester, javaClassTester.getTestedElements(), req);
      }
    }
  }
View Full Code Here


      if (child instanceof IMethod && isMethodTester((IMethod) child)) {
        String methodName = child.getElementName();
        String namePrefix = AbstractTestAnnotationsToModelConverter.TEST_METHOD_NAME_PREFIX;
        if (methodName.startsWith(namePrefix)) {
          String testedMethodName = Character.toLowerCase(methodName.charAt(namePrefix.length())) + methodName.substring(namePrefix.length() + 1);
          JavaClassTester javaClassTester = (JavaClassTester) req.getJavaElement();
          createFromTestMethodAnnotations((IMethod) child, testedMethodName, javaClassTester, javaClassTester.getTestedElements(), req, annotations);
        }
      }
    }
    return req;
  }
View Full Code Here

      }
      req = JexFactory.eINSTANCE.createJavaRequirement();
    }
    String packagePrefix = packageName != null && packageName.length() > 0 ? packageName + "." : "";
    req.setText((req instanceof JUnitTest ? "Test " : "") + packagePrefix + testsAnnotation);
    JavaClassTester javaClassTester = (JavaClassTester) ensureJavaClass(packageName, testClassName, JexPackage.eINSTANCE.getJavaClassTester());
    String[] superClasses = {},  superInterfaces = {};
    int pos = testsAnnotation.indexOf(' ');
    if (pos >= 0) {
      testedClassName = testsAnnotation.substring(0, pos);
      testsAnnotation = testsAnnotation.substring(pos + 1);
      String EXTENDS_KEYWORD = "extends ", IMPLEMENTS_KEYWORD = "implements ";
      int extendsPos = testsAnnotation.indexOf(EXTENDS_KEYWORD), implementsPos = testsAnnotation.indexOf(IMPLEMENTS_KEYWORD);
      if (extendsPos >= 0) {
        superClasses = parseTypeList(testsAnnotation.substring(extendsPos + EXTENDS_KEYWORD.length(), implementsPos > extendsPos ? implementsPos : testsAnnotation.length()));
      }
      if (implementsPos >= 0) {
        superInterfaces = parseTypeList(testsAnnotation.substring(implementsPos + IMPLEMENTS_KEYWORD.length(), extendsPos > implementsPos ? extendsPos : testsAnnotation.length()));
      }
    } else {
      testedClassName = testsAnnotation;
    }
    int pos3 = testedClassName.lastIndexOf('.');
    if (pos3 >= 0) {
      packageName = testedClassName.substring(0, pos3);
      testedClassName = testedClassName.substring(pos3 + 1);
    }
    JavaClass javaClass = ensureJavaClass(packageName, testedClassName, JexPackage.eINSTANCE.getJavaClass());
    addAll(javaClass.getSuperclasses(), superClasses);
    addAll(javaClass.getSuperclasses(), superInterfaces);
    javaClassTester.getTestedElements().add(javaClass);
    ExercisePart part = ensureExercisePart(exercise, packageName);
    if (req instanceof JUnitTest) {
      ((JUnitTest) req).setTestRunnable(javaClassTester);
    }
    req.setJavaElement(javaClassTester); // redundant?
View Full Code Here

TOP

Related Classes of no.hal.jex.JavaClassTester

Copyright © 2018 www.massapicom. 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.