blob: 08154cf6e6cf1ff634dd16b92b783c6eb7b3fcaa [file] [log] [blame]
Ray Milkey8f7feed2015-10-23 15:08:47 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Ray Milkey8f7feed2015-10-23 15:08:47 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.net.packet;
17
18import org.junit.Test;
19
20import static org.hamcrest.MatcherAssert.assertThat;
21import static org.hamcrest.Matchers.greaterThanOrEqualTo;
22import static org.hamcrest.Matchers.lessThan;
23
24/**
25 * Unit tests for static APIs in the packet processor class.
26 */
27public class PacketProcessorTest {
28
29 /**
30 * Tests a priority in the advisor range.
31 */
32 @Test
33 public void testAdvisorPriorities() {
34 int advisorPriority = PacketProcessor.advisor(3);
35 assertThat(advisorPriority, lessThan(PacketProcessor.ADVISOR_MAX));
36 assertThat(advisorPriority, greaterThanOrEqualTo(0));
37 }
38
39 /**
40 * Tests a priority in the director range.
41 */
42 @Test
43 public void testDirectorPriorities() {
44 int directorPriority = PacketProcessor.director(3);
45 assertThat(directorPriority, lessThan(PacketProcessor.DIRECTOR_MAX));
46 assertThat(directorPriority, greaterThanOrEqualTo(PacketProcessor.ADVISOR_MAX));
47 }
48
49 /**
50 * Tests a priority in the observer range.
51 */
52 @Test
53 public void testObserverPriorities() {
54 int observerPriority = PacketProcessor.observer(3);
55 assertThat(observerPriority, lessThan(PacketProcessor.OBSERVER_MAX));
56 assertThat(observerPriority, greaterThanOrEqualTo(PacketProcessor.DIRECTOR_MAX));
57 }
58
59}