2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mielecloud.internal.config.servlet;
15 import static org.junit.jupiter.api.Assertions.assertEquals;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19 import org.openhab.binding.mielecloud.internal.util.AbstractConfigFlowTest;
20 import org.openhab.binding.mielecloud.internal.util.MieleCloudBindingIntegrationTestConstants;
21 import org.openhab.binding.mielecloud.internal.util.Website;
24 * @author Björn Lange - Initial Contribution
27 public class PairAccountServletTest extends AbstractConfigFlowTest {
28 private static final String CLIENT_ID_INPUT_NAME = "clientId";
29 private static final String CLIENT_SECRET_INPUT_NAME = "clientSecret";
32 public void whenPairAccountIsInvokedWithClientIdParameterThenTheParameterIsPlacedInTheInputBox() throws Exception {
34 Website pairAccountSite = getCrawler()
35 .doGetRelative("/mielecloud/pair?" + PairAccountServlet.CLIENT_ID_PARAMETER_NAME + "="
36 + MieleCloudBindingIntegrationTestConstants.CLIENT_ID);
39 assertEquals(MieleCloudBindingIntegrationTestConstants.CLIENT_ID,
40 pairAccountSite.getValueOfInput(CLIENT_ID_INPUT_NAME));
41 assertEquals("", pairAccountSite.getValueOfInput(CLIENT_SECRET_INPUT_NAME));
45 public void whenPairAccountIsInvokedWithClientSecretParameterThenTheParameterIsPlacedInTheInputBox()
48 Website pairAccountSite = getCrawler()
49 .doGetRelative("/mielecloud/pair?" + PairAccountServlet.CLIENT_SECRET_PARAMETER_NAME + "="
50 + MieleCloudBindingIntegrationTestConstants.CLIENT_SECRET);
53 assertEquals("", pairAccountSite.getValueOfInput(CLIENT_ID_INPUT_NAME));
54 assertEquals(MieleCloudBindingIntegrationTestConstants.CLIENT_SECRET,
55 pairAccountSite.getValueOfInput(CLIENT_SECRET_INPUT_NAME));