/**
 * Copyright (c) 2016-2017 by the respective copyright holders.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package com.zsmartsystems.zwave.commandclass.impl.loopback;

import static org.junit.Assert.assertEquals;

import java.util.Map;
import com.zsmartsystems.zwave.commandclass.impl.CommandClassMeterTblPushV1;

/**
 * Class to implement loopback tests for command class <b>COMMAND_CLASS_METER_TBL_PUSH</b> version <b>1</b>.
 * <p>
 * Note that this code is autogenerated. Manual changes may be overwritten.
 *
 * @author Chris Jackson - Initial contribution of Java code generator
 */
public class CommandClassMeterTblPushV1LoopbackTest {
    /**
     * Performs an in/out test of the METER_TBL_PUSH_CONFIGURATION_SET command.
     * <p>
     * Test is designed to ensure that the command generates the same data
     * as the handler processes and is mainly a check of the code generator.
     *
     * @param operatingStatusPushMode {@link Integer}
     * @param ps {@link Boolean}
     * @param intervalMonths {@link Integer}
     * @param intervalDays {@link Integer}
     * @param intervalHours {@link Integer}
     * @param intervalMinutes {@link Integer}
     * @param pushNodeId {@link Integer}
     */
    public static void testMeterTblPushConfigurationSetLoopback(Integer operatingStatusPushMode, Boolean ps,
            Integer intervalMonths, Integer intervalDays, Integer intervalHours, Integer intervalMinutes,
            Integer pushNodeId) {
        byte[] testPayload = CommandClassMeterTblPushV1.getMeterTblPushConfigurationSet(operatingStatusPushMode, ps,
                intervalMonths, intervalDays, intervalHours, intervalMinutes, pushNodeId);

        Map<String, Object> response = CommandClassMeterTblPushV1.handleMeterTblPushConfigurationSet(testPayload);
        assertEquals(operatingStatusPushMode, (Integer) response.get("OPERATING_STATUS_PUSH_MODE"));
        assertEquals(ps, (Boolean) response.get("PS"));
        assertEquals(intervalMonths, (Integer) response.get("INTERVAL_MONTHS"));
        assertEquals(intervalDays, (Integer) response.get("INTERVAL_DAYS"));
        assertEquals(intervalHours, (Integer) response.get("INTERVAL_HOURS"));
        assertEquals(intervalMinutes, (Integer) response.get("INTERVAL_MINUTES"));
        assertEquals(pushNodeId, (Integer) response.get("PUSH_NODE_ID"));
    }

    /**
     * Performs an in/out test of the METER_TBL_PUSH_CONFIGURATION_REPORT command.
     * <p>
     * Test is designed to ensure that the command generates the same data
     * as the handler processes and is mainly a check of the code generator.
     *
     * @param operatingStatusPushMode {@link Integer}
     * @param ps {@link Boolean}
     * @param intervalMonths {@link Integer}
     * @param intervalDays {@link Integer}
     * @param intervalHours {@link Integer}
     * @param intervalMinutes {@link Integer}
     * @param pushNodeId {@link Integer}
     */
    public static void testMeterTblPushConfigurationReportLoopback(Integer operatingStatusPushMode, Boolean ps,
            Integer intervalMonths, Integer intervalDays, Integer intervalHours, Integer intervalMinutes,
            Integer pushNodeId) {
        byte[] testPayload = CommandClassMeterTblPushV1.getMeterTblPushConfigurationReport(operatingStatusPushMode, ps,
                intervalMonths, intervalDays, intervalHours, intervalMinutes, pushNodeId);

        Map<String, Object> response = CommandClassMeterTblPushV1.handleMeterTblPushConfigurationReport(testPayload);
        assertEquals(operatingStatusPushMode, (Integer) response.get("OPERATING_STATUS_PUSH_MODE"));
        assertEquals(ps, (Boolean) response.get("PS"));
        assertEquals(intervalMonths, (Integer) response.get("INTERVAL_MONTHS"));
        assertEquals(intervalDays, (Integer) response.get("INTERVAL_DAYS"));
        assertEquals(intervalHours, (Integer) response.get("INTERVAL_HOURS"));
        assertEquals(intervalMinutes, (Integer) response.get("INTERVAL_MINUTES"));
        assertEquals(pushNodeId, (Integer) response.get("PUSH_NODE_ID"));
    }

}
