Beispiel #1
0
  @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));
  }
Beispiel #2
0
  @Test
  public void testGeneratesIdenticon() {
    byte[] hash = Hashing.sha256().hashString("test", UTF_8).asBytes();

    BufferedImage image = identicon.generate(hash);

    assertThat(image).isNotNull();
  }
Beispiel #3
0
 @Test(expected = IllegalArgumentException.class)
 public void testFailsWithToShortHash() {
   identicon.generate(new byte[] {1, 2});
 }
Beispiel #4
0
 @Test(expected = IllegalArgumentException.class)
 public void testFailsWithNullHash() {
   identicon.generate(null);
 }