2 * Copyright (c) 2017 Pantheon Technologies 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.controller.cluster.access.commands;
10 import static org.hamcrest.CoreMatchers.allOf;
11 import static org.hamcrest.CoreMatchers.endsWith;
12 import static org.hamcrest.CoreMatchers.startsWith;
13 import static org.hamcrest.MatcherAssert.assertThat;
14 import static org.junit.Assert.assertSame;
15 import static org.junit.Assert.assertThrows;
17 import org.apache.commons.lang.SerializationUtils;
18 import org.junit.Test;
19 import org.opendaylight.controller.cluster.access.ABIVersion;
21 public abstract class AbstractLocalTransactionRequestTest<T extends AbstractLocalTransactionRequest<T>>
22 extends AbstractTransactionRequestTest<T> {
23 protected AbstractLocalTransactionRequestTest(final T object, final int baseSize, final int legacySize) {
24 super(object, baseSize, legacySize);
28 public void cloneAsVersionTest() {
29 assertSame(object(), object().cloneAsVersion(ABIVersion.BORON));
34 public void serializationTest() {
35 final var ex = assertThrows(UnsupportedOperationException.class, () -> SerializationUtils.clone(object()));
36 assertThat(ex.getMessage(), allOf(
37 startsWith("Local transaction request "),
38 endsWith(" should never be serialized")));