af7260a369dc639c566520d4fed1b72924ce79c5
[yangtools.git] /
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.yang.data.api.codec;
9
10 import static org.junit.jupiter.api.Assertions.assertThrows;
11
12 import org.junit.jupiter.api.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 }