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 org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19 import org.openhab.binding.bmwconnecteddrive.internal.dto.statistics.LastTrip;
20 import org.openhab.binding.bmwconnecteddrive.internal.dto.statistics.LastTripContainer;
21 import org.openhab.binding.bmwconnecteddrive.internal.util.FileReader;
23 import com.google.gson.Gson;
26 * The {@link LastTripTest} Test json responses from ConnectedDrive Portal
28 * @author Bernd Weymann - Initial contribution
31 @SuppressWarnings("null")
32 public class LastTripTest {
33 private static final Gson GSON = new Gson();
36 public void testUserInfo() {
37 String content = FileReader.readFileInString("src/test/resources/webapi/last-trip.json");
38 LastTripContainer lt = GSON.fromJson(content, LastTripContainer.class);
39 LastTrip trip = lt.lastTrip;
41 assertEquals(2.0, trip.totalDistance, 0.01, "Distance Driven");