BlobId { public static BlobId fromBytes(byte[] bytes) { Preconditions.checkNotNull(bytes); return new BlobId(Hashing.sha256().hashBytes(bytes).toString()); } private  BlobId(String id); static BlobId fromBytes(byte[] bytes); static BlobId fromString(String raw); String asString(); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString();  }
@Test void fromBytesShouldCalculateSameSha256() { byte[] bytes = "abc".getBytes(StandardCharsets.UTF_8); assertThat(BlobId.fromBytes(bytes)) .isEqualTo(BlobId.fromBytes(bytes)); }