1 package org.umu.cops.stack;
3 import org.junit.Assert;
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.
11 public class COPSHandleSecondConstructorTest {
13 @Test(expected = IllegalArgumentException.class)
14 public void nullBytes() {
15 final byte[] bytes = null;
16 new COPSHandle(bytes);
19 @Test(expected = IllegalArgumentException.class)
20 public void emptyBytes() {
21 new COPSHandle(new byte[]{});
24 @Test(expected = IllegalArgumentException.class)
25 public void oneByte() {
26 new COPSHandle(new byte[]{(byte)1});
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");
39 // TODO - implement more tests once we can determine how exactly to properly instantiate a COPSHandle object