]> git.basschouten.com Git - openhab-addons.git/blob
165e02637f7e24c6f094dce2e44c61b82c55d9dc
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.persistence.dynamodb.internal;
14
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16
17 import java.io.IOException;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.junit.jupiter.api.Test;
21 import org.openhab.core.library.items.CallItem;
22 import org.openhab.core.library.items.ColorItem;
23 import org.openhab.core.library.items.ContactItem;
24 import org.openhab.core.library.items.DateTimeItem;
25 import org.openhab.core.library.items.DimmerItem;
26 import org.openhab.core.library.items.LocationItem;
27 import org.openhab.core.library.items.NumberItem;
28 import org.openhab.core.library.items.PlayerItem;
29 import org.openhab.core.library.items.RollershutterItem;
30 import org.openhab.core.library.items.StringItem;
31 import org.openhab.core.library.items.SwitchItem;
32
33 /**
34  * Test for AbstractDynamoDBItem.getDynamoItemClass
35  *
36  * @author Sami Salonen - Initial contribution
37  */
38 @NonNullByDefault
39 public class AbstractDynamoDBItemGetDynamoItemClassTest {
40
41     @Test
42     public void testCallItem() throws IOException {
43         assertEquals(DynamoDBStringItem.class, AbstractDynamoDBItem.getDynamoItemClass(CallItem.class));
44     }
45
46     @Test
47     public void testContactItem() throws IOException {
48         assertEquals(DynamoDBBigDecimalItem.class, AbstractDynamoDBItem.getDynamoItemClass(ContactItem.class));
49     }
50
51     @Test
52     public void testDateTimeItem() throws IOException {
53         assertEquals(DynamoDBStringItem.class, AbstractDynamoDBItem.getDynamoItemClass(DateTimeItem.class));
54     }
55
56     @Test
57     public void testStringItem() throws IOException {
58         assertEquals(DynamoDBStringItem.class, AbstractDynamoDBItem.getDynamoItemClass(StringItem.class));
59     }
60
61     @Test
62     public void testLocationItem() throws IOException {
63         assertEquals(DynamoDBStringItem.class, AbstractDynamoDBItem.getDynamoItemClass(LocationItem.class));
64     }
65
66     @Test
67     public void testNumberItem() throws IOException {
68         assertEquals(DynamoDBBigDecimalItem.class, AbstractDynamoDBItem.getDynamoItemClass(NumberItem.class));
69     }
70
71     @Test
72     public void testColorItem() throws IOException {
73         assertEquals(DynamoDBStringItem.class, AbstractDynamoDBItem.getDynamoItemClass(ColorItem.class));
74     }
75
76     @Test
77     public void testDimmerItem() throws IOException {
78         assertEquals(DynamoDBBigDecimalItem.class, AbstractDynamoDBItem.getDynamoItemClass(DimmerItem.class));
79     }
80
81     @Test
82     public void testPlayerItem() throws IOException {
83         assertEquals(DynamoDBStringItem.class, AbstractDynamoDBItem.getDynamoItemClass(PlayerItem.class));
84     }
85
86     @Test
87     public void testRollershutterItem() throws IOException {
88         assertEquals(DynamoDBBigDecimalItem.class, AbstractDynamoDBItem.getDynamoItemClass(RollershutterItem.class));
89     }
90
91     @Test
92     public void testOnOffTypeWithSwitchItem() throws IOException {
93         assertEquals(DynamoDBBigDecimalItem.class, AbstractDynamoDBItem.getDynamoItemClass(SwitchItem.class));
94     }
95 }