From 2c8a1ae6b93a125793e16470b6ba5b02926c76bf Mon Sep 17 00:00:00 2001 From: achraftt Date: Thu, 27 Oct 2022 00:33:38 +0200 Subject: [PATCH] BAEL-5791: adaptation after creating new module --- .../StringToInstantConverterUnitTest.java | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/instant/StringToInstantConverterUnitTest.java diff --git a/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/instant/StringToInstantConverterUnitTest.java b/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/instant/StringToInstantConverterUnitTest.java deleted file mode 100644 index a3732bf7da..0000000000 --- a/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/instant/StringToInstantConverterUnitTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.instant; - -import org.junit.Test; - -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Locale; - -import static org.assertj.core.api.Assertions.assertThat; - -public class StringToInstantConverterUnitTest { - String stringDate = "09:15:30 PM, Sun 10/09/2022"; - String pattern = "hh:mm:ss a, EEE M/d/uuuu"; - - @Test public void givenStringTimeStamp_whenConvertingWithInstantUsingTimeZone_thenConvertToInstant() { - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern, Locale.US); - LocalDateTime localDateTime = LocalDateTime.parse(stringDate, dateTimeFormatter); - ZoneId zoneId = ZoneId.of("America/Chicago"); - ZonedDateTime zonedDateTime = localDateTime.atZone(zoneId); - Instant instant = zonedDateTime.toInstant(); - assertThat(instant.toString()).isEqualTo("2022-10-10T02:15:30Z"); - } - - @Test public void givenStringTimeStamp_whenConvertingWithLocalDateTime_thenConvertToInstant() { - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern, Locale.US); - LocalDateTime localDateTime = LocalDateTime.parse(stringDate, dateTimeFormatter); - assertThat(localDateTime.toString()).isEqualTo("2022-10-09T21:15:30"); - } -} \ No newline at end of file