]> git.basschouten.com Git - openhab-addons.git/blob
59b80335ee23905aa2ac14b2d7a8eb4e0c41f09c
[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.homematic.internal.converter;
14
15 import static org.hamcrest.CoreMatchers.instanceOf;
16 import static org.hamcrest.MatcherAssert.assertThat;
17
18 import org.junit.jupiter.api.Test;
19 import org.openhab.binding.homematic.internal.converter.type.DecimalTypeConverter;
20 import org.openhab.binding.homematic.internal.converter.type.OnOffTypeConverter;
21 import org.openhab.binding.homematic.internal.converter.type.OpenClosedTypeConverter;
22 import org.openhab.binding.homematic.internal.converter.type.PercentTypeConverter;
23 import org.openhab.binding.homematic.internal.converter.type.QuantityTypeConverter;
24 import org.openhab.binding.homematic.internal.converter.type.StringTypeConverter;
25
26 /**
27  * Tests for {@link ConverterFactory}.
28  *
29  * @author Michael Reitler - Initial Contribution
30  *
31  */
32 public class ConverterFactoryTest {
33
34     @Test
35     public void testTypesOfCreatedConverters() throws ConverterException {
36         assertThat(ConverterFactory.createConverter("Switch"), instanceOf(OnOffTypeConverter.class));
37         assertThat(ConverterFactory.createConverter("Rollershutter"), instanceOf(PercentTypeConverter.class));
38         assertThat(ConverterFactory.createConverter("Dimmer"), instanceOf(PercentTypeConverter.class));
39         assertThat(ConverterFactory.createConverter("Contact"), instanceOf(OpenClosedTypeConverter.class));
40         assertThat(ConverterFactory.createConverter("String"), instanceOf(StringTypeConverter.class));
41         assertThat(ConverterFactory.createConverter("Number"), instanceOf(DecimalTypeConverter.class));
42         assertThat(ConverterFactory.createConverter("Number:Temperature"), instanceOf(QuantityTypeConverter.class));
43         assertThat(ConverterFactory.createConverter("Number:Percent"), instanceOf(QuantityTypeConverter.class));
44     }
45 }