Add missing license headers
[packetcable.git] / packetcable-driver / src / test / java / org / pcmm / objects / MMVersionInfoTest.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.objects;
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 MMVersionInfo to ensure both construction and byte parsing result in correct object
16  * creation.
17  */
18 public class MMVersionInfoTest {
19
20     @Test
21     public void construction() {
22         final MMVersionInfo verInfo = new MMVersionInfo((short)5, (short)6);
23         final byte[] dataBytes = verInfo.getBytes();
24         Assert.assertEquals(4, dataBytes.length);
25         Assert.assertEquals(5, COPSMsgParser.bytesToShort(dataBytes[0], dataBytes[1]));
26         Assert.assertEquals(6, COPSMsgParser.bytesToShort(dataBytes[2], dataBytes[3]));
27     }
28
29     @Test
30     public void byteParsing() {
31         final MMVersionInfo verInfo = new MMVersionInfo((short)7, (short)8);
32         final MMVersionInfo parsed = MMVersionInfo.parse(verInfo.getBytes());
33         Assert.assertEquals(verInfo, parsed);
34     }
35
36 }