]> git.basschouten.com Git - openhab-addons.git/blob
50fcf7fb6aab2f45bb20a504ece544bb1baa48d5
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.is;
16 import static org.hamcrest.MatcherAssert.assertThat;
17 import static org.junit.jupiter.api.Assertions.assertNotNull;
18
19 import java.nio.file.Path;
20
21 import org.junit.jupiter.api.BeforeEach;
22 import org.junit.jupiter.api.Test;
23 import org.openhab.binding.fmiweather.internal.client.Client;
24 import org.openhab.binding.fmiweather.internal.client.FMIResponse;
25
26 /**
27  * Test cases for {@link Client.parseMultiPointCoverageXml} with an "empty" (no data) XML response
28  *
29  * @author Sami Salonen - Initial contribution
30  */
31 public class FMIResponseParsingEmptyTest extends AbstractFMIResponseParsingTest {
32
33     private Path observations = getTestResource("observations_empty.xml");
34
35     private FMIResponse observationsResponse;
36
37     @BeforeEach
38     public void setUp() {
39         client = new Client();
40         try {
41             observationsResponse = parseMultiPointCoverageXml(readTestResourceUtf8(observations));
42         } catch (Throwable e) {
43             throw new RuntimeException("Test data malformed", e);
44         }
45         assertNotNull(observationsResponse);
46     }
47
48     @Test
49     public void testLocationsSinglePlace() throws Throwable {
50         assertThat(observationsResponse.getLocations().size(), is(0));
51     }
52 }