2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.server.api.operations;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
14 import org.junit.Test;
16 public class HandlingPriorityTest {
18 public void testHandlingPriority() {
20 HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.compareTo(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY));
23 HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.compareTo(HandlingPriority.HANDLE_WITH_MAX_PRIORITY));
25 HandlingPriority.HANDLE_WITH_MAX_PRIORITY.compareTo(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY));
26 assertEquals(0, new HandlingPriority(Integer.MIN_VALUE)
27 .compareTo(HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY));
29 HandlingPriority prio = new HandlingPriority(10);
30 assertTrue(prio.increasePriority(1).compareTo(new HandlingPriority(11)) == 0);
32 assertFalse(HandlingPriority.HANDLE_WITH_MAX_PRIORITY.equals(new Object()));
33 assertEquals(HandlingPriority.HANDLE_WITH_MAX_PRIORITY, new HandlingPriority(Integer.MAX_VALUE));
34 assertEquals(HandlingPriority.HANDLE_WITH_MAX_PRIORITY.hashCode(),
35 new HandlingPriority(Integer.MAX_VALUE).hashCode());