2 * Copyright (c) 2010-2020 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.nanoleaf.internal;
15 import static org.hamcrest.CoreMatchers.is;
16 import static org.hamcrest.MatcherAssert.assertThat;
17 import static org.hamcrest.Matchers.greaterThan;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
21 import org.junit.jupiter.api.Test;
22 import org.openhab.binding.nanoleaf.internal.model.TouchEvent;
23 import org.openhab.binding.nanoleaf.internal.model.TouchEvents;
25 import com.google.gson.Gson;
28 * Test for the TouchEvents
30 * @author Stefan Höhn - Initial contribution
34 public class TouchTest {
36 private final Gson gson = new Gson();
39 public void testTheRightLayoutView() {
40 String json = "{\"events\":[{\"panelId\":48111,\"gesture\":1}]}";
42 TouchEvents touchEvents = gson.fromJson(json, TouchEvents.class);
43 assertThat(touchEvents.getEvents().size(), greaterThan(0));
44 assertThat(touchEvents.getEvents().size(), is(1));
46 TouchEvent touchEvent = touchEvents.getEvents().get(0);
47 assertThat(touchEvent.getPanelId(), is("48111"));
48 assertThat(touchEvent.getGesture(), is(1));