]> git.basschouten.com Git - openhab-addons.git/blob
a4e3389f6a5e23e088e5c8b370b888ef172180d3
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.fmiweather;
14
15 import static org.hamcrest.CoreMatchers.*;
16 import static org.junit.Assert.*;
17
18 import java.math.BigDecimal;
19 import java.nio.file.Path;
20 import java.util.Set;
21
22 import org.eclipse.jdt.annotation.NonNullByDefault;
23 import org.junit.Test;
24 import org.openhab.binding.fmiweather.internal.client.Location;
25
26 /**
27  * Test cases for Client.parseStations
28  *
29  * @author Sami Salonen - Initial contribution
30  */
31 @NonNullByDefault
32 public class ParsingStationsTest extends AbstractFMIResponseParsingTest {
33
34     private Path stations_xml = getTestResource("stations.xml");
35
36     @SuppressWarnings("unchecked")
37     @Test
38     public void testParseStations() {
39         Set<Location> stations = parseStations(readTestResourceUtf8(stations_xml));
40         assertNotNull(stations);
41         assertThat(stations.size(), is(3));
42         assertThat(stations,
43                 hasItems(
44                         deeplyEqualTo(new Location("Porvoo Kilpilahti satama", "100683", new BigDecimal("60.303725"),
45                                 new BigDecimal("25.549164"))),
46                         deeplyEqualTo(new Location("Parainen Utö", "100908", new BigDecimal("59.779094"),
47                                 new BigDecimal("21.374788"))),
48                         deeplyEqualTo(new Location("Lemland Nyhamn", "100909", new BigDecimal("59.959108"),
49                                 new BigDecimal("19.953736")))));
50     }
51 }