blob: d8d9ed800a36eab147aa0fa7c0856f4ed2dfe2d5 [file] [log] [blame]
Simon Hunta3b61bc2017-10-30 16:46:41 -07001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
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.opencord.aaa.api;
17
18import org.junit.Test;
19import org.onlab.packet.Ethernet;
20import org.onlab.packet.RADIUS;
21
22import static org.junit.Assert.assertEquals;
23import static org.junit.Assert.assertSame;
24
25/**
26 * Unit tests for {@link PacketCustomizer}.
27 */
28public class PacketCustomizerTest {
29
30 private static final RADIUS RADIUS_PACKET = new RADIUS();
31 private static final Ethernet ETHERNET_PACKET = new Ethernet();
32
33 private PacketCustomizer customizer;
34
35 @Test
36 public void noChangeToRadius() {
37 customizer = new PacketCustomizer();
38 RADIUS transformed = customizer.customizePacket(RADIUS_PACKET, null);
39 assertSame(RADIUS_PACKET, transformed);
40 assertEquals(RADIUS_PACKET, transformed);
41 }
42
43 @Test
44 public void noChangeToEthernet() {
45 customizer = new PacketCustomizer();
46 Ethernet transformed =
47 customizer.customizeEthernetIPHeaders(ETHERNET_PACKET, null);
48 assertSame(ETHERNET_PACKET, transformed);
49 assertEquals(ETHERNET_PACKET, transformed);
50 }
51}