Add missing license headers
[packetcable.git] / packetcable-driver / src / test / java / org / pcmm / gates / impl / AMIDTest.java
1 /*
2  * Copyright (c) 2015 Cable Television Laboratories, 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 package org.pcmm.gates.impl;
9
10 import org.junit.Assert;
11 import org.junit.Test;
12 import org.umu.cops.stack.COPSMsgParser;
13
14 /**
15  * Tests the data holder class AMID to ensure both construction and byte parsing result in correct object creation.
16  */
17 public class AMIDTest {
18
19     @Test
20     public void construction() {
21         final AMID amid = new AMID((short)5, (short)6);
22         final byte[] dataBytes = amid.getBytes();
23         Assert.assertEquals((short)5, amid.getApplicationType());
24         Assert.assertEquals((short)6, amid.getApplicationMgrTag());
25         Assert.assertEquals(4, dataBytes.length);
26         Assert.assertEquals(5, COPSMsgParser.bytesToShort(dataBytes[0], dataBytes[1]));
27         Assert.assertEquals(6, COPSMsgParser.bytesToShort(dataBytes[2], dataBytes[3]));
28     }
29
30     @Test
31     public void byteParsing() {
32         final AMID amid = new AMID((short)7, (short)8);
33         final AMID parsed = AMID.parse(amid.getBytes());
34         Assert.assertEquals(amid, parsed);
35     }
36
37 }