@Test public void testGeneratesSameIdenticonForSameHash() { byte[] hash = Hashing.sha256().hashString("test", UTF_8).asBytes(); BufferedImage image = identicon.generate(hash); BufferedImage image2 = identicon.generate(hash); assertThat(getImageBytes(image)).isEqualTo(getImageBytes(image2)); }
@Test public void testGeneratesIdenticon() { byte[] hash = Hashing.sha256().hashString("test", UTF_8).asBytes(); BufferedImage image = identicon.generate(hash); assertThat(image).isNotNull(); }
@Test(expected = IllegalArgumentException.class) public void testFailsWithToShortHash() { identicon.generate(new byte[] {1, 2}); }
@Test(expected = IllegalArgumentException.class) public void testFailsWithNullHash() { identicon.generate(null); }