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.is;
16 import static org.hamcrest.MatcherAssert.assertThat;
17 import static org.junit.jupiter.api.Assertions.fail;
19 import java.nio.file.Path;
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.junit.jupiter.api.Test;
23 import org.openhab.binding.fmiweather.internal.client.exception.FMIResponseException;
26 * Test cases for AbstractWeatherHandler. The tests provide mocks for supporting entities using Mockito.
28 * @author Sami Salonen - Initial contribution
31 public class FMIResponseParsingExceptionReportTest extends AbstractFMIResponseParsingTest {
33 private Path error1 = getTestResource("error1.xml");
36 public void testErrorResponse() {
38 parseMultiPointCoverageXml(readTestResourceUtf8(error1));
39 } catch (FMIResponseException e) {
41 assertThat(e.getMessage(), is(
42 "Exception report (OperationParsingFailed): [Invalid time interval!, The start time is later than the end time., URI: /wfs?endtime=1900-03-10T20%3A10%3A00Z&fmisid=101023¶meters=t2m%2Crh%2Cwd_10min%2Cws_10min%2Cwg_10min%2Cp_sea&request=getFeature&service=WFS&starttime=2019-03-10T10%3A10%3A00Z&storedquery_id=fmi%3A%3Aobservations%3A%3Aweather%3A%3Amultipointcoverage×tep=60&version=2.0.0]"));
44 } catch (Throwable e) {
45 fail("Wrong exception, was " + e.getClass().getName());
47 fail("FMIResponseException expected");