15805497adbfe59d67f6cac045850e44b48a1ea7
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / cluster / datastore / node / utils / serialization / ValueTypeTest.java
1 /*
2  * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
10
11 import static org.junit.Assert.assertEquals;
12 import org.junit.Test;
13
14 public class ValueTypeTest {
15
16     @Test
17     public void testGetSerializableType(){
18         byte[] b = new byte[10];
19         b[0] = 1;
20         b[2] = 2;
21
22         ValueType serializableType = ValueType.getSerializableType(b);
23         assertEquals(ValueType.BINARY_TYPE, serializableType);
24     }
25
26     @Test
27     public void testNullType(){
28         ValueType serializableType = ValueType.getSerializableType(null);
29         assertEquals(ValueType.NULL_TYPE, serializableType);
30
31         assertEquals(null, ValueType.NULL_TYPE.deserialize(""));
32     }
33 }