blob: f4f27ee7e940afca0f59b4dd84643a469d7f8d0f [file] [log] [blame]
Simon Hunt0c85f112017-06-12 21:02:17 -07001/*
2 * Copyright 2017-present Open Networking Laboratory
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
18package org.onosproject.ui.lion;
19
20import org.junit.Test;
Simon Hunte556e942017-06-19 15:35:44 -070021import org.onosproject.ui.AbstractUiTest;
22
23import static org.junit.Assert.assertEquals;
Simon Hunt0c85f112017-06-12 21:02:17 -070024
25/**
26 * Unit tests for {@link LionBundle}.
27 */
Simon Hunte556e942017-06-19 15:35:44 -070028public 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 Hunt0c85f112017-06-12 21:02:17 -070035
36 private LionBundle bundle;
37
38 @Test
39 public void basic() {
Simon Hunte556e942017-06-19 15:35:44 -070040 title("basic");
Simon Hunt0c85f112017-06-12 21:02:17 -070041
Simon Hunte556e942017-06-19 15:35:44 -070042 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 Hunt0c85f112017-06-12 21:02:17 -070052 }
53}