]> git.basschouten.com Git - openhab-addons.git/blob
0ced7f52f5c198f4ccd3a81c8c18128388874a5a
[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.vdr.internal;
14
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
19 import org.openhab.binding.vdr.internal.svdrp.SVDRPException;
20 import org.openhab.binding.vdr.internal.svdrp.SVDRPTimerList;
21
22 /**
23  * Specific unit tests to check if {@link SVDRPTimerList} parses SVDRP responses correctly
24  *
25  * @author Matthias Klocke - Initial contribution
26  *
27  */
28 @NonNullByDefault
29 public class SVDRPTimerListTest {
30     private final String timerListResponseTimerActive = "1 1:1:2021-01-12:2013:2110:50:99:Charité (1/6)~Eiserne Lunge:Test\n"
31             + "2 9:1:2021-01-12:2058:2200:50:99:Charité (2/6)~Blutsauger:Test";
32     private final String timerListResponseTimerNotActive = "1 1:1:2021-01-12:2013:2110:50:99:Charité (1/6)~Eiserne Lunge:Test\n"
33             + "2 1:1:2021-01-12:2058:2200:50:99:Charité (2/6)~Blutsauger:Test";
34
35     @Test
36     public void testParseTimerList() throws SVDRPException {
37         SVDRPTimerList list = SVDRPTimerList.parse(timerListResponseTimerActive);
38         assertEquals(true, list.isRecordingActive());
39         list = SVDRPTimerList.parse(timerListResponseTimerNotActive);
40         assertEquals(false, list.isRecordingActive());
41     }
42 }