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.nobohub.internal.model;
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16 import static org.junit.jupiter.api.Assertions.assertNull;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.junit.jupiter.api.Test;
22 * Unit tests for OverrideRegister model object.
24 * @author Jørgen Austvik - Initial contribution
27 public class OverridePlanRegisterTest {
30 public void testPutGet() throws NoboDataException {
31 OverridePlan o = OverridePlan.fromH04("H04 4 0 0 -1 -1 0 -1");
32 OverrideRegister sut = new OverrideRegister();
34 assertEquals(o, sut.get(o.getId()));
38 public void testPutOverwrite() throws NoboDataException {
39 OverridePlan o1 = OverridePlan.fromH04("H04 4 0 0 -1 -1 0 -1");
40 OverridePlan o2 = OverridePlan.fromH04("H04 4 3 0 -1 -1 0 -1");
41 OverrideRegister sut = new OverrideRegister();
44 assertEquals(o2, sut.get(o2.getId()));
48 public void testRemove() throws NoboDataException {
49 OverridePlan o = OverridePlan.fromH04("H04 4 0 0 -1 -1 0 -1");
50 OverrideRegister sut = new OverrideRegister();
52 OverridePlan res = sut.remove(o.getId());
57 public void testRemoveUnknown() {
58 OverrideRegister sut = new OverrideRegister();
59 OverridePlan res = sut.remove(666);
64 public void testGetUnknown() {
65 OverrideRegister sut = new OverrideRegister();
66 OverridePlan o = sut.get(666);