Skip to content

Commit 6fe50b5

Browse files
committed
Enforce JDK version on CI server
Add a test to ensure that the CI server does not accidentally build with the wrong JDK version. Issue: SPR-10569
1 parent 87a9602 commit 6fe50b5

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2002-2013 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.tests;
18+
19+
import org.junit.Test;
20+
21+
import static org.hamcrest.Matchers.*;
22+
import static org.junit.Assert.*;
23+
24+
/**
25+
* General build related tests. Part of spring-core to ensure that they run early in the
26+
* build process.
27+
*/
28+
public class BuildTests {
29+
30+
@Test
31+
public void javaVersion() throws Exception {
32+
Assume.group(TestGroup.CI);
33+
assertThat("Java Version", JavaVersion.runningVersion(), equalTo(JavaVersion.JAVA_18));
34+
}
35+
36+
}

spring-core/src/test/java/org/springframework/tests/TestGroup.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ public enum TestGroup {
5454
* Tests requiring the presence of jmxremote_optional.jar in jre/lib/ext in order to
5555
* avoid "Unsupported protocol: jmxmp" errors.
5656
*/
57-
JMXMP;
57+
JMXMP,
58+
59+
/**
60+
* Tests that should only be run on the continuous integration server.
61+
*/
62+
CI;
5863

5964

6065
/**

spring-core/src/test/java/org/springframework/tests/TestGroupTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void parseMissing() throws Exception {
6464
thrown.expect(IllegalArgumentException.class);
6565
thrown.expectMessage("Unable to find test group 'missing' when parsing " +
6666
"testGroups value: 'performance, missing'. Available groups include: " +
67-
"[LONG_RUNNING,PERFORMANCE,JMXMP]");
67+
"[LONG_RUNNING,PERFORMANCE,JMXMP,CI]");
6868
TestGroup.parse("performance, missing");
6969
}
7070

0 commit comments

Comments
 (0)