<commit_before>package com.github.ferstl.depgraph;

import java.io.File;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.takari.maven.testing.TestResources;
import io.takari.maven.testing.executor.MavenExecutionResult;
import io.takari.maven.testing.executor.MavenRuntime;
import io.takari.maven.testing.executor.MavenVersions;
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;

@RunWith(MavenJUnitTestRunner.class)
@MavenVersions({"3.6.0"})
public class FromArtifactMojoIntegrationTest {

  @Rule
  public final TestResources resources = new TestResources();

  private final MavenRuntime mavenRuntime;

  public FromArtifactMojoIntegrationTest(MavenRuntime.MavenRuntimeBuilder builder) throws Exception {
    this.mavenRuntime = builder.build();
  }

  @Test
  public void withoutProject() throws Exception {
    File basedir = this.resources.getBasedir("no-project");

    MavenExecutionResult result = this.mavenRuntime
        .forProject(basedir)
        .withCliOption("-B")
        .withCliOption("-DgroupId=com.google.guava")
        .withCliOption("-DartifactId=guava")
        .withCliOption("-Dversion=27.0.1-jre")
        .execute("com.github.ferstl:depgraph-maven-plugin:3.3.0-SNAPSHOT:from-artifact");

    result.assertErrorFreeLog();
  }
}
<commit_msg>#93 Create fully qualified Maven goal from TestProperties<commit_after>package com.github.ferstl.depgraph;

import java.io.File;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.takari.maven.testing.TestProperties;
import io.takari.maven.testing.TestResources;
import io.takari.maven.testing.executor.MavenExecutionResult;
import io.takari.maven.testing.executor.MavenRuntime;
import io.takari.maven.testing.executor.MavenVersions;
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;

@RunWith(MavenJUnitTestRunner.class)
@MavenVersions({"3.6.0"})
public class FromArtifactMojoIntegrationTest {

  @Rule
  public final TestResources resources = new TestResources();

  private final MavenRuntime mavenRuntime;
  private final TestProperties testProperties;

  public FromArtifactMojoIntegrationTest(MavenRuntime.MavenRuntimeBuilder builder) throws Exception {
    this.testProperties = new TestProperties();
    this.mavenRuntime = builder.build();
  }

  @Test
  public void withoutProject() throws Exception {
    File basedir = this.resources.getBasedir("no-project");

    MavenExecutionResult result = this.mavenRuntime
        .forProject(basedir)
        .withCliOption("-B")
        .withCliOption("-DgroupId=com.google.guava")
        .withCliOption("-DartifactId=guava")
        .withCliOption("-Dversion=27.0.1-jre")
        .execute(createFullyQualifiedGoal());

    result.assertErrorFreeLog();
  }

  /**
   * Helper to create a fully qualified Maven goal with the curren plugin version. This is needed for tests
   * without POM files where {@code it-plugin.version} can not be injected.
   *
   * @return The fully qualified goal {@code <groupId>:<artifactId>:<version>:from-artifact}
   */
  private String createFullyQualifiedGoal() {
    return this.testProperties.get("project.groupId") + ":"
        + this.testProperties.get("project.artifactId") + ":"
        + this.testProperties.get("project.version") + ":"
        + "from-artifact";
  }
}

{'fraction_non_alphanumeric': 0.11429424052521635, 'fraction_numerical': 0.005669949268874963, 'mean_word_length': 4.495081967213115, 'pattern_counts': {'":': 3, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5220120', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1030, 'n_words': 183}