2 * Copyright (c) 2010-2022 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.deutschebahn.internal.timetable;
15 import java.net.URISyntaxException;
16 import java.util.List;
18 import javax.xml.bind.JAXBException;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.binding.deutschebahn.internal.timetable.TimetablesV1Impl.HttpCallable;
22 import org.xml.sax.SAXException;
25 * Testmodule that contains the {@link TimetablesV1Api} and {@link TimetableStubHttpCallable}.
26 * Used in tests to check which http calls have been made.
28 * @author Sönke Küper - Initial contribution.
31 public final class TimetablesApiTestModule {
33 private final TimetablesV1Api api;
34 private final TimetableStubHttpCallable httpStub;
36 public TimetablesApiTestModule(TimetablesV1Api api, TimetableStubHttpCallable httpStub) {
38 this.httpStub = httpStub;
41 public TimetablesV1Api getApi() {
45 public void addAvailableUrl(String url) {
46 this.httpStub.addAvailableUrl(url);
49 public List<String> getRequestedPlanUrls() {
50 return httpStub.getRequestedPlanUrls();
53 public List<String> getRequestedFullChangesUrls() {
54 return httpStub.getRequestedFullChangesUrls();
57 public List<String> getRequestedRecentChangesUrls() {
58 return httpStub.getRequestedRecentChangesUrls();
61 public TimetablesV1ApiFactory getApiFactory() {
62 return new TimetablesV1ApiFactory() {
65 public TimetablesV1Api create(String authToken, HttpCallable httpCallable)
66 throws JAXBException, SAXException, URISyntaxException {