]> git.basschouten.com Git - openhab-addons.git/blob
c62584a01e9851b013b614a3238e9cb69ac8091a
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.jupiter.api.Assertions.*;
16
17 import java.io.IOException;
18
19 import org.junit.jupiter.api.Test;
20 import org.openhab.binding.sensibo.internal.dto.poddetails.AcStateDTO;
21 import org.openhab.binding.sensibo.internal.dto.settimer.SetTimerRequest;
22
23 /**
24  * @author Arne Seime - Initial contribution
25  */
26 public class SetTimerRequestTest extends AbstractSerializationDeserializationTest {
27
28     @Test
29     public void testSerializeDeserialize() throws IOException {
30         AcStateDTO acState = new AcStateDTO(false, "fanLevel", "C", 21, "mode", "swing");
31         SetTimerRequest req = new SetTimerRequest("PODID", 60, acState);
32         String serializedJson = wireHelper.serialize(req);
33
34         final SetTimerRequest deSerializedRequest = wireHelper.deSerializeFromString(serializedJson,
35                 SetTimerRequest.class);
36         assertNotNull(deSerializedRequest.acState);
37         assertEquals(60, deSerializedRequest.minutesFromNow);
38         assertFalse(deSerializedRequest.acState.on);
39     }
40 }