### Question:
AsnUintCodec extends AsnOctetStringBasedObjectCodec<BigInteger> { @Override public void encode(final BigInteger value) { if (value.compareTo(BigInteger.ZERO) < 0) { throw new IllegalArgumentException("value must be positive or zero"); } byte[] bytes = value.toByteArray(); if (bytes[0] == 0x00 && bytes.length > 1) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(bytes, 1, bytes.length - 1); setBytes(baos.toByteArray()); return; } setBytes(bytes); } AsnUintCodec(); @Override BigInteger decode(); @Override void encode(final BigInteger value);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void encodeNegative() { try { codec.encode(BigInteger.valueOf(-1L)); } catch (IllegalArgumentException e) { assertThat(e.getMessage()).isEqualTo("value must be positive or zero"); throw e; } }
@Test public void encode() { codec.encode(expectedUint); assertThat(codec.getBytes()).isEqualTo(this.expectedEncodedBytes); }