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 GlobalOrientationTest {
32 GlobalOrientation go1;
35 GlobalOrientation go2; // Different from go1
38 GlobalOrientation go3; // Same as go1
42 go1 = new GlobalOrientation(0, 360, 180);
43 go2 = new GlobalOrientation(0, 360, 267);
44 go3 = new GlobalOrientation(0, 360, 180);
48 public void testHashCode() {
49 GlobalOrientation g1 = go1;
50 GlobalOrientation g2 = go2;
51 GlobalOrientation g3 = go3;
52 if (g1 != null && g2 != null && g3 != null) {
53 assertThat(g1.hashCode(), is(equalTo(g3.hashCode())));
54 assertThat(g2.hashCode(), is(not(equalTo(g3.hashCode()))));
56 assertThat("Should be initialized", false);
61 public void testEquals() {
62 assertThat(go1, is(equalTo(go3)));
63 assertThat(go2, is(not(equalTo(go3))));
64 assertThat(go3, is(not(equalTo(null))));