2 * Copyright (c) 2010-2021 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 java.util.List;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.junit.jupiter.api.Test;
21 import org.openhab.binding.bmwconnecteddrive.internal.util.FileReader;
22 import org.openhab.binding.bmwconnecteddrive.internal.utils.Constants;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
26 import com.google.gson.Gson;
29 * The {@link DestinationTest} Test json responses from ConnectedDrive Portal
31 * @author Bernd Weymann - Initial contribution
34 @SuppressWarnings("null")
35 public class DestinationTest {
36 private final Logger logger = LoggerFactory.getLogger(DestinationTest.class);
37 private static final Gson GSON = new Gson();
40 public void testDestinations() {
41 String resource1 = FileReader.readFileInString("src/test/resources/webapi/destinations.json");
42 DestinationContainer container = GSON.fromJson(resource1, DestinationContainer.class);
43 List<Destination> destinations = container.destinations;
44 assertEquals(9, destinations.size(), "Number of Vehicles");
45 destinations.forEach(entry -> {
46 logger.info(entry.getAddress());
47 assertFalse(entry.getAddress().contains(Constants.NULL), "No Null contained");