1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.primitives;
17
18 import org.junit.Assert;
19 import org.junit.Test;
20
21 public class NumbersTest {
22
23 @Test
24 public void test() {
25 Assert.assertEquals(Byte.class, Numbers.narrow(0).getClass());
26 Assert.assertEquals(Byte.class, Numbers.narrow(0L).getClass());
27 Assert.assertEquals(Byte.class, Numbers.narrow(Byte.MAX_VALUE).getClass());
28 Assert.assertEquals(Byte.class, Numbers.narrow(Byte.MIN_VALUE).getClass());
29 Assert.assertEquals(Short.class, Numbers.narrow(Short.MAX_VALUE).getClass());
30 Assert.assertEquals(Short.class, Numbers.narrow(Short.MIN_VALUE).getClass());
31 Assert.assertEquals(Integer.class, Numbers.narrow(Integer.MAX_VALUE).getClass());
32 Assert.assertEquals(Integer.class, Numbers.narrow(Integer.MIN_VALUE).getClass());
33 Assert.assertEquals(Long.class, Numbers.narrow(Long.MAX_VALUE).getClass());
34 Assert.assertEquals(Long.class, Numbers.narrow(Long.MIN_VALUE).getClass());
35
36 Assert.assertEquals((byte) 0, Numbers.narrow(0));
37 Assert.assertEquals((byte) 0, Numbers.narrow(0L));
38 Assert.assertEquals(Byte.MAX_VALUE, Numbers.narrow(Byte.MAX_VALUE));
39 Assert.assertEquals(Byte.MIN_VALUE, Numbers.narrow(Byte.MIN_VALUE));
40 Assert.assertEquals(Short.MAX_VALUE, Numbers.narrow(Short.MAX_VALUE));
41 Assert.assertEquals(Short.MIN_VALUE, Numbers.narrow(Short.MIN_VALUE));
42 Assert.assertEquals(Integer.MAX_VALUE, Numbers.narrow(Integer.MAX_VALUE));
43 Assert.assertEquals(Integer.MIN_VALUE, Numbers.narrow(Integer.MIN_VALUE));
44 Assert.assertEquals(Long.MAX_VALUE, Numbers.narrow(Long.MAX_VALUE));
45 Assert.assertEquals(Long.MIN_VALUE, Numbers.narrow(Long.MIN_VALUE));
46 }
47 }