BUG 2667 : Handle null value type
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / cluster / datastore / node / utils / serialization / ValueTypeTest.java
1 package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
2
3 import static org.junit.Assert.assertEquals;
4 import org.junit.Test;
5
6 public class ValueTypeTest {
7
8     @Test
9     public void testGetSerializableType(){
10         byte[] b = new byte[10];
11         b[0] = 1;
12         b[2] = 2;
13
14         ValueType serializableType = ValueType.getSerializableType(b);
15         assertEquals(ValueType.BINARY_TYPE, serializableType);
16     }
17
18     @Test
19     public void testNullType(){
20         ValueType serializableType = ValueType.getSerializableType(null);
21         assertEquals(ValueType.NULL_TYPE, serializableType);
22
23         assertEquals(null, ValueType.NULL_TYPE.deserialize(""));
24     }
25 }