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.max.internal.command;
15 import static org.junit.jupiter.api.Assertions.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
21 * Tests cases for {@link FCommand}.
23 * @author Marcel Verpaalen - Initial contribution
26 public class FCommandTest {
29 public void prefixTest() {
30 FCommand scmd = new FCommand();
32 String commandStr = scmd.getCommandString();
33 String prefix = commandStr.substring(0, 2);
35 assertEquals("f:", prefix);
36 assertEquals("f:" + '\r' + '\n', commandStr);
40 public void baseCommandTest() {
41 FCommand scmd = new FCommand("ntp.homematic.com", "nl.ntp.pool.org");
42 String commandStr = scmd.getCommandString();
43 assertEquals("f:ntp.homematic.com,nl.ntp.pool.org" + '\r' + '\n', commandStr);
47 public void fCommandNullTest() {
48 FCommand scmd = new FCommand("ntp.homematic.com", null);
49 String commandStr = scmd.getCommandString();
50 assertEquals("f:ntp.homematic.com" + '\r' + '\n', commandStr);
52 scmd = new FCommand(null, "nl.ntp.pool.org");
53 commandStr = scmd.getCommandString();
54 assertEquals("f:nl.ntp.pool.org" + '\r' + '\n', commandStr);
56 scmd = new FCommand(null, null);
57 commandStr = scmd.getCommandString();
58 assertEquals("f:" + '\r' + '\n', commandStr);