Simon Hunt | 0c85f11 | 2017-06-12 21:02:17 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Simon Hunt | 0c85f11 | 2017-06-12 21:02:17 -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. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | package org.onosproject.ui.lion; |
| 19 | |
| 20 | import org.junit.Test; |
Simon Hunt | e556e94 | 2017-06-19 15:35:44 -0700 | [diff] [blame] | 21 | import org.onosproject.ui.AbstractUiTest; |
| 22 | |
| 23 | import static org.junit.Assert.assertEquals; |
Simon Hunt | 0c85f11 | 2017-06-12 21:02:17 -0700 | [diff] [blame] | 24 | |
| 25 | /** |
| 26 | * Unit tests for {@link LionBundle}. |
| 27 | */ |
Simon Hunt | e556e94 | 2017-06-19 15:35:44 -0700 | [diff] [blame] | 28 | public class LionBundleTest extends AbstractUiTest { |
| 29 | |
| 30 | private static final String ID = "foo"; |
| 31 | private static final String KEY_A = "ka"; |
| 32 | private static final String KEY_B = "kb"; |
| 33 | private static final String VAL_A = "Alpha"; |
| 34 | private static final String VAL_B = "Beta"; |
Simon Hunt | 0c85f11 | 2017-06-12 21:02:17 -0700 | [diff] [blame] | 35 | |
| 36 | private LionBundle bundle; |
| 37 | |
| 38 | @Test |
| 39 | public void basic() { |
Simon Hunt | e556e94 | 2017-06-19 15:35:44 -0700 | [diff] [blame] | 40 | title("basic"); |
Simon Hunt | 0c85f11 | 2017-06-12 21:02:17 -0700 | [diff] [blame] | 41 | |
Simon Hunt | e556e94 | 2017-06-19 15:35:44 -0700 | [diff] [blame] | 42 | bundle = new LionBundle.Builder(ID) |
| 43 | .addItem(KEY_A, VAL_A) |
| 44 | .addItem(KEY_B, VAL_B) |
| 45 | .build(); |
| 46 | print(bundle); |
| 47 | assertEquals("wrong id", ID, bundle.id()); |
| 48 | assertEquals("wrong item count", 2, bundle.size()); |
| 49 | |
| 50 | assertEquals("wrong A lookup", VAL_A, bundle.getValue(KEY_A)); |
| 51 | assertEquals("wrong B lookup", VAL_B, bundle.getValue(KEY_B)); |
Simon Hunt | 0c85f11 | 2017-06-12 21:02:17 -0700 | [diff] [blame] | 52 | } |
| 53 | } |