JAVA-26729:Changes made for upgrade commons-validator to latest version (#15159)

This commit is contained in:
Bipin kumar 2023-11-08 15:54:10 +05:30 committed by GitHub
parent c7e2dc2a6e
commit 7b6ba0e030
2 changed files with 3 additions and 2 deletions

View File

@ -64,7 +64,7 @@
</build>
<properties>
<commons-validator.version>1.6</commons-validator.version>
<commons-validator.version>1.7</commons-validator.version>
<joda-time.version>2.12.5</joda-time.version>
<hirondelle-date4j.version>RELEASE</hirondelle-date4j.version>
<maven.compiler.source>1.9</maven.compiler.source>

View File

@ -6,6 +6,7 @@ import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.util.TimeZone;
import org.joda.time.format.DateTimeFormat;
import org.junit.Test;
@ -17,7 +18,7 @@ public class FormatInstantUnitTest {
@Test
public void givenInstant_whenUsingDateTimeFormatter_thenFormat() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(PATTERN_FORMAT)
.withZone(ZoneId.systemDefault());
.withZone(TimeZone.getTimeZone("UTC").toZoneId());
Instant instant = Instant.parse("2022-02-15T18:35:24.00Z");
String formattedInstant = formatter.format(instant);