*/
package org.opendaylight.controller.cluster.access.commands;
-import akka.actor.ActorRef;
-import akka.actor.ActorSystem;
-import akka.testkit.TestProbe;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
import org.opendaylight.controller.cluster.access.concepts.FrontendType;
import org.opendaylight.controller.cluster.access.concepts.MemberName;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
-public class AbortLocalTransactionRequestTest extends AbstractTransactionRequestTest<AbortLocalTransactionRequest> {
-
+public class AbortLocalTransactionRequestTest
+ extends AbstractLocalTransactionRequestTest<AbortLocalTransactionRequest> {
private static final FrontendIdentifier FRONTEND = FrontendIdentifier.create(
MemberName.forName("test"), FrontendType.forName("one"));
private static final ClientIdentifier CLIENT = ClientIdentifier.create(FRONTEND, 0);
private static final LocalHistoryIdentifier HISTORY = new LocalHistoryIdentifier(CLIENT, 0);
private static final TransactionIdentifier TRANSACTION = new TransactionIdentifier(HISTORY, 0);
- private static final ActorSystem SYSTEM = ActorSystem.create("test");
- private static final ActorRef ACTOR_REF = TestProbe.apply(SYSTEM).ref();
-
private static final AbortLocalTransactionRequest OBJECT = new AbortLocalTransactionRequest(TRANSACTION, ACTOR_REF);
@Override
- AbortLocalTransactionRequest object() {
+ protected AbortLocalTransactionRequest object() {
return OBJECT;
}
}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public abstract class AbstractLocalTransactionRequestTest<T extends AbstractLocalTransactionRequest>
+ extends AbstractTransactionRequestTest {
+ @Override
+ protected abstract T object();
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testExternalizableProxy() {
+ object().externalizableProxy(ABIVersion.BORON);
+ }
+
+ @Test
+ public void cloneAsVersionTest() {
+ Assert.assertEquals(object(), object().cloneAsVersion(ABIVersion.BORON));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import com.google.common.base.MoreObjects;
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public abstract class AbstractReadTransactionRequestTest<T extends AbstractReadTransactionRequest>
+ extends AbstractTransactionRequestTest {
+ protected static final YangInstanceIdentifier PATH = YangInstanceIdentifier.EMPTY;
+ protected static final boolean SNAPSHOT_ONLY = true;
+
+ @Override
+ protected abstract T object();
+
+ @Test
+ public void getPathTest() {
+ Assert.assertEquals(PATH, object().getPath());
+ }
+
+ @Test
+ public void isSnapshotOnlyTest() {
+ Assert.assertEquals(SNAPSHOT_ONLY, object().isSnapshotOnly());
+ }
+
+ @Test
+ public void addToStringAttributesTest() {
+ final MoreObjects.ToStringHelper result = object().addToStringAttributes(MoreObjects.toStringHelper(object()));
+ Assert.assertTrue(result.toString().contains("path=" + PATH));
+ }
+}
import org.junit.Assert;
import org.junit.Test;
-import org.opendaylight.controller.cluster.access.ABIVersion;
+import org.opendaylight.controller.cluster.access.concepts.AbstractRequestTest;
+import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
+import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
+import org.opendaylight.controller.cluster.access.concepts.FrontendType;
+import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
+import org.opendaylight.controller.cluster.access.concepts.MemberName;
+import org.opendaylight.controller.cluster.access.concepts.RequestException;
+import org.opendaylight.controller.cluster.access.concepts.RuntimeRequestException;
+import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
-public abstract class AbstractTransactionRequestTest<T extends AbstractLocalTransactionRequest> {
- abstract T object();
+public abstract class AbstractTransactionRequestTest<T extends TransactionRequest>
+ extends AbstractRequestTest {
+ private static final FrontendIdentifier FRONTEND_IDENTIFIER = FrontendIdentifier.create(
+ MemberName.forName("test"), FrontendType.forName("one"));
+ private static final ClientIdentifier CLIENT_IDENTIFIER = ClientIdentifier.create(FRONTEND_IDENTIFIER, 0);
+ private static final LocalHistoryIdentifier HISTORY_IDENTIFIER = new LocalHistoryIdentifier(
+ CLIENT_IDENTIFIER, 0);
+ protected static final TransactionIdentifier TRANSACTION_IDENTIFIER = new TransactionIdentifier(
+ HISTORY_IDENTIFIER, 0);
- @Test(expected = UnsupportedOperationException.class)
- public void testExternalizableProxy() {
- object().externalizableProxy(ABIVersion.BORON);
- }
+ @Override
+ protected abstract T object();
@Test
- public void cloneAsVersionTest() {
- Assert.assertEquals(object(), object().cloneAsVersion(ABIVersion.BORON));
+ public void toRequestFailureTest() {
+ final Throwable cause = new Throwable();
+ final RequestException exception = new RuntimeRequestException("fail", cause);
+ final TransactionFailure failure = object().toRequestFailure(exception);
+ Assert.assertNotNull(failure);
}
}
*/
package org.opendaylight.controller.cluster.access.commands;
-import akka.actor.ActorRef;
-import akka.actor.ActorSystem;
-import akka.testkit.TestProbe;
import com.google.common.base.MoreObjects;
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-public class CommitLocalTransactionRequestTest extends AbstractTransactionRequestTest<CommitLocalTransactionRequest> {
-
+public class CommitLocalTransactionRequestTest
+ extends AbstractLocalTransactionRequestTest<CommitLocalTransactionRequest> {
private static final FrontendIdentifier FRONTEND = FrontendIdentifier.create(
MemberName.forName("test"), FrontendType.forName("one"));
private static final ClientIdentifier CLIENT = ClientIdentifier.create(FRONTEND, 0);
private static final LocalHistoryIdentifier HISTORY = new LocalHistoryIdentifier(CLIENT, 0);
private static final TransactionIdentifier TRANSACTION = new TransactionIdentifier(HISTORY, 0);
- private static final ActorSystem SYSTEM = ActorSystem.create("test");
- private static final ActorRef ACTOR_REF = TestProbe.apply(SYSTEM).ref();
-
private static final DataTreeModification MODIFICATION = Mockito.mock(DataTreeModification.class);
private static final boolean COORDINATED = Boolean.TRUE;
TRANSACTION, 0, ACTOR_REF, MODIFICATION, COORDINATED);
@Override
- CommitLocalTransactionRequest object() {
+ protected CommitLocalTransactionRequest object() {
return OBJECT;
}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import com.google.common.base.MoreObjects;
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+import org.opendaylight.controller.cluster.access.concepts.AbstractRequestProxy;
+import org.opendaylight.controller.cluster.access.concepts.AbstractRequestTest;
+import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
+import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
+import org.opendaylight.controller.cluster.access.concepts.FrontendType;
+import org.opendaylight.controller.cluster.access.concepts.MemberName;
+import org.opendaylight.controller.cluster.access.concepts.RequestException;
+
+public class ConnectClientRequestTest extends AbstractRequestTest<ConnectClientRequest> {
+ private static final FrontendIdentifier FRONTEND_IDENTIFIER = FrontendIdentifier.create(
+ MemberName.forName("member"), FrontendType.forName("frontend"));
+ private static final ClientIdentifier CLIENT_IDENTIFIER = ClientIdentifier.create(FRONTEND_IDENTIFIER, 0);
+
+ private static final ABIVersion MIN_VERSION = ABIVersion.TEST_PAST_VERSION;
+ private static final ABIVersion MAX_VERSION = ABIVersion.TEST_FUTURE_VERSION;
+
+ private static final ConnectClientRequest OBJECT = new ConnectClientRequest(
+ CLIENT_IDENTIFIER, 0, ACTOR_REF, MIN_VERSION, MAX_VERSION);
+
+ @Override
+ protected ConnectClientRequest object() {
+ return OBJECT;
+ }
+
+ @Test
+ public void getMinVersion() throws Exception {
+ Assert.assertEquals(MIN_VERSION, OBJECT.getMinVersion());
+ }
+
+ @Test
+ public void getMaxVersion() throws Exception {
+ Assert.assertEquals(MAX_VERSION, OBJECT.getMaxVersion());
+ }
+
+ @Test
+ public void toRequestFailure() throws Exception {
+ final RequestException exception = new DeadTransactionException(0);
+ final ConnectClientFailure failure = OBJECT.toRequestFailure(exception);
+ Assert.assertNotNull(failure);
+ }
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final AbstractRequestProxy<ClientIdentifier, ConnectClientRequest> proxy = OBJECT.externalizableProxy(
+ ABIVersion.current());
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final ConnectClientRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertNotNull(clone);
+ Assert.assertEquals(ABIVersion.BORON, clone.getVersion());
+ }
+
+ @Test
+ public void addToStringAttributes() throws Exception {
+ final MoreObjects.ToStringHelper result = OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
+ Assert.assertTrue(result.toString().contains("minVersion=" + MIN_VERSION));
+ Assert.assertTrue(result.toString().contains("maxVersion=" + MAX_VERSION));
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class ExistsTransactionRequestTest extends AbstractReadTransactionRequestTest<ExistsTransactionRequest> {
+ private static final ExistsTransactionRequest OBJECT = new ExistsTransactionRequest(
+ TRANSACTION_IDENTIFIER, 0, ACTOR_REF, PATH, SNAPSHOT_ONLY);
+
+ @Override
+ protected ExistsTransactionRequest object() {
+ return OBJECT;
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final ABIVersion cloneVersion = ABIVersion.TEST_FUTURE_VERSION;
+ final ExistsTransactionRequest clone = OBJECT.cloneAsVersion(cloneVersion);
+ Assert.assertEquals(cloneVersion, clone.getVersion());
+ Assert.assertEquals(OBJECT.getPath(), clone.getPath());
+ Assert.assertEquals(OBJECT.isSnapshotOnly(), clone.isSnapshotOnly());
+ }
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final ABIVersion proxyVersion = ABIVersion.TEST_FUTURE_VERSION;
+ final ExistsTransactionRequestProxyV1 proxy = OBJECT.externalizableProxy(proxyVersion);
+ Assert.assertNotNull(proxy);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+
+public class ModifyTransactionRequestTest extends AbstractTransactionRequestTest<ModifyTransactionRequest> {
+ private static final NormalizedNode<?, ?> NODE = Builders.containerBuilder().withNodeIdentifier(
+ YangInstanceIdentifier.NodeIdentifier.create(QName.create("namespace", "localName"))).build();
+
+ private static final List<TransactionModification> MODIFICATIONS = Lists.newArrayList(
+ new TransactionWrite(YangInstanceIdentifier.EMPTY, NODE),
+ new TransactionMerge(YangInstanceIdentifier.EMPTY, NODE));
+
+ private static final PersistenceProtocol PROTOCOL = PersistenceProtocol.ABORT;
+
+ private static final ModifyTransactionRequest OBJECT = new ModifyTransactionRequest(
+ TRANSACTION_IDENTIFIER, 0, ACTOR_REF, MODIFICATIONS, PROTOCOL);
+
+ @Override
+ protected ModifyTransactionRequest object() {
+ return OBJECT;
+ }
+
+ @Test
+ public void getPersistenceProtocol() throws Exception {
+ final Optional<PersistenceProtocol> result = OBJECT.getPersistenceProtocol();
+ Assert.assertTrue(result.isPresent());
+ Assert.assertEquals(PROTOCOL, result.get());
+ }
+
+ @Test
+ public void getModificationsTest() throws Exception {
+ final List<TransactionModification> result = OBJECT.getModifications();
+ Assert.assertNotNull(result);
+ Assert.assertEquals(MODIFICATIONS, result);
+ }
+
+ @Test
+ public void addToStringAttributesTest() {
+ final MoreObjects.ToStringHelper result = OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
+ Assert.assertTrue(result.toString().contains("operations=" + MODIFICATIONS));
+ Assert.assertTrue(result.toString().contains("protocol=" + PROTOCOL));
+ }
+
+ @Test
+ public void externalizableProxyTest() throws Exception {
+ final ModifyTransactionRequestProxyV1 proxy = OBJECT.externalizableProxy(ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersionTest() throws Exception {
+ final ModifyTransactionRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class ReadTransactionRequestTest extends AbstractReadTransactionRequestTest<ReadTransactionRequest> {
+ private static final ReadTransactionRequest OBJECT = new ReadTransactionRequest(
+ TRANSACTION_IDENTIFIER, 0, ACTOR_REF, PATH, SNAPSHOT_ONLY);
+
+ @Override
+ protected ReadTransactionRequest object() {
+ return OBJECT;
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final ABIVersion cloneVersion = ABIVersion.TEST_FUTURE_VERSION;
+ final ReadTransactionRequest clone = OBJECT.cloneAsVersion(cloneVersion);
+ Assert.assertEquals(cloneVersion, clone.getVersion());
+ Assert.assertEquals(OBJECT.getPath(), clone.getPath());
+ Assert.assertEquals(OBJECT.isSnapshotOnly(), clone.isSnapshotOnly());
+ }
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final ABIVersion proxyVersion = ABIVersion.TEST_FUTURE_VERSION;
+ final ReadTransactionRequestProxyV1 proxy = OBJECT.externalizableProxy(proxyVersion);
+ Assert.assertNotNull(proxy);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class TransactionAbortRequestTest extends AbstractTransactionRequestTest<TransactionAbortRequest> {
+ private static final TransactionAbortRequest OBJECT = new TransactionAbortRequest(
+ TRANSACTION_IDENTIFIER, 0, ACTOR_REF);
+
+ @Override
+ protected TransactionAbortRequest object() {
+ return OBJECT;
+ }
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final TransactionAbortRequestProxyV1 proxy = OBJECT.externalizableProxy(ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final TransactionAbortRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class TransactionDoCommitRequestTest extends AbstractTransactionRequestTest<TransactionDoCommitRequest> {
+ private static final TransactionDoCommitRequest OBJECT = new TransactionDoCommitRequest(
+ TRANSACTION_IDENTIFIER, 0, ACTOR_REF);
+
+ @Override
+ protected TransactionDoCommitRequest object() {
+ return OBJECT;
+ }
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final TransactionDoCommitRequestProxyV1 proxy = OBJECT.externalizableProxy(ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final TransactionDoCommitRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class TransactionPreCommitRequestTest extends AbstractTransactionRequestTest<TransactionPreCommitRequest> {
+ private static final TransactionPreCommitRequest OBJECT = new TransactionPreCommitRequest(
+ TRANSACTION_IDENTIFIER, 0, ACTOR_REF);
+
+ @Override
+ protected TransactionPreCommitRequest object() {
+ return OBJECT;
+ }
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final TransactionPreCommitRequestProxyV1 proxy = OBJECT.externalizableProxy(ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final TransactionPreCommitRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.commands;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.ABIVersion;
+
+public class TransactionPurgeRequestTest extends AbstractTransactionRequestTest<TransactionPurgeRequest> {
+ private static final TransactionPurgeRequest OBJECT = new TransactionPurgeRequest(
+ TRANSACTION_IDENTIFIER, 0, ACTOR_REF);
+
+ @Override
+ protected TransactionPurgeRequest object() {
+ return OBJECT;
+ }
+
+ @Test
+ public void externalizableProxy() throws Exception {
+ final TransactionPurgeRequestProxyV1 proxy = OBJECT.externalizableProxy(ABIVersion.BORON);
+ Assert.assertNotNull(proxy);
+ }
+
+ @Test
+ public void cloneAsVersion() throws Exception {
+ final TransactionPurgeRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
+ Assert.assertEquals(OBJECT, clone);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.access.concepts;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.testkit.TestProbe;
+import com.google.common.base.MoreObjects;
+import org.junit.Assert;
+import org.junit.Test;
+
+public abstract class AbstractRequestTest<T extends Request> {
+ private static final ActorSystem SYSTEM = ActorSystem.create("test");
+ protected static final ActorRef ACTOR_REF = TestProbe.apply(SYSTEM).ref();
+
+ protected abstract T object();
+
+ @Test
+ public void getReplyToTest() {}
+
+ @Test
+ public void addToStringAttributesCommonTest() {
+ final MoreObjects.ToStringHelper result = object().addToStringAttributes(MoreObjects.toStringHelper(object()));
+ Assert.assertTrue(result.toString().contains("replyTo=" + ACTOR_REF));
+ }
+}