blob: ad23b02c8b17ceb298ff8e8237c7a347edf3a0ec [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;
Simon Hunt3d1b0652015-05-05 17:27:24 -070021import org.onosproject.ui.table.CellFormatter;
Simon Hunt3ee7f742015-05-05 10:18:20 -070022
23import static org.junit.Assert.assertEquals;
24
25/**
26 * Unit tests for {@link HexFormatter}.
27 */
28public class HexFormatterTest {
29
Simon Hunt3d1b0652015-05-05 17:27:24 -070030 private CellFormatter fmt = HexFormatter.INSTANCE;
Simon Hunt3ee7f742015-05-05 10:18:20 -070031
32 @Test
33 public void nullValue() {
34 assertEquals("null value", "", fmt.format(null));
35 }
36
37 @Test
38 public void zero() {
39 assertEquals("zero", "0x0", fmt.format(0));
40 }
41
42 @Test
43 public void one() {
44 assertEquals("one", "0x1", fmt.format(1));
45 }
46
47 @Test
48 public void ten() {
49 assertEquals("ten", "0xa", fmt.format(10));
50 }
51
52 @Test
53 public void twenty() {
54 assertEquals("twenty", "0x14", fmt.format(20));
55 }
56
57}