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 java.io.IOException;
16 import java.nio.file.Path;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.junit.Test;
20 import org.openhab.binding.fmiweather.internal.client.exception.FMIResponseException;
21 import org.xml.sax.SAXParseException;
24 * Test cases for AbstractWeatherHandler. The tests provide mocks for supporting entities using Mockito.
26 * @author Sami Salonen - Initial contribution
29 public class FMIResponseParsingInvalidOrUnexpectedXmlTest extends AbstractFMIResponseParsingTest {
31 private Path observations1 = getTestResource("observations_single_place.xml");
33 @Test(expected = SAXParseException.class)
34 public void testInvalidXml() throws IOException, Throwable {
35 parseMultiPointCoverageXml(readTestResourceUtf8(observations1).replace("276.0", "<<"));
38 @Test(expected = FMIResponseException.class)
39 public void testUnexpectedXml() throws IOException, Throwable {
40 parseMultiPointCoverageXml(readTestResourceUtf8(observations1).replace("276.0", "<foo>4</foo>"));