Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 14 with --enable-preview produce a Ran 0 tests result #759

Closed
EPadronU opened this issue Apr 22, 2020 · 2 comments
Closed

Java 14 with --enable-preview produce a Ran 0 tests result #759

EPadronU opened this issue Apr 22, 2020 · 2 comments

Comments

@EPadronU
Copy link

java -version

openjdk version "14.0.1" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.1+7, mixed mode, sharing)

Important parts in POM:

  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>14</maven.compiler.source>
    <maven.compiler.target>14</maven.compiler.target>
    <apache.commons.version>3.9</apache.commons.version>
    <assertj.version>3.15.0</assertj.version>
    <junit.version>5.6.1</junit.version>
    <log4j.version>2.13.1</log4j.version>
  </properties>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <compilerArgs>
            <arg>--enable-preview</arg>
            <arg>-parameters</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <argLine>--enable-preview</argLine>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.pitest</groupId>
        <artifactId>pitest-maven</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-junit5-plugin</artifactId>
            <version>0.12</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
    
    <pluginManagement>
        ...
        <plugin>
          <groupId>org.pitest</groupId>
          <artifactId>pitest-maven</artifactId>
          <version>1.5.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  ...

Without the --enable-preview flag everything runs as expected:

>> Generated 7 mutations Killed 6 (86%)
>> Ran 7 tests (1 tests per mutation)

Vs when it is set:

>> Generated 7 mutations Killed 0 (0%)
>> Ran 0 tests (0 tests per mutation)
@boris-github
Copy link

Added a PR. By using the newly documented example tests will be run successfully:

<configuration>
  <jvmArgs>
    <jvmArg>--enable-preview</jvmArg>
  </jvmArgs>
</configuration>

@EPadronU can you try the option please?

@EPadronU
Copy link
Author

Hi @boris-github,

I can confirm this works great. Thank you so much for taking the time to review this issue of mine. I feel ashamed for not having seen that error message in the logs, nor imagining PIT needs the flag as well.

Should I close the issue or that's something a core member should do?

@hcoles hcoles closed this as completed Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants