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 c91fe2bc00053560fa3e3791f44b31e726423916..b86c94c90a41aafb3e1efbefe9a3523d51b705b2 100644 (file)
@@ -1,12 +1,25 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. 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.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();
 
@@ -15,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