Skip to content

Commit 92b4400

Browse files
committed
. d Update supported Java versions / DRY
1 parent bbc8fb5 commit 92b4400

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Capturing Human Intelligence - ApprovalTests is an open source assertion/verific
3030

3131
It is compatible with JUnit 3, 4 & 5 and TestNG.
3232

33-
The jars can be used from JDK 1.8 on up until JDK 18.
33+
<!-- snippet: approvaltests-tests/src/test/java/org/approvaltests/ci/JavaVersionTest.testSupportedJavaVersions.approved.txt -->
3434

3535
## What can it be used for?
3636

approvaltests-tests/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
<version>0.2.9</version>
3737
<optional>true</optional>
3838
</dependency>
39+
<dependency>
40+
<groupId>com.jayway.jsonpath</groupId>
41+
<artifactId>json-path</artifactId>
42+
<version>2.9.0</version>
43+
<scope>test</scope>
44+
</dependency>
3945
<dependency>
4046
<groupId>junit</groupId>
4147
<artifactId>junit</artifactId>
@@ -48,6 +54,12 @@
4854
<artifactId>junit-jupiter</artifactId>
4955
<version>5.13.3</version>
5056
</dependency>
57+
<dependency>
58+
<groupId>com.fasterxml.jackson.dataformat</groupId>
59+
<artifactId>jackson-dataformat-yaml</artifactId>
60+
<version>2.17.1</version>
61+
<scope>test</scope>
62+
</dependency>
5163

5264
<dependency>
5365
<groupId>com.larseckart</groupId>
@@ -90,6 +102,12 @@
90102
<version>1.9.3</version>
91103
</dependency>
92104

105+
<dependency>
106+
<groupId>com.jayway.jsonpath</groupId>
107+
<artifactId>json-path</artifactId>
108+
<version>2.9.0</version>
109+
<scope>test</scope>
110+
</dependency>
93111
<dependency>
94112
<groupId>com.google.code.gson</groupId>
95113
<artifactId>gson</artifactId>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.approvaltests.ci;
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper;
4+
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
5+
import com.jayway.jsonpath.JsonPath;
6+
import com.spun.util.ClassUtils;
7+
import org.approvaltests.Approvals;
8+
import org.junit.jupiter.api.Test;
9+
10+
import java.io.File;
11+
import java.io.IOException;
12+
import java.util.List;
13+
14+
import static org.junit.jupiter.api.Assertions.assertEquals;
15+
16+
public class JavaVersionTest
17+
{
18+
@Test
19+
public void testSupportedJavaVersions() throws IOException
20+
{
21+
var testYmlPath = new File(ClassUtils.getProjectRootPath() + "/../.github/workflows/test.yml");
22+
Object yaml = new ObjectMapper(new YAMLFactory()).readValue(testYmlPath, Object.class);
23+
List<String> javaVersions = JsonPath.read(yaml, "$.jobs.build.strategy.matrix.java");
24+
// Java 8 GitHub Action is separate from the normal matrixed CI, so hard-code it here.
25+
Approvals.verify("Supported Java versions: 8, " + String.join(", ", javaVersions));
26+
}
27+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Supported Java versions: 8, 17, 21, 24

0 commit comments

Comments
 (0)