mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Remove obsoleted test methods (#17871)
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
f39415b631
commit
5cd8140d73
@ -19,7 +19,6 @@ import static org.mockito.ArgumentMatchers.any;
|
|||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZoneOffset;
|
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -30,7 +29,6 @@ import org.junit.jupiter.api.AfterAll;
|
|||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentMatchers;
|
import org.mockito.ArgumentMatchers;
|
||||||
import org.openhab.binding.ntp.internal.NtpBindingConstants;
|
import org.openhab.binding.ntp.internal.NtpBindingConstants;
|
||||||
@ -209,35 +207,6 @@ public class NtpOSGiTest extends JavaOSGiTest {
|
|||||||
assertThat(timeZoneFromItemRegistry, is(anyOf(equalTo(expectedTimeZonePDT), equalTo(expectedTimeZonePST))));
|
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
|
@Test
|
||||||
public void testStringChannelDefaultTimeZoneUpdate() {
|
public void testStringChannelDefaultTimeZoneUpdate() {
|
||||||
final String expectedTimeZoneEEST = "EEST";
|
final String expectedTimeZoneEEST = "EEST";
|
||||||
@ -259,36 +228,6 @@ public class NtpOSGiTest extends JavaOSGiTest {
|
|||||||
assertThat(timeZoneFromItemRegistry, is(anyOf(equalTo(expectedTimeZoneEEST), equalTo(expectedTimeZoneEET))));
|
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
|
@Test
|
||||||
public void testStringChannelFormatting() {
|
public void testStringChannelFormatting() {
|
||||||
final String formatPattern = "EEE, d MMM yyyy HH:mm:ss z";
|
final String formatPattern = "EEE, d MMM yyyy HH:mm:ss z";
|
||||||
|
Loading…
Reference in New Issue
Block a user