Files
java-tutorials/java-dates/src/test/java/com/baeldung/zoneddatetime/OffsetDateTimeExampleUnitTest.java
T

23 lines
589 B
Java
Raw Normal View History

2019-10-11 18:11:03 +02:00
package com.baeldung.zoneddatetime;
import static org.junit.Assert.assertTrue;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import org.junit.Test;
public class OffsetDateTimeExampleUnitTest {
OffsetDateTimeExample offsetDateTimeExample = new OffsetDateTimeExample();
@Test
public void givenZoneOffset_whenGetCurrentTime_thenResultHasZone() {
String offset = "+02:00";
OffsetDateTime time = offsetDateTimeExample.getCurrentTimeByZoneOffset(offset);
assertTrue(time.getOffset()
.equals(ZoneOffset.of(offset)));
}
}