ObjectId { public static byte[] parseObjectId(String s) { if (s == null) { throw new IllegalArgumentException("Argument 's' cannot be null."); } return StringUtil.fromHex(s); } ObjectId(byte[] identifier); byte[] getBytes(); @Override String toString(); static byte[] parseObjectId(String s); static byte[] secureRandomBytes(int size); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test(expected = IllegalArgumentException.class) public void testObjectIdParsedInvalidHex1() { ObjectId.parseObjectId("1"); }
@Test(expected = IllegalArgumentException.class) public void testObjectIdParsedInvalidHex2() { ObjectId.parseObjectId("X"); }
@Test public void testObjectIdParsedEmpty() { Assert.assertArrayEquals(new byte[] { }, ObjectId.parseObjectId("")); }
@Test(expected = IllegalArgumentException.class) public void testObjectIdParsedInvalidNull() { ObjectId.parseObjectId(null); }