]> git.basschouten.com Git - openhab-addons.git/blob
0dca9013ed9209fa79a823f5fd4dde78d374ed0a
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.sonos.internal;
14
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19
20 /**
21  *
22  * @author Laurent Garnier - Initial contribution
23  */
24 @NonNullByDefault
25 public class SonosXMLParserTest {
26
27     @Test
28     public void buildThingTypeIdFromModelWithoutSpace() {
29         assertEquals("Move", SonosXMLParser.buildThingTypeIdFromModelName("Sonos Move"));
30     }
31
32     @Test
33     public void buildThingTypeIdFromModelWithSpace() {
34         assertEquals("RoamSL", SonosXMLParser.buildThingTypeIdFromModelName("Sonos Roam SL"));
35     }
36
37     @Test
38     public void buildThingTypeIdFromModelWithColon() {
39         assertEquals("PLAY5", SonosXMLParser.buildThingTypeIdFromModelName("Sonos PLAY:5"));
40     }
41
42     @Test
43     public void buildThingTypeIdFromSymfoniskModel() {
44         assertEquals("SYMFONISK", SonosXMLParser.buildThingTypeIdFromModelName("SYMFONISK Table lamp"));
45         assertEquals("SYMFONISK", SonosXMLParser.buildThingTypeIdFromModelName("Symfonisk Table lamp"));
46         assertEquals("SYMFONISK", SonosXMLParser.buildThingTypeIdFromModelName("Sonos Symfonisk"));
47     }
48
49     @Test
50     public void buildThingTypeIdFromZP80Model() {
51         assertEquals("CONNECT", SonosXMLParser.buildThingTypeIdFromModelName("Sonos ZP80"));
52     }
53
54     @Test
55     public void buildThingTypeIdFromZP100Model() {
56         assertEquals("CONNECTAMP", SonosXMLParser.buildThingTypeIdFromModelName("Sonos ZP100"));
57     }
58
59     @Test
60     public void buildThingTypeIdFromModelWithAdditionalTextInParenthesis() {
61         assertEquals("OneSL", SonosXMLParser.buildThingTypeIdFromModelName("Sonos One SL (OpenHome)"));
62     }
63 }