Do not pretty-print body class
[yangtools.git] / data / yang-data-impl / src / test / java / org / opendaylight / yangtools / yang / data / impl / codec / EmptyCodecStringTest.java
1 /*
2  * Copyright (c) 2016 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 package org.opendaylight.yangtools.yang.data.impl.codec;
9
10 import static org.junit.Assert.assertEquals;
11
12 import org.junit.Test;
13 import org.opendaylight.yangtools.yang.common.Empty;
14 import org.opendaylight.yangtools.yang.data.api.codec.EmptyCodec;
15 import org.opendaylight.yangtools.yang.model.ri.type.BaseTypes;
16
17 /**
18  * Unit tests for EmptyCodecString.
19  *
20  * @author Thomas Pantelis
21  */
22 public class EmptyCodecStringTest {
23
24     @SuppressWarnings("unchecked")
25     @Test
26     public void testSerialize() {
27         EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.emptyType(), EmptyCodec.class);
28
29         assertEquals("serialize", "", codec.serialize(Empty.getInstance()));
30     }
31
32     @SuppressWarnings("unchecked")
33     @Test
34     public void testDeserialize() {
35         EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.emptyType(), EmptyCodec.class);
36
37         assertEquals("deserialize", Empty.getInstance(), codec.deserialize(""));
38
39         TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "foo");
40     }
41 }