]> git.basschouten.com Git - openhab-addons.git/blob
a5c33a380682806fff8f8b9b7fc0a89a055029bd
[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.yamahareceiver.internal.protocol.xml;
14
15 import static org.mockito.ArgumentMatchers.anyString;
16 import static org.mockito.Mockito.when;
17
18 import org.mockito.Mock;
19 import org.openhab.binding.yamahareceiver.internal.config.YamahaZoneConfig;
20 import org.openhab.binding.yamahareceiver.internal.protocol.InputConverter;
21 import org.openhab.binding.yamahareceiver.internal.state.DeviceInformationState;
22 import org.openhab.binding.yamahareceiver.internal.state.ZoneControlStateListener;
23
24 /**
25  * Common zone test.
26  *
27  * @author Tomasz Maruszak - Initial contribution
28  */
29 public abstract class AbstractZoneControlXMLTest extends AbstractXMLProtocolTest {
30
31     protected DeviceInformationState deviceInformationState;
32
33     protected @Mock InputConverter inputConverter;
34     protected @Mock ZoneControlStateListener zoneControlStateListener;
35     protected @Mock YamahaZoneConfig zoneConfig;
36
37     @Override
38     protected void onSetUp() throws Exception {
39         super.onSetUp();
40
41         deviceInformationState = new DeviceInformationState();
42
43         when(zoneConfig.getVolumeDbMin()).thenReturn(-10f);
44         when(zoneConfig.getVolumeDbMax()).thenReturn(10f);
45
46         when(inputConverter.fromStateName(anyString())).thenAnswer(p -> p.getArgument(0));
47         when(inputConverter.toCommandName(anyString())).thenAnswer(p -> p.getArgument(0));
48     }
49 }