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.vdr.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.vdr.internal.svdrp.SVDRPChannel;
20 import org.openhab.binding.vdr.internal.svdrp.SVDRPException;
21 import org.openhab.binding.vdr.internal.svdrp.SVDRPParseResponseException;
24 * Specific unit tests to check if {@link SVDRPChannel} parses SVDRP responses correctly
26 * @author Matthias Klocke - Initial contribution
30 public class SVDRPChannelTest {
32 private final String channelResponseOk = "3 WDR HD Bielefeld";
33 private final String channelResponseParseError = "250WDR HD Bielefeld";
36 public void testParseChannelData() throws SVDRPException {
37 SVDRPChannel channel = SVDRPChannel.parse(channelResponseOk);
38 assertEquals("WDR HD Bielefeld", channel.getName());
39 assertEquals(3, channel.getNumber());
43 public void testParseExceptionChannelData() {
44 assertThrows(SVDRPParseResponseException.class, () -> {
45 SVDRPChannel.parse(channelResponseParseError);