Add netconf-mapping-api test for HandlingPriority 63/23163/3
authorTomas Cere <tcere@cisco.com>
Tue, 23 Jun 2015 09:35:50 +0000 (11:35 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 20 Jul 2015 10:43:19 +0000 (10:43 +0000)
Change-Id: I29a6fdaab266acd42c5355101769bb82c14135fc
Signed-off-by: Tomas Cere <tcere@cisco.com>
opendaylight/netconf/netconf-mapping-api/src/test/java/org/opendaylight/controller/netconf/mapping/api/HandlingPriorityTest.java [new file with mode: 0644]

diff --git a/opendaylight/netconf/netconf-mapping-api/src/test/java/org/opendaylight/controller/netconf/mapping/api/HandlingPriorityTest.java b/opendaylight/netconf/netconf-mapping-api/src/test/java/org/opendaylight/controller/netconf/mapping/api/HandlingPriorityTest.java
new file mode 100644 (file)
index 0000000..6faec64
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.netconf.mapping.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class HandlingPriorityTest {
+
+    @Test
+    public void testHandlingPriority() throws Exception {
+
+
+        assertTrue(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.compareTo(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY) == 0);
+        assertTrue(HandlingPriority.CANNOT_HANDLE.compareTo(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY) == -1);
+        assertTrue(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.compareTo(HandlingPriority.CANNOT_HANDLE) == 1);
+
+        assertTrue(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.compareTo(HandlingPriority.HANDLE_WITH_MAX_PRIORITY) == -1);
+        assertTrue(HandlingPriority.HANDLE_WITH_MAX_PRIORITY.compareTo(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY) == 1);
+        assertTrue(HandlingPriority.getHandlingPriority(Integer.MIN_VALUE).compareTo(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY) == 0);
+
+        HandlingPriority prio = HandlingPriority.getHandlingPriority(10);
+        assertTrue(prio.increasePriority(1).compareTo(HandlingPriority.getHandlingPriority(11)) == 0);
+
+        assertFalse(HandlingPriority.CANNOT_HANDLE.getPriority().isPresent());
+        assertFalse(HandlingPriority.HANDLE_WITH_MAX_PRIORITY.equals(new Object()));
+        assertEquals(HandlingPriority.HANDLE_WITH_MAX_PRIORITY, HandlingPriority.getHandlingPriority(Integer.MAX_VALUE));
+        assertEquals(HandlingPriority.HANDLE_WITH_MAX_PRIORITY.hashCode(), HandlingPriority.getHandlingPriority(Integer.MAX_VALUE).hashCode());
+    }
+}

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.