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 =
38 'PRIORITIZE_APP': '1',\
39 'REGISTER_URL': '192.168.178.1',\
40 'REGISTER_USER': 'xxxxx',\
41 'REGISTER_PASSWORD': 'yyyyy',\
42 'AUTOCALL_MOTIONSENSOR_URL': 'motion-url',\
43 'AUTOCALL_DOORBELL_URL': 'doorbell-url',\
49 'LIGHT_PASSCODE': 'light-passcode',\
50 'INCOMING_CALL_ENABLE': '0',\
51 'INCOMING_CALL_USER': 'abcde',\
53 'LASTERRORCODE': '901',\
54 'LASTERRORTEXT': 'OK',\
55 'RING_TIME_LIMIT': '60',\
56 'CALL_TIME_LIMIT': '180'\
64 public void testParsing() {
65 SipStatus sipStatus = new SipStatus(sipStatusJson);
66 assertEquals("70", sipStatus.getSpeakerVolume());
67 assertEquals("33", sipStatus.getMicrophoneVolume());
68 assertEquals("901", sipStatus.getLastErrorCode());
69 assertEquals("OK", sipStatus.getLastErrorText());
70 assertEquals("60", sipStatus.getRingTimeLimit());
71 assertEquals("180", sipStatus.getCallTimeLimit());