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.nanoleaf.internal.model;
15 import static org.hamcrest.CoreMatchers.*;
16 import static org.hamcrest.MatcherAssert.assertThat;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.junit.jupiter.api.BeforeEach;
21 import org.junit.jupiter.api.Test;
24 * Test for global orientation
26 * @author Jørgen Austvik - Initial contribution
29 public class PositionDatumTest {
32 private PositionDatum pd1;
35 private PositionDatum pd2; // different from pd1
38 private PositionDatum pd3; // same as pd1
42 pd1 = new PositionDatum(100, 200, 270, 123, 12);
43 pd2 = new PositionDatum(100, 220, 240, 123, 2);
44 pd3 = new PositionDatum(100, 200, 270, 123, 12);
48 public void testHashCode() {
49 PositionDatum p1 = pd1;
50 PositionDatum p2 = pd2;
51 PositionDatum p3 = pd3;
52 if (p1 != null && p2 != null && p3 != null) {
53 assertThat(p1.hashCode(), is(equalTo(p3.hashCode())));
54 assertThat(p2.hashCode(), is(not(equalTo(p3.hashCode()))));
56 assertThat("Should be initialized", false);
61 public void testEquals() {
62 assertThat(pd1, is(equalTo(pd3)));
63 assertThat(pd2, is(not(equalTo(pd3))));
64 assertThat(pd3, is(not(equalTo(null))));