fe11a9b4843fa3487ef0d752ea85a49c7e7e65de
[yangtools.git] / common / concepts / src / test / java / org / opendaylight / yangtools / concepts / AbstractIllegalArgumentCodecTest.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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.concepts;
9
10 import static org.junit.Assert.assertThrows;
11
12 import org.junit.Test;
13
14 public class AbstractIllegalArgumentCodecTest {
15     private static final class TestCodec extends AbstractIllegalArgumentCodec<String, String> {
16         @Override
17         protected String deserializeImpl(final String product) {
18             throw new AssertionError("Should never be invoked");
19         }
20
21         @Override
22         protected String serializeImpl(final String input) {
23             throw new AssertionError("Should never be invoked");
24         }
25     }
26
27     private final TestCodec codec = new TestCodec();
28
29     @Test
30     public void testNullDeserialize() {
31         assertThrows(NullPointerException.class, () -> codec.deserialize(null));
32     }
33
34     @Test
35     public void testNullSerialize() {
36         assertThrows(NullPointerException.class, () -> codec.serialize(null));
37     }
38 }