### Question:
FramedCompressionAttribute extends Attribute { public int getCompression() { return compression; } FramedCompressionAttribute(int compression);  FramedCompressionAttribute(byte[] octets); int getCompression(); String toStringImpl(); static final int NONE; static final int VJ_TCP_IP_HEADER; static final int IPX_HEADER; static final int STAC_LZS; }### Answer:
@Test public void testNoCompression() throws IOException { final FramedCompressionAttribute a = new FramedCompressionAttribute(0); Assert.assertEquals(a.getCompression(), FramedCompressionAttribute.NONE); final byte[] bytes = a.getOctets(); Assert.assertEquals(bytes[0], AttributeType.FRAMED_COMPRESSION.getTypeCode()); Assert.assertEquals(bytes[1], 6); Assert.assertEquals(bytes[2], 0); Assert.assertEquals(bytes[3], 0); Assert.assertEquals(bytes[4], 0); Assert.assertEquals(bytes[5], 0); }
@Test public void testVjTcpIpCompression() throws IOException { final FramedCompressionAttribute a = new FramedCompressionAttribute(1); Assert.assertEquals(a.getCompression(), FramedCompressionAttribute.VJ_TCP_IP_HEADER); final byte[] bytes = a.getOctets(); Assert.assertEquals(bytes[0], AttributeType.FRAMED_COMPRESSION.getTypeCode()); Assert.assertEquals(bytes[1], 6); Assert.assertEquals(bytes[2], 0); Assert.assertEquals(bytes[3], 0); Assert.assertEquals(bytes[4], 0); Assert.assertEquals(bytes[5], 1); }
@Test public void testIpxFromRawBytes() throws IOException { final byte[] raw = new byte[] {13, 6, 0, 0, 0, 2}; final FramedCompressionAttribute a = new FramedCompressionAttribute(raw); Assert.assertEquals(a.getCompression(), FramedCompressionAttribute.IPX_HEADER); Assert.assertEquals(a.getType(), AttributeType.FRAMED_COMPRESSION); }
@Test public void testSlzsFromRawBytes() throws IOException { final byte[] raw = new byte[] {13, 6, 0, 0, 0, 3}; final FramedCompressionAttribute a = new FramedCompressionAttribute(raw); Assert.assertEquals(a.getCompression(), FramedCompressionAttribute.STAC_LZS); Assert.assertEquals(a.getType(), AttributeType.FRAMED_COMPRESSION); }