ClosedTransactionException unit test 94/54094/1
authormatus.kubica <matus.kubica@pantheon.tech>
Thu, 30 Mar 2017 11:08:36 +0000 (13:08 +0200)
committermatus.kubica <matus.kubica@pantheon.tech>
Thu, 30 Mar 2017 11:08:36 +0000 (13:08 +0200)
Change-Id: Ib86fe2e8e6ece0c5cc41efdcae02223cf94d362b
Signed-off-by: matus.kubica <matus.kubica@pantheon.tech>
opendaylight/md-sal/cds-access-api/src/test/java/org/opendaylight/controller/cluster/access/commands/ClosedTransactionExceptionTest.java [new file with mode: 0644]

diff --git a/opendaylight/md-sal/cds-access-api/src/test/java/org/opendaylight/controller/cluster/access/commands/ClosedTransactionExceptionTest.java b/opendaylight/md-sal/cds-access-api/src/test/java/org/opendaylight/controller/cluster/access/commands/ClosedTransactionExceptionTest.java
new file mode 100644 (file)
index 0000000..e3750ae
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.access.concepts.RequestExceptionTest;
+
+public class ClosedTransactionExceptionTest extends RequestExceptionTest<ClosedTransactionException> {
+
+    private static final ClosedTransactionException OBJECT = new ClosedTransactionException(true);
+
+    @Override
+    protected void isRetriable() {
+        assertFalse(OBJECT.isRetriable());
+    }
+
+    @Override
+    protected void checkMessage() {
+        final String message = OBJECT.getMessage();
+        assertEquals("Transaction has been " + "committed", message);
+        assertNull(OBJECT.getCause());
+    }
+
+    @Test
+    public void testIsSuccessful() throws Exception {
+        Assert.assertEquals(true, OBJECT.isSuccessful());
+    }
+
+}
\ No newline at end of file