]> git.basschouten.com Git - openhab-addons.git/blob
7fdca008eb43652883db61e39fb705b726a4ed7a
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.bmwconnecteddrive.internal.dto;
14
15 import static org.junit.jupiter.api.Assertions.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19 import org.openhab.binding.bmwconnecteddrive.internal.dto.charge.ChargeProfile;
20 import org.openhab.binding.bmwconnecteddrive.internal.util.FileReader;
21
22 import com.google.gson.Gson;
23
24 /**
25  * The {@link ChargeProfileTest} Test json responses from ConnectedDrive Portal
26  *
27  * @author Bernd Weymann - Initial contribution
28  */
29 @NonNullByDefault
30 @SuppressWarnings("null")
31 public class ChargeProfileTest {
32     private static final Gson GSON = new Gson();
33
34     @Test
35     public void testChargeProfile() {
36         String resource1 = FileReader.readFileInString("src/test/resources/webapi/charging-profile.json");
37         ChargeProfile cp = GSON.fromJson(resource1, ChargeProfile.class);
38         assertNotNull(cp.weeklyPlanner);
39         assertNotNull(cp.weeklyPlanner.timer1);
40         assertFalse(cp.weeklyPlanner.timer1.timerEnabled);
41         assertNotNull(cp.weeklyPlanner.timer1.weekdays);
42         assertEquals(5, cp.weeklyPlanner.timer1.weekdays.size(), "Days");
43     }
44 }