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

Always run java version test for the CI #1246

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core/src/test/java/de/jplag/NewJavaFeaturesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ public class NewJavaFeaturesTest extends TestBase {
private static final String VERSION_MISMATCH_MESSAGE = "Using Java version %s instead of %s may skew the results.";
private static final String VERSION_MATCH_MESSAGE = "Java version matches, but results deviate from expected values";
private static final String JAVA_VERSION_KEY = "java.version";
private static final String CI_VARIABLE = "CI";

@Test
@DisplayName("test comparison of Java files with modern language features")
public void testJavaFeatureDuplicates() throws ExitException {
// pre-condition
String actualJavaVersion = System.getProperty(JAVA_VERSION_KEY);
assumeTrue(actualJavaVersion.startsWith(EXPECTED_JAVA_VERSION), VERSION_MISMATCH_MESSAGE.formatted(actualJavaVersion, EXPECTED_JAVA_VERSION));
boolean isCiRun = System.getenv(CI_VARIABLE) != null;
boolean isCorrectJavaVersion = actualJavaVersion.startsWith(EXPECTED_JAVA_VERSION);
assumeTrue(isCorrectJavaVersion || isCiRun, VERSION_MISMATCH_MESSAGE.formatted(actualJavaVersion, EXPECTED_JAVA_VERSION));

JPlagResult result = runJPlagWithExclusionFile(ROOT_DIRECTORY, EXCLUSION_FILE_NAME);

Expand Down