Remove use of {String,UUID}Identifier
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / identifiers / TransactionChainIdentifierTest.java
index 265ecb56b3d4104c373b7aec1c120d54338c3f17..b86c94c90a41aafb3e1efbefe9a3523d51b705b2 100644 (file)
@@ -8,13 +8,18 @@
 
 package org.opendaylight.controller.cluster.datastore.identifiers;
 
+import static org.hamcrest.CoreMatchers.startsWith;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 import org.junit.Test;
+import org.opendaylight.controller.cluster.access.concepts.MemberName;
 
 public class TransactionChainIdentifierTest {
+    private static final MemberName MEMBER_1 = MemberName.forName("member-1");
+
     @Test
     public void testToString(){
-        TransactionChainIdentifier transactionChainIdentifier = new TransactionChainIdentifier("member-1", 99);
+        TransactionChainIdentifier transactionChainIdentifier = new TransactionChainIdentifier(MEMBER_1, 99);
 
         String id = transactionChainIdentifier.toString();
 
@@ -23,15 +28,15 @@ public class TransactionChainIdentifierTest {
 
     @Test
     public void testNewTransactionIdentifier(){
-        TransactionChainIdentifier transactionChainIdentifier = new TransactionChainIdentifier("member-1", 99);
+        TransactionChainIdentifier transactionChainIdentifier = new TransactionChainIdentifier(MEMBER_1, 99);
 
         TransactionIdentifier txId1 = transactionChainIdentifier.newTransactionIdentifier();
 
-        assertEquals("member-1-chn-99-txn-1", txId1.toString());
+        assertThat(txId1.toString(), startsWith("member-1-chn-99-txn-1-"));
 
         TransactionIdentifier txId2 = transactionChainIdentifier.newTransactionIdentifier();
 
-        assertEquals("member-1-chn-99-txn-2", txId2.toString());
+        assertThat(txId2.toString(), startsWith("member-1-chn-99-txn-2-"));
     }
 
 }
\ No newline at end of file