2 * Copyright (c) 2010-2023 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.doorbird.internal;
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.doorbird.internal.api.SipStatus;
22 * The {@link SipStatusTest} is responsible for testing the functionality
23 * of Doorbird "sipStatus" message parsing.
25 * @author Mark Hilbush - Initial contribution
28 public class SipStatusTest {
30 private final String sipStatusJson =
34 "'RETURNCODE': '1'," +
37 "'PRIORITIZE_APP': '1'," +
38 "'REGISTER_URL': '192.168.178.1'," +
39 "'REGISTER_USER': 'xxxxx'," +
40 "'REGISTER_PASSWORD': 'yyyyy'," +
41 "'AUTOCALL_MOTIONSENSOR_URL': 'motion-url'," +
42 "'AUTOCALL_DOORBELL_URL': 'doorbell-url'," +
43 "'SPK_VOLUME': '70'," +
44 "'MIC_VOLUME': '33'," +
48 "'LIGHT_PASSCODE': 'light-passcode'," +
49 "'INCOMING_CALL_ENABLE': '0'," +
50 "'INCOMING_CALL_USER': 'abcde'," +
52 "'LASTERRORCODE': '901'," +
53 "'LASTERRORTEXT': 'OK'," +
54 "'RING_TIME_LIMIT': '60'," +
55 "'CALL_TIME_LIMIT': '180'" +
62 public void testParsing() {
63 SipStatus sipStatus = new SipStatus(sipStatusJson);
64 assertEquals("70", sipStatus.getSpeakerVolume());
65 assertEquals("33", sipStatus.getMicrophoneVolume());
66 assertEquals("901", sipStatus.getLastErrorCode());
67 assertEquals("OK", sipStatus.getLastErrorText());
68 assertEquals("60", sipStatus.getRingTimeLimit());
69 assertEquals("180", sipStatus.getCallTimeLimit());