]> git.basschouten.com Git - openhab-addons.git/blob
4bcc5df34fcc9ed4d4c594d50edd0fe30b3146b4
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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 java.util.List;
18
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;
25
26 import com.google.gson.Gson;
27
28 /**
29  * The {@link DestinationTest} Test json responses from ConnectedDrive Portal
30  *
31  * @author Bernd Weymann - Initial contribution
32  */
33 @NonNullByDefault
34 @SuppressWarnings("null")
35 public class DestinationTest {
36     private final Logger logger = LoggerFactory.getLogger(DestinationTest.class);
37     private static final Gson GSON = new Gson();
38
39     @Test
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");
48         });
49     }
50 }