2 * (c) 2015 Cable Television Laboratories, Inc. All rights reserved.
5 package org.pcmm.gates.impl;
7 import org.junit.Assert;
9 import org.umu.cops.stack.COPSMsgParser;
12 * Tests the data holder class AMID to ensure both construction and byte parsing result in correct object creation.
14 public class AMIDTest {
17 public void construction() {
18 final AMID amid = new AMID((short)5, (short)6);
19 final byte[] dataBytes = amid.getBytes();
20 Assert.assertEquals((short)5, amid.getApplicationType());
21 Assert.assertEquals((short)6, amid.getApplicationMgrTag());
22 Assert.assertEquals(4, dataBytes.length);
23 Assert.assertEquals(5, COPSMsgParser.bytesToShort(dataBytes[0], dataBytes[1]));
24 Assert.assertEquals(6, COPSMsgParser.bytesToShort(dataBytes[2], dataBytes[3]));
28 public void byteParsing() {
29 final AMID amid = new AMID((short)7, (short)8);
30 final AMID parsed = AMID.parse(amid.getBytes());
31 Assert.assertEquals(amid, parsed);