JAVA-8736: update JDK version for the jdk9-and-above Jenkins jobs

This commit is contained in:
chaos2418 2021-12-03 17:20:12 +05:30
parent c040b702c5
commit fe00d52ad5
6 changed files with 19 additions and 28 deletions

View File

@ -12,6 +12,7 @@
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -13,6 +13,8 @@
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -38,15 +38,15 @@
<version>${asspectj.version}</version> <version>${asspectj.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.powermock</groupId> <groupId>org.mockito</groupId>
<artifactId>powermock-module-junit4</artifactId> <artifactId>mockito-inline</artifactId>
<version>${powermock.version}</version> <version>${mockito-inline.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.powermock</groupId> <groupId>org.mockito</groupId>
<artifactId>powermock-api-mockito2</artifactId> <artifactId>mockito-core</artifactId>
<version>${powermock.version}</version> <version>${mockito-inline.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -82,10 +82,10 @@
<properties> <properties>
<commons-math3.version>3.6.1</commons-math3.version> <commons-math3.version>3.6.1</commons-math3.version>
<joda.version>2.10</joda.version> <joda.version>2.10</joda.version>
<lombok.version>1.18.12</lombok.version> <lombok.version>1.18.22</lombok.version>
<asspectj.version>1.8.9</asspectj.version> <asspectj.version>1.8.9</asspectj.version>
<powermock.version>2.0.7</powermock.version>
<jmockit.version>1.44</jmockit.version> <jmockit.version>1.44</jmockit.version>
<mockito-inline.version>4.0.0</mockito-inline.version>
</properties> </properties>
</project> </project>

View File

@ -1,20 +1,15 @@
package com.baeldung.time; package com.baeldung.time;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.mockito.MockedStatic;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.time.Clock; import java.time.Clock;
import java.time.Instant; import java.time.Instant;
import java.time.ZoneId; import java.time.ZoneId;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.powermock.api.mockito.PowerMockito.mockStatic; import static org.mockito.Mockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.when;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ Instant.class })
public class InstantUnitTest { public class InstantUnitTest {
@Test @Test
@ -22,12 +17,12 @@ public class InstantUnitTest {
String instantExpected = "2014-12-22T10:15:30Z"; String instantExpected = "2014-12-22T10:15:30Z";
Clock clock = Clock.fixed(Instant.parse(instantExpected), ZoneId.of("UTC")); Clock clock = Clock.fixed(Instant.parse(instantExpected), ZoneId.of("UTC"));
Instant instant = Instant.now(clock); Instant instant = Instant.now(clock);
mockStatic(Instant.class);
when(Instant.now()).thenReturn(instant);
Instant now = Instant.now(); try (MockedStatic<Instant> mockedStatic = mockStatic(Instant.class)) {
mockedStatic.when(Instant::now).thenReturn(instant);
assertThat(now.toString()).isEqualTo(instantExpected); Instant now = Instant.now();
assertThat(now.toString()).isEqualTo(instantExpected);
}
} }
@Test @Test

View File

@ -1,9 +1,6 @@
package com.baeldung.time; package com.baeldung.time;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.time.Clock; import java.time.Clock;
import java.time.Instant; import java.time.Instant;
@ -11,11 +8,7 @@ import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ LocalDateTime.class })
public class LocalDateTimeUnitTest { public class LocalDateTimeUnitTest {
@Test @Test

View File

@ -166,7 +166,7 @@
<properties> <properties>
<java.version>11</java.version> <java.version>11</java.version>
<repackage.classifier /> <repackage.classifier />
<spring-native.version>0.10.3</spring-native.version> <spring-native.version>0.10.5</spring-native.version>
</properties> </properties>
</project> </project>