@Test public void testInvalidString() { String foobar = "clearly-bad-md5string"; try { MD5Digest md5Digest = MD5Digest.fromString(foobar); Assert.fail("Should have thrown an exception"); } catch (Exception e) { log.info("Found expected exception", e.getMessage()); } }
public static MD5Digest fromString(String md5String) { byte[] bytes; try { bytes = Hex.decodeHex(md5String.toCharArray()); return new MD5Digest(md5String, bytes); } catch (DecoderException e) { throw new IllegalArgumentException("Unable to convert md5string", e); } }
MD5Digest { public static MD5Digest fromString(String md5String) { byte[] bytes; try { bytes = Hex.decodeHex(md5String.toCharArray()); return new MD5Digest(md5String, bytes); } catch (DecoderException e) { throw new IllegalArgumentException("Unable to convert md5string", e); } } }
MD5Digest { public static MD5Digest fromString(String md5String) { byte[] bytes; try { bytes = Hex.decodeHex(md5String.toCharArray()); return new MD5Digest(md5String, bytes); } catch (DecoderException e) { throw new IllegalArgumentException("Unable to convert md5string", e); } } private  MD5Digest(String md5String, byte[] md5bytes); }
MD5Digest { public static MD5Digest fromString(String md5String) { byte[] bytes; try { bytes = Hex.decodeHex(md5String.toCharArray()); return new MD5Digest(md5String, bytes); } catch (DecoderException e) { throw new IllegalArgumentException("Unable to convert md5string", e); } } private  MD5Digest(String md5String, byte[] md5bytes); String asString(); byte[] asBytes(); static MD5Digest fromString(String md5String); static MD5Digest fromBytes(byte[] md5Bytes); static MD5Digest fromBytes(byte[] md5Bytes, int offset); @Override int hashCode(); @Override boolean equals(Object obj); }
MD5Digest { public static MD5Digest fromString(String md5String) { byte[] bytes; try { bytes = Hex.decodeHex(md5String.toCharArray()); return new MD5Digest(md5String, bytes); } catch (DecoderException e) { throw new IllegalArgumentException("Unable to convert md5string", e); } } private  MD5Digest(String md5String, byte[] md5bytes); String asString(); byte[] asBytes(); static MD5Digest fromString(String md5String); static MD5Digest fromBytes(byte[] md5Bytes); static MD5Digest fromBytes(byte[] md5Bytes, int offset); @Override int hashCode(); @Override boolean equals(Object obj); static final int MD5_BYTES_LENGTH; }