Skip to content

Commit

Permalink
[mielecloud] Fix tests by adding missing email configuration parameter (
Browse files Browse the repository at this point in the history
openhab#12056)

The validation did not fail previously because it was broken and fixed in openhab/openhab-core#2683

Signed-off-by: Wouter Born <[email protected]>
Signed-off-by: Andras Uhrin <[email protected]>
  • Loading branch information
wborn authored and andrasU committed Nov 12, 2022
1 parent c067233 commit 90ba32e
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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<String> language = getHandler().getLanguage();
Expand All @@ -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<String> language = getHandler().getLanguage();
Expand All @@ -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();
Expand Down

0 comments on commit 90ba32e

Please sign in to comment.