import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import com.google.common.base.Optional;
import com.google.common.io.ByteSource;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
public void setUp() {
String source = "Test source.";
schemaSource = YangTextSchemaSource.delegateForByteSource(
- RevisionSourceIdentifier.create("test", Optional.of("2015-10-30")),
+ RevisionSourceIdentifier.create("test", Revision.of("2015-10-30")),
ByteSource.wrap(source.getBytes(StandardCharsets.UTF_8)));
}
@Test
- public void serializeAndDesrializeProxy() throws ClassNotFoundException, IOException {
+ public void serializeAndDeserializeProxy() throws ClassNotFoundException, IOException {
YangTextSchemaSourceSerializationProxy proxy = new YangTextSchemaSourceSerializationProxy(schemaSource);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(proxy);
- ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
+ final byte[] bytes = bos.toByteArray();
+ assertEquals(353, bytes.length);
+
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
YangTextSchemaSourceSerializationProxy deserializedProxy =
(YangTextSchemaSourceSerializationProxy) ois.readObject();