@Test public void areEqualWithRemovedSymbols() throws Exception { assertTrue(comparator.areEqual( new Movie("The boy, who lived", 2010), new Movie("The boy who lived", 2010) )); assertTrue(comparator.areEqual( new Movie("Independence Day: Resurgence", 2016), new Movie("Independence Day Resurgence", 2016) )); assertTrue(comparator.areEqual( new Movie("Lock Out", 2012), new Movie("Lockout", 2012) )); assertTrue(comparator.areEqual( new Movie("The Incredibles 3-D", 2004), new Movie("The Incredibles", 2004) )); }
@Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; }
SmartTitleComparator extends AbstractMovieComparator { @Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; } }
SmartTitleComparator extends AbstractMovieComparator { @Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; }  }
SmartTitleComparator extends AbstractMovieComparator { @Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; }  @Override boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2); }
SmartTitleComparator extends AbstractMovieComparator { @Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; }  @Override boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2);  }