### Question:
SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", offset)); } int length = hex.length - offset; length += length / 2 - 1; char[] buffer = new char[length]; int dst = 0; for (int src = offset; src < hex.length; src++) { if (offset < src && src % 2 == 0) { buffer[dst++] = ':'; } buffer[dst++] = hex[src]; } return new String(buffer); } SwitchId(long switchId);  SwitchId(String switchId); long toLong(); String toMacAddress(); @JsonValue @Override String toString(); String toOtsdFormat(); @Override int compareTo(SwitchId other);  }### Answer:
@Test public void colonSeparatedBytesIllegalArgumentExceptionNegativeOffset() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", -1)); new SwitchId("00").colonSeparatedBytes(new char[]{'t', 'e', 's', 't'}, -1); }
@Test public void colonSeparatedBytesIllegalArgumentExceptionOddOffset() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", 3)); new SwitchId("00").colonSeparatedBytes(new char[]{'t', 'e', 's', 't'}, 3); }
@Test public void colonSeparatedBytesIllegalArgumentExceptionMoreThenHexLength() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", 6)); new SwitchId("00").colonSeparatedBytes(new char[]{'t', 'e', 's', 't'}, 6); }