2 * Copyright (c) 2010-2023 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.hamcrest.MatcherAssert.assertThat;
17 import static org.junit.jupiter.api.Assertions.assertNotNull;
19 import java.math.BigDecimal;
20 import java.nio.file.Path;
23 import org.eclipse.jdt.annotation.NonNullByDefault;
24 import org.junit.jupiter.api.Test;
25 import org.openhab.binding.fmiweather.internal.client.Location;
28 * Test cases for Client.parseStations
30 * @author Sami Salonen - Initial contribution
33 public class ParsingStationsTest extends AbstractFMIResponseParsingTest {
35 private Path stations_xml = getTestResource("stations.xml");
37 @SuppressWarnings("unchecked")
39 public void testParseStations() {
40 Set<Location> stations = parseStations(readTestResourceUtf8(stations_xml));
41 assertNotNull(stations);
42 assertThat(stations.size(), is(3));
45 deeplyEqualTo(new Location("Porvoo Kilpilahti satama", "100683", new BigDecimal("60.303725"),
46 new BigDecimal("25.549164"))),
47 deeplyEqualTo(new Location("Parainen Utö", "100908", new BigDecimal("59.779094"),
48 new BigDecimal("21.374788"))),
49 deeplyEqualTo(new Location("Lemland Nyhamn", "100909", new BigDecimal("59.959194"),
50 new BigDecimal("19.953667")))));