From 90ba32e0d35ed30643cfacca3cb341e725aa1b4e Mon Sep 17 00:00:00 2001 From: Wouter Born Date: Sat, 15 Jan 2022 21:27:59 +0100 Subject: [PATCH] [mielecloud] Fix tests by adding missing email configuration parameter (#12056) The validation did not fail previously because it was broken and fixed in https://github.com/openhab/openhab-core/pull/2683 Signed-off-by: Wouter Born Signed-off-by: Andras Uhrin --- .../internal/handler/MieleBridgeHandlerTest.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/MieleBridgeHandlerTest.java b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/MieleBridgeHandlerTest.java index dced3f4fc4fd6..8592c14cb4432 100644 --- a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/MieleBridgeHandlerTest.java +++ b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/MieleBridgeHandlerTest.java @@ -18,7 +18,7 @@ import static org.openhab.binding.mielecloud.internal.util.MieleCloudBindingIntegrationTestConstants.*; import static org.openhab.binding.mielecloud.internal.util.ReflectionUtil.*; -import java.util.Collections; +import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -126,9 +126,8 @@ private void setUpBridgeThingAndHandler() { bridge = BridgeBuilder .create(MieleCloudBindingConstants.THING_TYPE_BRIDGE, MieleCloudBindingIntegrationTestConstants.BRIDGE_THING_UID) - .withConfiguration( - new Configuration(Collections.singletonMap(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, - MieleCloudBindingIntegrationTestConstants.EMAIL))) + .withConfiguration(new Configuration(Map.of(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, + MieleCloudBindingIntegrationTestConstants.EMAIL))) .withLabel(MIELE_CLOUD_ACCOUNT_LABEL).build(); assertNotNull(bridge); @@ -484,7 +483,8 @@ public void testNoLanguageIsReturnedWhenTheConfigurationParameterIsNotSet() { @Test public void testNoLanguageIsReturnedWhenTheConfigurationParameterIsEmpty() { // given: - getHandler().handleConfigurationUpdate(Collections.singletonMap(CONFIG_PARAM_LOCALE, "")); + getHandler().handleConfigurationUpdate( + Map.of(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, SERVICE_HANDLE, CONFIG_PARAM_LOCALE, "")); // when: Optional language = getHandler().getLanguage(); @@ -496,7 +496,8 @@ public void testNoLanguageIsReturnedWhenTheConfigurationParameterIsEmpty() { @Test public void testNoLanguageIsReturnedWhenTheConfigurationParameterIsNotAValidTwoLetterLanguageCode() { // given: - getHandler().handleConfigurationUpdate(Collections.singletonMap(CONFIG_PARAM_LOCALE, "Deutsch")); + getHandler().handleConfigurationUpdate( + Map.of(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, SERVICE_HANDLE, CONFIG_PARAM_LOCALE, "Deutsch")); // when: Optional language = getHandler().getLanguage(); @@ -508,7 +509,8 @@ public void testNoLanguageIsReturnedWhenTheConfigurationParameterIsNotAValidTwoL @Test public void testAValidTwoLetterLanguageCodeIsReturnedWhenTheConfigurationParameterIsSetToTheTwoLetterLanguageCode() { // given: - getHandler().handleConfigurationUpdate(Collections.singletonMap(CONFIG_PARAM_LOCALE, "DE")); + getHandler().handleConfigurationUpdate( + Map.of(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, SERVICE_HANDLE, CONFIG_PARAM_LOCALE, "DE")); // when: String language = getHandler().getLanguage().get();