blob: 738fbdde0325aef775f3cb4703aac9f455793984 [file] [log] [blame]
Simon Hunt3ee7f742015-05-05 10:18:20 -07001/*
2 * Copyright 2015 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.table.cell;
19
20import org.junit.Test;
21
22import static org.junit.Assert.assertEquals;
23
24/**
25 * Unit tests for {@link HexFormatter}.
26 */
27public class HexFormatterTest {
28
29 private HexFormatter fmt = new HexFormatter();
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(0));
39 }
40
41 @Test
42 public void one() {
43 assertEquals("one", "0x1", fmt.format(1));
44 }
45
46 @Test
47 public void ten() {
48 assertEquals("ten", "0xa", fmt.format(10));
49 }
50
51 @Test
52 public void twenty() {
53 assertEquals("twenty", "0x14", fmt.format(20));
54 }
55
56}