Some tests for transportpce-common
[transportpce.git] / common / src / test / java / org / opendaylight / transportpce / common / mapping / SortPort121ByNameTest.java
diff --git a/common/src/test/java/org/opendaylight/transportpce/common/mapping/SortPort121ByNameTest.java b/common/src/test/java/org/opendaylight/transportpce/common/mapping/SortPort121ByNameTest.java
new file mode 100644 (file)
index 0000000..e3c710c
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2020 Orange.  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.transportpce.common.mapping;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.Port;
+
+public class SortPort121ByNameTest {
+
+    @Before
+    public void setUp() throws Exception {
+    }
+
+    @Test
+    public void compareTest() {
+        Port port1 = mock(Port.class);
+        Port port2 = mock(Port.class);
+        when(port1.getPortName()).thenReturn("port1");
+        when(port2.getPortName()).thenReturn("port2");
+        SortPort121ByName sortPort121ByName = new SortPort121ByName();
+        assertEquals(sortPort121ByName.compare(port2, port1), 1);
+
+    }
+}
\ No newline at end of file