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.yamahareceiver.internal.protocol.xml;
15 import static org.junit.jupiter.api.Assertions.assertTrue;
16 import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Feature.*;
17 import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Zone.*;
19 import java.io.IOException;
20 import java.util.Arrays;
22 import org.junit.jupiter.api.Test;
23 import org.openhab.binding.yamahareceiver.internal.protocol.ReceivedMessageParseException;
24 import org.openhab.binding.yamahareceiver.internal.state.DeviceInformationState;
27 * Unit test for {@link DeviceInformationXML}.
29 * @author Tomasz Maruszak - Initial contribution
31 public class DeviceInformationXMLTest extends AbstractXMLProtocolTest {
33 private DeviceInformationState state;
35 private DeviceInformationXML subject;
38 public void onSetUp() {
39 state = new DeviceInformationState();
40 subject = new DeviceInformationXML(con, state);
44 public void when_HTR4069_then_detects_featureZoneB_and_addsZone2()
45 throws IOException, ReceivedMessageParseException {
47 ctx.prepareForModel("HTR-4069");
53 assertTrue(state.features.contains(ZONE_B), "ZONE_B detected");
54 assertTrue(state.zones.contains(Zone_2), "Zone_2 added");
58 public void when_RXV3900_then_detects_features_and_zones_from_descriptor()
59 throws IOException, ReceivedMessageParseException {
61 ctx.prepareForModel("RX-V3900");
67 assertTrue(state.zones.containsAll(Arrays.asList(Main_Zone, Zone_2, Zone_3)), "Zones detected");
68 assertTrue(state.features.containsAll(Arrays.asList(TUNER, BLUETOOTH)), "Features detected");