Typedef changes in SFC project
[groupbasedpolicy.git] / renderers / ofoverlay / src / test / java / org / opendaylight / groupbasedpolicy / renderer / ofoverlay / flow / ActionComparatorTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow;
10
11 import static org.mockito.Mockito.mock;
12 import static org.mockito.Mockito.when;
13
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;
17
18 public class ActionComparatorTest {
19
20     @Test
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);
28
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));
33     }
34 }