@Test public void getAvatarWithGravatar() { CurrentCoffeeNetUser currentCoffeeNetUser = new CurrentCoffeeNetUser("username", "username@coffeenet"); assertThat(currentCoffeeNetUser.getAvatar(), is("https: }
public String getAvatar() { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); final byte[] emailAsBytes = email.getBytes(UTF_8); final String md5HashOfEmail = Hex.encodeHexString(md5.digest(emailAsBytes)); return format("https: } catch (NoSuchAlgorithmException e) { LOGGER.debug("/> Fallback to default avatar", e); } return "/img/default_avatar.jpg"; }
CurrentCoffeeNetUser { public String getAvatar() { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); final byte[] emailAsBytes = email.getBytes(UTF_8); final String md5HashOfEmail = Hex.encodeHexString(md5.digest(emailAsBytes)); return format("https: } catch (NoSuchAlgorithmException e) { LOGGER.debug("/> Fallback to default avatar", e); } return "/img/default_avatar.jpg"; } }
CurrentCoffeeNetUser { public String getAvatar() { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); final byte[] emailAsBytes = email.getBytes(UTF_8); final String md5HashOfEmail = Hex.encodeHexString(md5.digest(emailAsBytes)); return format("https: } catch (NoSuchAlgorithmException e) { LOGGER.debug("/> Fallback to default avatar", e); } return "/img/default_avatar.jpg"; } CurrentCoffeeNetUser(String username, String email); }
CurrentCoffeeNetUser { public String getAvatar() { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); final byte[] emailAsBytes = email.getBytes(UTF_8); final String md5HashOfEmail = Hex.encodeHexString(md5.digest(emailAsBytes)); return format("https: } catch (NoSuchAlgorithmException e) { LOGGER.debug("/> Fallback to default avatar", e); } return "/img/default_avatar.jpg"; } CurrentCoffeeNetUser(String username, String email); String getUsername(); String getEmail(); String getAvatar(); }
CurrentCoffeeNetUser { public String getAvatar() { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); final byte[] emailAsBytes = email.getBytes(UTF_8); final String md5HashOfEmail = Hex.encodeHexString(md5.digest(emailAsBytes)); return format("https: } catch (NoSuchAlgorithmException e) { LOGGER.debug("/> Fallback to default avatar", e); } return "/img/default_avatar.jpg"; } CurrentCoffeeNetUser(String username, String email); String getUsername(); String getEmail(); String getAvatar();  }