1 package org.opendaylight.controller.sal.restconf.impl.test;
3 import static org.junit.Assert.assertEquals;
4 import static org.mockito.Mockito.mock;
7 import org.opendaylight.controller.sal.restconf.impl.RestCodec;
8 import org.opendaylight.yangtools.concepts.Codec;
9 import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
10 import org.opendaylight.yangtools.yang.model.util.BitsType;
12 public class RestCodecExceptionsTest {
15 public void serializeExceptionTest() {
16 Codec<Object, Object> codec = RestCodec.from(new BitsType(null));
17 String serializedValue = (String) codec.serialize("incorrect value"); // set
19 assertEquals("incorrect value", serializedValue);
23 public void deserializeExceptionTest() {
24 IdentityrefTypeDefinition mockedIidentityrefType = mock(IdentityrefTypeDefinition.class);
26 Codec<Object, Object> codec = RestCodec.from(mockedIidentityrefType);
27 String serializedValue = (String) codec.deserialize("incorrect value"); // IdentityValuesDTO
30 assertEquals("incorrect value", serializedValue);