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.junit.jupiter.api.Assertions.assertThrows;
17 import java.nio.file.Path;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.junit.jupiter.api.Test;
21 import org.openhab.binding.fmiweather.internal.client.exception.FMIResponseException;
22 import org.xml.sax.SAXParseException;
25 * Test cases for AbstractWeatherHandler. The tests provide mocks for supporting entities using Mockito.
27 * @author Sami Salonen - Initial contribution
30 public class FMIResponseParsingInvalidOrUnexpectedXmlTest extends AbstractFMIResponseParsingTest {
32 private Path observations1 = getTestResource("observations_single_place.xml");
35 public void testInvalidXml() {
36 assertThrows(SAXParseException.class,
37 () -> parseMultiPointCoverageXml(readTestResourceUtf8(observations1).replace("276.0", "<<")));
41 public void testUnexpectedXml() {
42 assertThrows(FMIResponseException.class,
43 () -> parseMultiPointCoverageXml(readTestResourceUtf8(observations1).replace("276.0", "<foo>4</foo>")));