]> git.basschouten.com Git - openhab-addons.git/blob
c5133ed0ae5801789872de27e867e854737efa16
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.mybmw.internal.utils;
14
15 import static org.junit.jupiter.api.Assertions.assertFalse;
16 import static org.junit.jupiter.api.Assertions.assertTrue;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.junit.jupiter.api.Test;
20 import org.openhab.binding.mybmw.internal.MyBMWBridgeConfiguration;
21
22 /**
23  * 
24  * checks if the configuration checker works fine
25  * 
26  * @author Bernd Weymann - Initial contribution
27  * @author Martin Grassl - renamed
28  */
29 @NonNullByDefault
30 public class MyBMWConfigurationCheckerTest {
31     @Test
32     void testCheckConfiguration() {
33         MyBMWBridgeConfiguration cdc = new MyBMWBridgeConfiguration();
34         assertFalse(MyBMWConfigurationChecker.checkConfiguration(cdc));
35         cdc.userName = "a";
36         assertFalse(MyBMWConfigurationChecker.checkConfiguration(cdc));
37         cdc.password = "b";
38         assertFalse(MyBMWConfigurationChecker.checkConfiguration(cdc));
39         cdc.region = "c";
40         assertFalse(MyBMWConfigurationChecker.checkConfiguration(cdc));
41         cdc.region = BimmerConstants.REGION_NORTH_AMERICA;
42         assertTrue(MyBMWConfigurationChecker.checkConfiguration(cdc));
43         cdc.region = BimmerConstants.REGION_ROW;
44         assertTrue(MyBMWConfigurationChecker.checkConfiguration(cdc));
45         cdc.region = BimmerConstants.REGION_CHINA;
46         assertTrue(MyBMWConfigurationChecker.checkConfiguration(cdc));
47     }
48 }