Skip to content

Commit

Permalink
Remove obsoleted test methods (openhab#17871)
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Laursen <[email protected]>
  • Loading branch information
jlaur authored and matchews committed Dec 16, 2024
1 parent c78df50 commit def3f83
Showing 1 changed file with 0 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static org.mockito.Mockito.*;

import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
Expand All @@ -30,7 +29,6 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentMatchers;
import org.openhab.binding.ntp.internal.NtpBindingConstants;
Expand Down Expand Up @@ -209,35 +207,6 @@ public void testStringChannelTimeZoneUpdate() {
assertThat(timeZoneFromItemRegistry, is(anyOf(equalTo(expectedTimeZonePDT), equalTo(expectedTimeZonePST))));
}

@Test
public void testDateTimeChannelTimeZoneUpdate() {
Configuration configuration = new Configuration();
configuration.put(NtpBindingConstants.PROPERTY_TIMEZONE, TEST_TIME_ZONE_ID);
initialize(configuration, NtpBindingConstants.CHANNEL_DATE_TIME, ACCEPTED_ITEM_TYPE_DATE_TIME, null, null);

String testItemState = getItemState(ACCEPTED_ITEM_TYPE_DATE_TIME).toString();
assertFormat(testItemState, DateTimeType.DATE_PATTERN_WITH_TZ_AND_MS);
ZonedDateTime timeZoneFromItemRegistry = ((DateTimeType) getItemState(ACCEPTED_ITEM_TYPE_DATE_TIME))
.getZonedDateTime();

ZoneOffset expectedOffset = ZoneId.of(TEST_TIME_ZONE_ID).getRules()
.getOffset(timeZoneFromItemRegistry.toInstant());
assertEquals(expectedOffset, timeZoneFromItemRegistry.getOffset());
}

@Test
public void testDateTimeChannelCalendarTimeZoneUpdate() {
Configuration configuration = new Configuration();
configuration.put(NtpBindingConstants.PROPERTY_TIMEZONE, TEST_TIME_ZONE_ID);
initialize(configuration, NtpBindingConstants.CHANNEL_DATE_TIME, ACCEPTED_ITEM_TYPE_DATE_TIME, null, null);
ZonedDateTime timeZoneIdFromItemRegistry = ((DateTimeType) getItemState(ACCEPTED_ITEM_TYPE_DATE_TIME))
.getZonedDateTime();

ZoneOffset expectedOffset = ZoneId.of(TEST_TIME_ZONE_ID).getRules()
.getOffset(timeZoneIdFromItemRegistry.toInstant());
assertEquals(expectedOffset, timeZoneIdFromItemRegistry.getOffset());
}

@Test
public void testStringChannelDefaultTimeZoneUpdate() {
final String expectedTimeZoneEEST = "EEST";
Expand All @@ -259,36 +228,6 @@ public void testStringChannelDefaultTimeZoneUpdate() {
assertThat(timeZoneFromItemRegistry, is(anyOf(equalTo(expectedTimeZoneEEST), equalTo(expectedTimeZoneEET))));
}

@Test
public void testDateTimeChannelDefaultTimeZoneUpdate() {
ZonedDateTime zoned = ZonedDateTime.now();

ZoneOffset expectedTimeZone = zoned.getOffset();
Configuration configuration = new Configuration();
// Initialize with configuration with no time zone property set.
initialize(configuration, NtpBindingConstants.CHANNEL_DATE_TIME, ACCEPTED_ITEM_TYPE_DATE_TIME, null, null);

String testItemState = getItemState(ACCEPTED_ITEM_TYPE_DATE_TIME).toString();
assertFormat(testItemState, DateTimeType.DATE_PATTERN_WITH_TZ_AND_MS);
ZoneOffset timeZoneFromItemRegistry = new DateTimeType(testItemState).getZonedDateTime().getOffset();

assertEquals(expectedTimeZone, timeZoneFromItemRegistry);
}

@Test
@Disabled("https://github.com/eclipse/smarthome/issues/5224")
public void testDateTimeChannelCalendarDefaultTimeZoneUpdate() {
Configuration configuration = new Configuration();
// Initialize with configuration with no time zone property set.
initialize(configuration, NtpBindingConstants.CHANNEL_DATE_TIME, ACCEPTED_ITEM_TYPE_DATE_TIME, null, null);

ZonedDateTime timeZoneIdFromItemRegistry = ((DateTimeType) getItemState(ACCEPTED_ITEM_TYPE_DATE_TIME))
.getZonedDateTime();

ZoneOffset expectedOffset = ZoneId.systemDefault().getRules().getOffset(timeZoneIdFromItemRegistry.toInstant());
assertEquals(expectedOffset, timeZoneIdFromItemRegistry.getOffset());
}

@Test
public void testStringChannelFormatting() {
final String formatPattern = "EEE, d MMM yyyy HH:mm:ss z";
Expand Down

0 comments on commit def3f83

Please sign in to comment.