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