2 * Copyright (c) 2010-2024 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.netatmo.internal.api.data;
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16 import static org.openhab.binding.netatmo.internal.NetatmoBindingConstants.BINDING_ID;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.junit.jupiter.api.Test;
24 * @author Gaƫl L'hopital - Initial contribution
27 public class ModuleTypeTest {
28 public URI getConfigDescription(ModuleType mt) {
29 if (mt == ModuleType.WELCOME || mt == ModuleType.PRESENCE || mt == ModuleType.DOORBELL) {
30 // This did not exist prior to PR #16492
31 return URI.create(BINDING_ID + ":camera");
33 // This was previous method for calculating configuration URI
34 return URI.create(BINDING_ID + ":"
35 + (mt == ModuleType.ACCOUNT ? "api_bridge"
36 : mt == ModuleType.HOME ? "home"
37 : (mt.isLogical() ? "virtual"
38 : ModuleType.UNKNOWN == mt.getBridge() ? "configurable" : "device")));
42 public void checkConfigDescription() {
43 ModuleType.AS_SET.stream().forEach(mt -> {
44 if (mt != ModuleType.WELCOME) {
45 URI confDesc = mt.configDescription;
46 assertEquals(getConfigDescription(mt), confDesc);