* Fix build
* fix itest

Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
J-N-K 2022-07-20 20:40:42 +02:00 committed by GitHub
parent 253a634f0a
commit 7855f81760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -127,10 +127,11 @@ public final class CreateBridgeServlet extends AbstractRedirectionServlet {
.withProperty(Thing.PROPERTY_MODEL_ID, MIELE_CLOUD_BRIDGE_NAME)
.withProperty(MieleCloudBindingConstants.CONFIG_PARAM_LOCALE, locale)
.withProperty(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, email).build();
if (inbox.add(result)) {
return pairBridge(bridgeUid);
} else {
if (thingRegistry.get(bridgeUid) != null) {
return reconfigureBridge(bridgeUid);
} else {
inbox.add(result);
return pairBridge(bridgeUid);
}
}

View File

@ -25,6 +25,7 @@ import org.junit.jupiter.api.Test;
import org.openhab.binding.mielecloud.internal.MieleCloudBindingConstants;
import org.openhab.binding.mielecloud.internal.auth.OAuthTokenRefresher;
import org.openhab.binding.mielecloud.internal.config.MieleCloudConfigService;
import org.openhab.binding.mielecloud.internal.config.exception.BridgeReconfigurationFailedException;
import org.openhab.binding.mielecloud.internal.util.AbstractConfigFlowTest;
import org.openhab.binding.mielecloud.internal.util.MieleCloudBindingIntegrationTestConstants;
import org.openhab.binding.mielecloud.internal.util.Website;
@ -48,7 +49,6 @@ public class CreateBridgeServletTest extends AbstractConfigFlowTest {
assertNotNull(createBridgeServlet);
Inbox inbox = mock(Inbox.class);
when(inbox.add(any())).thenReturn(true);
when(inbox.approve(any(), anyString(), anyString())).thenReturn(null);
setPrivate(Objects.requireNonNull(createBridgeServlet), "inbox", inbox);
@ -74,11 +74,10 @@ public class CreateBridgeServletTest extends AbstractConfigFlowTest {
assertNotNull(createBridgeServlet);
Inbox inbox = mock(Inbox.class);
when(inbox.add(any())).thenReturn(false);
setPrivate(Objects.requireNonNull(createBridgeServlet), "inbox", inbox);
ThingRegistry thingRegistry = mock(ThingRegistry.class);
when(thingRegistry.get(any())).thenReturn(null);
when(thingRegistry.get(any())).thenThrow(new BridgeReconfigurationFailedException(""));
setPrivate(Objects.requireNonNull(createBridgeServlet), "thingRegistry", thingRegistry);
// when:
@ -104,7 +103,6 @@ public class CreateBridgeServletTest extends AbstractConfigFlowTest {
assertNotNull(createBridgeServlet);
Inbox inbox = mock(Inbox.class);
when(inbox.add(any())).thenReturn(false);
setPrivate(Objects.requireNonNull(createBridgeServlet), "inbox", inbox);
Thing bridge = mock(Thing.class);