blob: c8a0912275cf63903237eb8ccf2bf5a7d809dd51 [file] [log] [blame]
Simon Hunt3e4ccaf2016-01-12 19:59:54 -08001/*
2 * Copyright 2016 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
17package org.onosproject.ui.table.cell;
18
19import org.junit.Test;
20import org.onosproject.ui.table.CellFormatter;
21
22import static org.junit.Assert.assertEquals;
23
24/**
25 * Unit tests for {@link HexLongFormatter}.
26 */
27public class HexLongFormatterTest {
28
29 private CellFormatter fmt = HexLongFormatter.INSTANCE;
30
31 @Test
32 public void nullValue() {
33 assertEquals("null value", "", fmt.format(null));
34 }
35
36 @Test
37 public void zero() {
38 assertEquals("zero", "0x0", fmt.format(0L));
39 }
40
41 @Test
42 public void one() {
43 assertEquals("one", "0x1", fmt.format(1L));
44 }
45
46 @Test
47 public void ten() {
48 assertEquals("ten", "0xa", fmt.format(10L));
49 }
50
51 @Test
52 public void twenty() {
53 assertEquals("twenty", "0x14", fmt.format(20L));
54 }
55
56 @Test
57 public void veryBig() {
58 assertEquals("very big", "0x7048860f3a38", fmt.format(123456789101112L));
59 }
60
61 @Test
62 public void maxLong() {
63 assertEquals("max long", "0x7fffffffffffffff", fmt.format(Long.MAX_VALUE));
64 }
65}