Skip to content

Commit

Permalink
Adding some suggestions based in real fails and their tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rocboronat committed Dec 4, 2015
1 parent cd21edf commit d07955e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class EmailSuggester {

public static final String DOTCOM = ".com";
public static final String DOTNET = ".net";
public static final String DOTFR = ".fr";

public List<EmailCorrection> tldCorrections = Arrays.asList(
new EmailCorrection(".cpm", DOTCOM),
Expand All @@ -26,7 +27,8 @@ public class EmailSuggester {
new EmailCorrection(".cxom", DOTCOM),
new EmailCorrection(".coml", DOTCOM),
new EmailCorrection(".ney", DOTNET),
new EmailCorrection(".nte", DOTNET)
new EmailCorrection(".nte", DOTNET),
new EmailCorrection(".ft", DOTFR)
);

public List<EmailCorrection> domainCorrections = Arrays.asList(
Expand All @@ -39,6 +41,7 @@ public class EmailSuggester {
new EmailCorrection("ygmail", GMAIL),
new EmailCorrection("gmai", GMAIL),
new EmailCorrection("gimail", GMAIL),
new EmailCorrection("gmaik", GMAIL),

new EmailCorrection("hotmaail", HOTMAIL),
new EmailCorrection("hotmal", HOTMAIL),
Expand All @@ -48,12 +51,16 @@ public class EmailSuggester {
new EmailCorrection("hotmial", HOTMAIL),
new EmailCorrection("hotmale", HOTMAIL),
new EmailCorrection("homtail", HOTMAIL),
new EmailCorrection("hotnail", HOTMAIL),
new EmailCorrection("hormail", HOTMAIL),

new EmailCorrection("yaho", YAHOO),
new EmailCorrection("yaoo", YAHOO),
new EmailCorrection("yaboo", YAHOO),
new EmailCorrection("yahou", YAHOO),

new EmailCorrection("outllok", OUTLOOK)
new EmailCorrection("outllok", OUTLOOK),
new EmailCorrection("outilook", OUTLOOK)
);

public List<EmailCorrection> domainAndTldCorrections = Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,39 @@ public void shouldFixZcomIssue() throws InvalidEmailException {
public void shouldFixNteIssue() throws InvalidEmailException {
assertEquals("[email protected]", es.getSuggestedEmail("[email protected]"));
}

@Test
public void shouldFixOutilookDotCom() throws InvalidEmailException {
assertEquals("[email protected]", es.getSuggestedEmail("[email protected]"));
}

@Test
public void shouldFixGmailDotComu() throws InvalidEmailException {
assertEquals("[email protected]", es.getSuggestedEmail("[email protected]"));
}

@Test
public void shouldFixHotnailDotCom() throws InvalidEmailException {
assertEquals("[email protected]", es.getSuggestedEmail("[email protected]"));
}

@Test
public void shouldFixHormailDotCom() throws InvalidEmailException {
assertEquals("[email protected]", es.getSuggestedEmail("[email protected]"));
}

@Test
public void shouldReplaceFtToFr() throws InvalidEmailException {
assertEquals("[email protected]", es.getSuggestedEmail("[email protected]"));
}

@Test
public void shouldFixGmaikDotCom() throws InvalidEmailException {
assertEquals("[email protected]", es.getSuggestedEmail("[email protected]"));
}

@Test
public void shouldFixYahou() throws InvalidEmailException {
assertEquals("[email protected]", es.getSuggestedEmail("[email protected]"));
}
}

0 comments on commit d07955e

Please sign in to comment.