Copyright
[packetcable.git] / packetcable-driver / src / test / java / org / umu / cops / stack / COPSHandleSecondConstructorTest.java
1 package org.umu.cops.stack;
2
3 import org.junit.Assert;
4 import org.junit.Test;
5
6 /**
7  * Tests for the second constructor of the COPSHandle class.
8  * Should any of these tests be inaccurate it is due to the fact that they have been written after COPSHandle had been
9  * released and my assumptions may be incorrect.
10  */
11 public class COPSHandleSecondConstructorTest {
12
13     @Test(expected = IllegalArgumentException.class)
14     public void nullBytes() {
15         final byte[] bytes = null;
16         new COPSHandle(bytes);
17     }
18
19     @Test(expected = IllegalArgumentException.class)
20     public void emptyBytes() {
21         new COPSHandle(new byte[]{});
22     }
23
24     @Test(expected = IllegalArgumentException.class)
25     public void oneByte() {
26         new COPSHandle(new byte[]{(byte)1});
27     }
28
29 //    @Test
30     // TODO - Determine what values this byte array should contain??? As written, an exception is thrown in COPSData
31     // TODO - when attempting to set the _len attribute.
32     public void fourBytes() {
33         final byte[] bytes = new byte[]{(byte)1, (byte)2, (byte)3, (byte)4, (byte)5};
34         final COPSHandle handle = new COPSHandle(bytes);
35         Assert.assertEquals(4, handle.getDataLength());
36         Assert.fail("Implement me");
37     }
38
39     // TODO - implement more tests once we can determine how exactly to properly instantiate a COPSHandle object
40
41 }