2 * Copyright (c) 2010-2020 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.fmiweather;
15 import static org.hamcrest.CoreMatchers.*;
16 import static org.junit.Assert.*;
18 import java.math.BigDecimal;
19 import java.nio.file.Path;
22 import org.eclipse.jdt.annotation.NonNullByDefault;
23 import org.junit.Test;
24 import org.openhab.binding.fmiweather.internal.client.Location;
27 * Test cases for Client.parseStations
29 * @author Sami Salonen - Initial contribution
32 public class ParsingStationsTest extends AbstractFMIResponseParsingTest {
34 private Path stations_xml = getTestResource("stations.xml");
36 @SuppressWarnings("unchecked")
38 public void testParseStations() {
39 Set<Location> stations = parseStations(readTestResourceUtf8(stations_xml));
40 assertNotNull(stations);
41 assertThat(stations.size(), is(3));
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")))));