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.sensibo.internal.dto;
15 import static org.junit.Assert.assertEquals;
16 import static org.junit.Assert.assertFalse;
17 import static org.junit.Assert.assertNotNull;
19 import java.io.IOException;
21 import org.junit.Test;
22 import org.openhab.binding.sensibo.internal.dto.poddetails.AcStateDTO;
23 import org.openhab.binding.sensibo.internal.dto.settimer.SetTimerRequest;
26 * @author Arne Seime - Initial contribution
28 public class SetTimerRequestTest extends AbstractSerializationDeserializationTest {
31 public void testSerializeDeserialize() throws IOException {
32 AcStateDTO acState = new AcStateDTO(false, "fanLevel", "C", 21, "mode", "swing");
33 SetTimerRequest req = new SetTimerRequest("PODID", 60, acState);
34 String serializedJson = wireHelper.serialize(req);
36 final SetTimerRequest deSerializedRequest = wireHelper.deSerializeFromString(serializedJson,
37 SetTimerRequest.class);
38 assertNotNull(deSerializedRequest.acState);
39 assertEquals(60, deSerializedRequest.minutesFromNow);
40 assertFalse(deSerializedRequest.acState.on);