blob: 71c946cdbe153662ff5e9cfb2a012779e97921fd [file] [log] [blame]
Simon Hunt3ee7f742015-05-05 10:18:20 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Simon Hunt3ee7f742015-05-05 10:18:20 -07003 *
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.
Simon Hunt3ee7f742015-05-05 10:18:20 -070015 */
16
17package org.onosproject.ui.table.cell;
18
19import org.junit.Test;
Simon Hunt3d1b0652015-05-05 17:27:24 -070020import org.onosproject.ui.table.CellFormatter;
Simon Hunt3ee7f742015-05-05 10:18:20 -070021
22import static org.junit.Assert.assertEquals;
23
24/**
25 * Unit tests for {@link HexFormatter}.
26 */
27public class HexFormatterTest {
28
Simon Hunt3d1b0652015-05-05 17:27:24 -070029 private CellFormatter fmt = HexFormatter.INSTANCE;
Simon Hunt3ee7f742015-05-05 10:18:20 -070030
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}