TranslationTable { @VisibleForTesting @SuppressFBWarnings(value = "OCP_OVERLY_CONCRETE_PARAMETER", justification = "glyph order is semantically important") public final List<GlyphPair> scriptOneToScriptTwoList(List<GlyphPair> homoglyphPairs) { return homoglyphPairs.stream() .sorted(sortByLength.reversed().thenComparing(sortByNaturalOrder)) .collect(toList()); } TranslationTable(Pattern script1Reg, Pattern script2Reg, List<GlyphPair> homoglyphPairs); @VisibleForTesting @SuppressFBWarnings(value = "OCP_OVERLY_CONCRETE_PARAMETER", justification = "glyph order is semantically important") final List<GlyphPair> scriptOneToScriptTwoList(List<GlyphPair> homoglyphPairs); @VisibleForTesting @SuppressFBWarnings(value = "OCP_OVERLY_CONCRETE_PARAMETER", justification = "glyph order is semantically important") final List<GlyphPair> scriptTwoToScriptOneList(List<GlyphPair> homoglyphPairs); void replaceScriptOne(StringBuilder scriptOne); void replaceScriptTwo(StringBuilder scriptTwo); Pattern getScript1Reg(); Pattern getScript2Reg();  }
@Test public void testSortOrderScriptOneToScriptTwo() { List<GlyphPair> actual = translationTable.scriptOneToScriptTwoList(testHomoglyphPairs); List<GlyphPair> expected = asList( new GlyphPair("ab", "cd"), new GlyphPair("hi", "j"), new GlyphPair("e", "fg"), new GlyphPair("k", "l") ); assertEquals(expected.toString(), actual.toString()); }