2 * Copyright (c) 2010-2023 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.mybmw.internal.dto;
15 import static org.junit.jupiter.api.Assertions.assertEquals;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19 import org.openhab.binding.mybmw.internal.dto.charge.ChargeProfile;
20 import org.openhab.binding.mybmw.internal.dto.vehicle.Vehicle;
21 import org.openhab.binding.mybmw.internal.util.FileReader;
22 import org.openhab.binding.mybmw.internal.utils.ChargeProfileWrapper;
23 import org.openhab.binding.mybmw.internal.utils.Constants;
24 import org.openhab.binding.mybmw.internal.utils.Converter;
27 * The {@link ChargeProfileTest} is testing locale settings
29 * @author Bernd Weymann - Initial contribution
32 public class ChargeProfileTest {
35 public void testWeeklyPlanner() {
36 String json = FileReader
37 .readFileInString("src/test/resources/responses/chargingprofile/weekly-planner-t2-active.json");
38 Vehicle v = Converter.getVehicle(Constants.ANONYMOUS, json);
39 ChargeProfile cp = v.status.chargingProfile;
40 String cpJson = Converter.getGson().toJson(cp);
41 ChargeProfileWrapper cpw = new ChargeProfileWrapper(v.status.chargingProfile);
42 assertEquals(cpJson, cpw.getJson(), "JSON comparison");
46 public void testTwoWeeksPlanner() {
47 String json = FileReader.readFileInString("src/test/resources/responses/chargingprofile/two-weeks-timer.json");
48 Vehicle v = Converter.getVehicle(Constants.ANONYMOUS, json);
49 ChargeProfile cp = v.status.chargingProfile;
50 String cpJson = Converter.getGson().toJson(cp);
51 ChargeProfileWrapper cpw = new ChargeProfileWrapper(v.status.chargingProfile);
52 assertEquals(cpJson, cpw.getJson(), "JSON comparison");