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 java.util.Arrays;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.junit.jupiter.api.BeforeEach;
23 import org.junit.jupiter.api.Test;
26 * Test for global orientation
28 * @author Jørgen Austvik - Initial contribution
31 public class LayoutTest {
37 private Layout lo2; // Different from l1
40 private Layout lo3; // Same as l1
44 PositionDatum pd1 = new PositionDatum(100, 200, 270, 123, 12);
45 PositionDatum pd2 = new PositionDatum(100, 220, 240, 123, 2);
46 PositionDatum pd3 = new PositionDatum(100, 200, 270, 123, 12);
48 lo1 = new Layout(Arrays.asList(pd1, pd3));
49 lo2 = new Layout(Arrays.asList(pd1, pd2));
50 lo3 = new Layout(Arrays.asList(pd1, pd3));
54 public void testHashCode() {
58 if (l1 != null && l2 != null && l3 != null) {
59 assertThat(l1.hashCode(), is(equalTo(l3.hashCode())));
60 assertThat(l2.hashCode(), is(not(equalTo(l3.hashCode()))));
62 assertThat("Should be initialized", false);
67 public void testEquals() {
68 assertThat(lo1, is(equalTo(lo3)));
69 assertThat(lo2, is(not(equalTo(lo3))));
70 assertThat(lo3, is(not(equalTo(null))));