]> git.basschouten.com Git - openhab-addons.git/blob
d10a1ac698e0846a6110429da90b26f90ac3728e
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.deutschebahn.internal.timetable;
14
15 import java.util.List;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.deutschebahn.internal.timetable.TimetablesV1Impl.HttpCallable;
19
20 /**
21  * Testmodule that contains the {@link TimetablesV1Api} and {@link TimetableStubHttpCallable}.
22  * Used in tests to check which http calls have been made.
23  * 
24  * @author Sönke Küper - Initial contribution.
25  */
26 @NonNullByDefault
27 public final class TimetablesApiTestModule {
28
29     private final TimetablesV1Api api;
30     private final TimetableStubHttpCallable httpStub;
31
32     public TimetablesApiTestModule(TimetablesV1Api api, TimetableStubHttpCallable httpStub) {
33         this.api = api;
34         this.httpStub = httpStub;
35     }
36
37     public TimetablesV1Api getApi() {
38         return api;
39     }
40
41     public void addAvailableUrl(String url) {
42         this.httpStub.addAvailableUrl(url);
43     }
44
45     public List<String> getRequestedPlanUrls() {
46         return httpStub.getRequestedPlanUrls();
47     }
48
49     public List<String> getRequestedFullChangesUrls() {
50         return httpStub.getRequestedFullChangesUrls();
51     }
52
53     public List<String> getRequestedRecentChangesUrls() {
54         return httpStub.getRequestedRecentChangesUrls();
55     }
56
57     public TimetablesV1ApiFactory getApiFactory() {
58         return (String clientId, String clientSecret, HttpCallable httpCallable) -> api;
59     }
60 }