Simon Hunt | 8d22c4b | 2015-08-06 16:24:43 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Simon Hunt | 8d22c4b | 2015-08-06 16:24:43 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Simon Hunt | 8d22c4b | 2015-08-06 16:24:43 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | package org.onosproject.ui.topo; |
| 18 | |
| 19 | import org.junit.Test; |
| 20 | |
| 21 | import static org.junit.Assert.assertFalse; |
| 22 | import static org.junit.Assert.assertTrue; |
| 23 | |
| 24 | /** |
| 25 | * Unit tests for {@link ButtonId}. |
| 26 | */ |
| 27 | public class ButtonIdTest { |
| 28 | |
| 29 | private static final String ID1 = "id-1"; |
| 30 | private static final String ID2 = "id-2"; |
| 31 | |
| 32 | private ButtonId b1, b2; |
| 33 | |
| 34 | |
| 35 | @Test |
| 36 | public void basic() { |
| 37 | b1 = new ButtonId(ID1); |
| 38 | } |
| 39 | |
| 40 | @Test |
| 41 | public void same() { |
| 42 | b1 = new ButtonId(ID1); |
| 43 | b2 = new ButtonId(ID1); |
| 44 | assertFalse("same ref?", b1 == b2); |
| 45 | assertTrue("not equal?", b1.equals(b2)); |
| 46 | } |
| 47 | |
| 48 | @Test |
| 49 | public void notSame() { |
| 50 | b1 = new ButtonId(ID1); |
| 51 | b2 = new ButtonId(ID2); |
| 52 | assertFalse("same ref?", b1 == b2); |
| 53 | assertFalse("equal?", b1.equals(b2)); |
| 54 | } |
| 55 | } |