Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / cds-access-api / src / test / java / org / opendaylight / controller / cluster / access / commands / AbstractLocalTransactionRequestTest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies 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.controller.cluster.access.commands;
9
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;
16
17 import org.apache.commons.lang3.SerializationUtils;
18 import org.junit.Test;
19 import org.opendaylight.controller.cluster.access.ABIVersion;
20
21 public abstract class AbstractLocalTransactionRequestTest<T extends AbstractLocalTransactionRequest<T>>
22         extends AbstractTransactionRequestTest<T> {
23     protected AbstractLocalTransactionRequestTest(final T object) {
24         super(object, -1);
25     }
26
27     @Test
28     public void cloneAsVersionTest() {
29         assertSame(object(), object().cloneAsVersion(ABIVersion.TEST_FUTURE_VERSION));
30     }
31
32     @Override
33     @Test
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")));
39     }
40 }