]> git.basschouten.com Git - openhab-addons.git/blob
e2517d43d7ef9329052b2f8a1804dcc9c6039bee
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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     @Mock
32     protected YamahaZoneConfig zoneConfig;
33
34     @Mock
35     protected ZoneControlStateListener zoneControlStateListener;
36
37     protected DeviceInformationState deviceInformationState;
38
39     @Mock
40     protected InputConverter inputConverter;
41
42     @Override
43     protected void onSetUp() throws Exception {
44         super.onSetUp();
45
46         deviceInformationState = new DeviceInformationState();
47
48         when(zoneConfig.getVolumeDbMin()).thenReturn(-10f);
49         when(zoneConfig.getVolumeDbMax()).thenReturn(10f);
50
51         when(inputConverter.fromStateName(anyString())).thenAnswer(p -> p.getArgument(0));
52         when(inputConverter.toCommandName(anyString())).thenAnswer(p -> p.getArgument(0));
53     }
54 }