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
9 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow;
11 import static org.mockito.Mockito.mock;
12 import static org.mockito.Mockito.when;
14 import org.junit.Assert;
15 import org.junit.Test;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
18 public class ActionComparatorTest {
21 public void compareTest() {
22 Action actionLess = mock(Action.class);
23 Action actionMore = mock(Action.class);
24 Action actionNull = mock(Action.class);
25 when(actionLess.getOrder()).thenReturn(Integer.valueOf(3));
26 when(actionMore.getOrder()).thenReturn(Integer.valueOf(5));
27 when(actionNull.getOrder()).thenReturn(null);
29 Assert.assertEquals(1, ActionComparator.INSTANCE.compare(actionMore, actionLess));
30 Assert.assertEquals(1, ActionComparator.INSTANCE.compare(actionNull, actionLess));
31 Assert.assertEquals(-1, ActionComparator.INSTANCE.compare(actionLess, actionMore));
32 Assert.assertEquals(-1, ActionComparator.INSTANCE.compare(actionLess, actionNull));