@Test public void testGetLength() { short id = 41; byte[] contentTypeBytes = BitUtil.splitShortToBytes(id); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); outputStream.write(contentTypeBytes[1]); CoAPOptionHeader h = new CoAPOptionHeader(CoAPOptionName.CONTENT_FORMAT, outputStream.toByteArray()); byte[] test = outputStream.toByteArray(); int headerLength = h.getLength(); assertEquals(test.length, headerLength); h = new CoAPOptionHeader(CoAPOptionName.CONTENT_FORMAT.getName(), outputStream.toByteArray()); try { outputStream.flush(); } catch (IOException e) { e.printStackTrace(); } headerLength = h.getLength(); assertEquals(test.length, headerLength); headerLength++; assertFalse(test.length == headerLength); }
public int getLength() { return length; }
CoAPOptionHeader implements Comparable<CoAPOptionHeader> { public int getLength() { return length; } }
CoAPOptionHeader implements Comparable<CoAPOptionHeader> { public int getLength() { return length; } CoAPOptionHeader(CoAPOptionName name, byte[] value);  CoAPOptionHeader(CoAPOptionName name);  CoAPOptionHeader(String optionName, byte[] value); }
CoAPOptionHeader implements Comparable<CoAPOptionHeader> { public int getLength() { return length; } CoAPOptionHeader(CoAPOptionName name, byte[] value);  CoAPOptionHeader(CoAPOptionName name);  CoAPOptionHeader(String optionName, byte[] value); CoAPOptionName getOptionName(); int getOptionNumber(); int getLength(); byte[] getValue(); void setValue(byte[] value); @Override int compareTo(CoAPOptionHeader header); @Override int hashCode(); @Override boolean equals(Object obj); }
CoAPOptionHeader implements Comparable<CoAPOptionHeader> { public int getLength() { return length; } CoAPOptionHeader(CoAPOptionName name, byte[] value);  CoAPOptionHeader(CoAPOptionName name);  CoAPOptionHeader(String optionName, byte[] value); CoAPOptionName getOptionName(); int getOptionNumber(); int getLength(); byte[] getValue(); void setValue(byte[] value); @Override int compareTo(CoAPOptionHeader header); @Override int hashCode(); @Override boolean equals(Object obj);  }