]> git.basschouten.com Git - openhab-addons.git/blob
506e99a80799ab2905c651c7851f952ebcf7bac5
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.sensibo.internal.dto;
14
15 import static org.junit.Assert.assertEquals;
16 import static org.junit.Assert.assertFalse;
17 import static org.junit.Assert.assertNotNull;
18
19 import java.io.IOException;
20
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;
24
25 /**
26  * @author Arne Seime - Initial contribution
27  */
28 public class SetTimerRequestTest extends AbstractSerializationDeserializationTest {
29
30     @Test
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);
35
36         final SetTimerRequest deSerializedRequest = wireHelper.deSerializeFromString(serializedJson,
37                 SetTimerRequest.class);
38         assertNotNull(deSerializedRequest.acState);
39         assertEquals(60, deSerializedRequest.minutesFromNow);
40         assertFalse(deSerializedRequest.acState.on);
41     }
42 }