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.vehicle;
15 import static org.junit.jupiter.api.Assertions.assertEquals;
17 import org.junit.jupiter.api.Test;
18 import org.openhab.binding.mybmw.internal.handler.backend.JsonStringDeserializer;
19 import org.openhab.binding.mybmw.internal.util.FileReader;
23 * checks the transformation of the capabilities to string lists
25 * @author Bernd Weymann - Initial contribution
26 * @author Martin Grassl - refactoring
28 public class VehicleCapabilitiesTest {
30 void testGetCapabilitiesAsString() {
31 String content = FileReader.fileToString("responses/BEV/vehicles_state.json");
32 VehicleStateContainer vehicleStateContainer = JsonStringDeserializer.getVehicleState(content);
34 String servicesSupportedReference = "BmwCharging;ChargingHistory;ChargingPlan;CustomerEsim;DCSContractManagement;RemoteHistory;ScanAndCharge";
35 String servicesUnsupportedReference = "CarSharing;ChargeNowForBusiness;ClimateTimer;EvGoCharging;MiniCharging;RemoteEngineStart;RemoteHistoryDeletion;RemoteParking;Sustainability;WifiHotspotService";
36 String servicesEnabledReference = "ChargingHospitality;ChargingLoudness;ChargingPowerLimit;ChargingSettings;ChargingTargetSoc";
37 String servicesDisabledReference = "DataPrivacy;EasyCharge;NonLscFeature;SustainabilityAccumulatedView";
38 assertEquals(servicesSupportedReference, vehicleStateContainer.getCapabilities()
39 .getCapabilitiesAsString(VehicleCapabilities.SUPPORTED_SUFFIX, true), "Services supported");
40 assertEquals(servicesUnsupportedReference, vehicleStateContainer.getCapabilities()
41 .getCapabilitiesAsString(VehicleCapabilities.SUPPORTED_SUFFIX, false), "Services unsupported");
42 assertEquals(servicesEnabledReference, vehicleStateContainer.getCapabilities()
43 .getCapabilitiesAsString(VehicleCapabilities.ENABLED_SUFFIX, true), "Services enabled");
44 assertEquals(servicesDisabledReference, vehicleStateContainer.getCapabilities()
45 .getCapabilitiesAsString(VehicleCapabilities.ENABLED_SUFFIX, false), "Services disabled");