Package org.junithelper.core.meta.extractor

Examples of org.junithelper.core.meta.extractor.ClassMetaExtractor


  }

  protected static List<File> findTargets(Configulation config, String dirOrFile) throws Exception {
    dirOrFile = dirOrFile.replaceAll("\\\\", "/");
    List<File> dest = new ArrayList<File>();
    ClassMetaExtractor extractor = new ClassMetaExtractor(config);
    if (dirOrFile.matches(".+\\.java$")) {
      File file = new File(dirOrFile);
      String encoding = UniversalDetectorUtil.getDetectedEncoding(file);
      ClassMeta classMeta = extractor.extract(IOUtil.readAsString(new FileInputStream(file), encoding));
      if (!classMeta.isAbstract) {
        dest.add(file);
      }
    } else {
      List<File> javaFiles = new ArrayList<File>();
      FileSearcher fileSearcher = new CommonsIOFileSearcher();
      javaFiles = fileSearcher.searchFilesRecursivelyByName(dirOrFile, RegExp.FileExtension.JavaFile);
      for (File file : javaFiles) {
        String encoding = UniversalDetectorUtil.getDetectedEncoding(file);
        ClassMeta classMeta = extractor.extract(IOUtil.readAsString(
            new FileInputStream(file), encoding));
        if (!classMeta.name.matches(".*Test$") && !classMeta.isAbstract) {
          dest.add(file);
        }
      }
View Full Code Here


    testMethodGenerator = new DefaultTestMethodGenerator(config);
  }

  @Override
  public DefaultTestCaseGenerator initialize(String targetSourceCodeString) {
    ClassMetaExtractor classMetaExtractor = new ClassMetaExtractor(config);
    this.targetClassMeta = classMetaExtractor.extract(targetSourceCodeString);
    this.testMethodGenerator.initialize(targetClassMeta);
    this.messageValue.initialize(config.language);
    return this;
  }
View Full Code Here

  }

  @Override
  public String getUnifiedVersionTestCaseSourceCode(String currentTestCaseSourceCode, JUnitVersion version) {
    String dest = currentTestCaseSourceCode;
    ClassMeta classMeta = new ClassMetaExtractor(config).extract(currentTestCaseSourceCode);
    Configuration config = ObjectUtil.deepCopy(this.config);
    if (version == JUnitVersion.version3) {
      dest = dest.replaceAll("@Test[\\s\r\n]*public void ", "public void test"
          + config.testMethodName.basicDelimiter);
      String[] splittedArray = config.testCaseClassNameToExtend.split("\\.");
View Full Code Here

    testMethodGenerator = new DefaultTestMethodGenerator(config);
  }

  @Override
  public DefaultTestCaseGenerator initialize(String targetSourceCodeString) {
    ClassMetaExtractor classMetaExtractor = new ClassMetaExtractor(config);
    this.targetClassMeta = classMetaExtractor.extract(targetSourceCodeString);
    this.testMethodGenerator.initialize(targetClassMeta);
    this.messageValue.initialize(config.language);
    return this;
  }
View Full Code Here

  }

  @Override
  public String getUnifiedVersionTestCaseSourceCode(String currentTestCaseSourceCode, JUnitVersion version) {
    String dest = currentTestCaseSourceCode;
    ClassMeta classMeta = new ClassMetaExtractor(config).extract(currentTestCaseSourceCode);
    Configuration config = ObjectUtil.deepCopy(this.config);
    if (version == JUnitVersion.version3) {
      dest = dest.replaceAll("@Test[\\s\r\n]*public void ", "public void test"
          + config.testMethodName.basicDelimiter);
      String[] splittedArray = config.testCaseClassNameToExtend.split("\\.");
View Full Code Here

    testMethodGenerator = new DefaultTestMethodGenerator(config);
  }

  @Override
  public DefaultTestCaseGenerator initialize(String targetSourceCodeString) {
    ClassMetaExtractor classMetaExtractor = new ClassMetaExtractor(config);
    this.targetClassMeta = classMetaExtractor
        .extract(targetSourceCodeString);
    this.testMethodGenerator.initialize(targetClassMeta);
    this.messageValue.initialize(config.language);
    return this;
  }
View Full Code Here

  @Override
  public String getUnifiedVersionTestCaseSourceCode(
      String currentTestCaseSourceCode, JUnitVersion version) {
    String dest = currentTestCaseSourceCode;
    ClassMeta classMeta = new ClassMetaExtractor(config)
        .extract(currentTestCaseSourceCode);
    Configuration config = ObjectUtil.deepCopy(this.config);
    if (version == JUnitVersion.version3) {
      dest = dest.replaceAll("@Test[\\s\r\n]*public void ",
          "public void test" + config.testMethodName.basicDelimiter);
View Full Code Here

  private ClassMetaExtractor classMetaExtractor;
  private MethodMetaExtractor methodMetaExtractor;
  private ConstructorMetaExtractor constructorMetaExtractor;

  public DefaultSourceCodeParser(Configuration config) {
    classMetaExtractor = new ClassMetaExtractor(config);
    methodMetaExtractor = new MethodMetaExtractor(config);
    constructorMetaExtractor = new ConstructorMetaExtractor(config);
  }
View Full Code Here

    testMethodGenerator = new DefaultTestMethodGenerator(config);
  }

  @Override
  public DefaultTestCaseGenerator initialize(String targetSourceCodeString) {
    ClassMetaExtractor classMetaExtractor = new ClassMetaExtractor(config);
    this.targetClassMeta = classMetaExtractor.extract(targetSourceCodeString);
    this.testMethodGenerator.initialize(targetClassMeta);
    this.messageValue.initialize(config.language);
    return this;
  }
View Full Code Here

  }

  @Override
  public String getUnifiedVersionTestCaseSourceCode(String currentTestCaseSourceCode, JUnitVersion version) {
    String dest = currentTestCaseSourceCode;
    ClassMeta classMeta = new ClassMetaExtractor(config).extract(currentTestCaseSourceCode);
    Configulation config = ObjectUtil.deepCopy(this.config);
    if (version == JUnitVersion.version3) {
      dest = dest.replaceAll("@Test[\\s\r\n]*public void ", "public void test"
          + config.testMethodName.basicDelimiter);
      String[] splittedArray = config.testCaseClassNameToExtend.split("\\.");
View Full Code Here

TOP

Related Classes of org.junithelper.core.meta.extractor.ClassMetaExtractor

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.