Language { public boolean isCompatible(Language other) { if (other == null) { return false; } if ("*".equals(primaryTag)) { return true; } return primaryTag.equals(other.primaryTag) && (subTag.isEmpty() || subTag.equals(other.subTag)); } Language(Locale locale); String getPrimaryTag(); String getSubTag(); Locale getLocale(); boolean isCompatible(Language other); @Override final String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@UseDataProvider("forTestIsCompatible") @Test public void testIsCompatible(Language language, Language checkLanguage, boolean expectedResult) { assertEquals(expectedResult, language.isCompatible(checkLanguage)); }