### Question:
EmailAnalyzer { public PersonProfile getProfile(String emailAddress) { PersonProfile personProfile = new PersonProfile(); emailAddress = emailAddress.trim().toLowerCase(); personProfile.setEmail(emailAddress); String md5 = DigestUtils.md5Hex(emailAddress).toLowerCase(); String profileUrl = "https: JsonObject gravatarResponse = null; try { gravatarResponse = new DocumentRetriever().getJsonObject(profileUrl); } catch (Exception e) { } if (gravatarResponse != null) { JsonObject firstEntry = gravatarResponse.tryQueryJsonObject("entry[0]"); personProfile.setUsername(firstEntry.tryQueryString("preferredUsername")); String firstName = firstEntry.tryQueryString("name/givenName"); if (firstName != null) { personProfile.setFirstName(firstName); } String lastName = firstEntry.tryQueryString("name/familyName"); if (lastName != null) { personProfile.setLastName(lastName); } String formattedName = firstEntry.tryQueryString("name/formatted"); if (formattedName != null) { personProfile.setFullName(formattedName); } String thumbnailUrl = firstEntry.tryQueryString("thumbnailUrl"); personProfile.setImageUrl(thumbnailUrl); } else { try { HttpRetriever quickHttpRetriever = HttpRetrieverFactory.getHttpRetriever(); quickHttpRetriever.setConnectionTimeout(500); quickHttpRetriever.setSocketTimeout(500); quickHttpRetriever.setConnectionTimeoutRedirects(500); quickHttpRetriever.setSocketTimeoutRedirects(500); DocumentRetriever quickRetriever = new DocumentRetriever(quickHttpRetriever); JsonObject parsedEmailJson = quickRetriever .getJsonObject("http: + UrlHelper.encodeParameter(emailAddress)); JsonArray nameMatches = Optional.ofNullable(parsedEmailJson.tryGetJsonArray("nameMatches")).orElse(new JsonArray()); if (!nameMatches.isEmpty()) { String firstName = nameMatches.tryGetJsonObject(0).tryQueryString("givenNames[0]/name"); String firstNameType = nameMatches.tryGetJsonObject(0).tryQueryString("givenNames[0]/nameType"); if (firstNameType != null && firstNameType.equals("INITIAL")) { firstName = null; } String lastName = nameMatches.tryGetJsonObject(0).tryQueryString("surnames[0]/name"); personProfile.setFirstName(firstName); personProfile.setLastName(lastName); } } catch (Exception e) { e.printStackTrace(); } } return personProfile; }  PersonProfile getProfile(String emailAddress); static EmailVerificationResult verify(String email, String apiKey); static void main(String[] args);  }### Answer:
@Test public void getProfile() { PersonProfile profile = new EmailAnalyzer().getProfile("DAVID.urbansky@semknox.com"); collector.checkThat(profile.getFirstName(), is("David")); collector.checkThat(profile.getLastName(), is("Urbansky")); collector.checkThat(profile.getEmail(), is("david.urbansky@semknox.com")); collector.checkThat(profile.getUsername(), is("ddsky")); collector.checkThat(profile.getImageUrl(), is("https: profile = new EmailAnalyzer().getProfile("david.urbansky@anotherwebsite.com"); collector.checkThat(profile.getFirstName(), is("David")); collector.checkThat(profile.getLastName(), is("Urbansky")); }