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.bmwconnecteddrive.internal.dto;
15 import static org.junit.jupiter.api.Assertions.*;
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;
22 import com.google.gson.Gson;
25 * The {@link ChargeProfileTest} Test json responses from ConnectedDrive Portal
27 * @author Bernd Weymann - Initial contribution
30 @SuppressWarnings("null")
31 public class ChargeProfileTest {
32 private static final Gson GSON = new Gson();
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");