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.sensorcommunity.internal.mock;
15 import java.util.ArrayList;
16 import java.util.HashMap;
17 import java.util.List;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.core.config.core.Configuration;
23 import org.openhab.core.thing.Channel;
24 import org.openhab.core.thing.ChannelUID;
25 import org.openhab.core.thing.Thing;
26 import org.openhab.core.thing.ThingStatus;
27 import org.openhab.core.thing.ThingStatusDetail;
28 import org.openhab.core.thing.ThingStatusInfo;
29 import org.openhab.core.thing.ThingTypeUID;
30 import org.openhab.core.thing.ThingUID;
31 import org.openhab.core.thing.binding.ThingHandler;
34 * The {@link ThingMock} Thing Mock
36 * @author Bernd Weymann - Initial contribution
39 public class ThingMock implements Thing {
40 private Configuration config = new Configuration();
43 public @Nullable String getLabel() {
48 public void setLabel(@Nullable String label) {
52 public List<Channel> getChannels() {
53 return new ArrayList<Channel>();
57 public List<Channel> getChannelsOfGroup(String channelGroupId) {
58 return new ArrayList<Channel>();
62 public @Nullable Channel getChannel(String channelId) {
67 public @Nullable Channel getChannel(ChannelUID channelUID) {
72 public ThingStatus getStatus() {
73 return ThingStatus.UNKNOWN;
77 public ThingStatusInfo getStatusInfo() {
78 return new ThingStatusInfo(ThingStatus.UNKNOWN, ThingStatusDetail.NONE, "");
82 public void setStatusInfo(ThingStatusInfo status) {
86 public void setHandler(@Nullable ThingHandler thingHandler) {
90 public @Nullable ThingHandler getHandler() {
95 public @Nullable ThingUID getBridgeUID() {
100 public void setBridgeUID(@Nullable ThingUID bridgeUID) {
104 public Configuration getConfiguration() {
108 public void setConfiguration(Map<String, Object> m) {
109 config = new Configuration(m);
113 public ThingUID getUID() {
114 return new ThingUID("sensorcommunity", "test");
118 public ThingTypeUID getThingTypeUID() {
119 return new ThingTypeUID("sensorcommunity:any");
123 public Map<String, String> getProperties() {
124 return new HashMap<String, String>();
128 public @Nullable String setProperty(String name, @Nullable String value) {
133 public void setProperties(Map<String, String> properties) {
137 public @Nullable String getLocation() {
142 public void setLocation(@Nullable String location) {
146 public boolean isEnabled() {