2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.common;
10 import static org.junit.Assert.assertEquals;
12 import java.io.ByteArrayInputStream;
13 import java.io.ByteArrayOutputStream;
14 import java.io.ObjectInputStream;
15 import java.io.ObjectOutputStream;
16 import org.junit.Test;
18 public class ErrorTagTest {
20 public void testSerialization() throws Exception {
21 final ErrorTag expected = new ErrorTag("test");
24 try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
25 try (ObjectOutputStream oos = new ObjectOutputStream(bos)) {
26 oos.writeObject(expected);
28 bytes = bos.toByteArray();
31 try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes))) {
32 assertEquals(expected, ois.readObject());