]> git.basschouten.com Git - openhab-addons.git/blob
ece9eaafd5c667a407f475ab01101e00ab02ecd6
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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 static org.junit.jupiter.api.Assertions.*;
16
17 import java.io.File;
18 import java.net.URL;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21
22 /**
23  * Helper interface for jUnit Tests to provide an {@link TimetablesApiTestModule}.
24  * 
25  * @author Sönke Küper - initial contribution.
26  */
27 @NonNullByDefault
28 public interface TimetablesV1ImplTestHelper {
29
30     public static final String EVA_LEHRTE = "8000226";
31     public static final String EVA_HANNOVER_HBF = "8000152";
32     public static final String AUTH_TOKEN = "354c8161cd7fb0936c840240280c131e";
33
34     /**
35      * Creates an {@link TimetablesApiTestModule} that uses http response data from file system.
36      */
37     public default TimetablesApiTestModule createApiWithTestdata() throws Exception {
38         final URL timetablesData = getClass().getResource("/timetablesData");
39         assertNotNull(timetablesData);
40         final File testDataDir = new File(timetablesData.toURI());
41         final TimetableStubHttpCallable httpStub = new TimetableStubHttpCallable(testDataDir);
42         final TimetablesV1Impl timeTableApi = new TimetablesV1Impl(AUTH_TOKEN, httpStub);
43         return new TimetablesApiTestModule(timeTableApi, httpStub);
44     }
45 }