Simplify DateTimeType handling for deCONZ

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2024-11-09 22:09:59 +01:00 committed by lsiepel
parent 8d0653a161
commit e05d5ba84a

View File

@ -19,8 +19,7 @@ import static org.mockito.Mockito.times;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.Instant;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@ -119,10 +118,9 @@ public class DeconzTest {
@Test
public void dateTimeConversionTest() {
DateTimeType dateTime = Util.convertTimestampToDateTime("2020-08-22T11:09Z");
assertEquals(new DateTimeType(ZonedDateTime.parse("2020-08-22T11:09:00Z")), dateTime);
assertEquals(new DateTimeType(Instant.parse("2020-08-22T11:09:00Z")), dateTime);
dateTime = Util.convertTimestampToDateTime("2020-08-22T11:09:47");
assertEquals(new DateTimeType(ZonedDateTime.parse("2020-08-22T11:09:47Z")).toZone(ZoneId.systemDefault()),
dateTime);
assertEquals(new DateTimeType(Instant.parse("2020-08-22T11:09:47Z")), dateTime);
}
}