TranslationTable { @VisibleForTesting @SuppressFBWarnings(value = "OCP_OVERLY_CONCRETE_PARAMETER", justification = "glyph order is semantically important") public final List<GlyphPair> scriptTwoToScriptOneList(List<GlyphPair> homoglyphPairs) { return homoglyphPairs.stream() .map(GlyphPair::swap) .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 testSortOrderScriptTwoToScriptOne() { List<GlyphPair> actual = translationTable.scriptTwoToScriptOneList(testHomoglyphPairs); List<GlyphPair> expected = unmodifiableList(asList( new GlyphPair("cd", "ab"), new GlyphPair("fg", "e"), new GlyphPair("j", "hi"), new GlyphPair("l", "k") )); assertEquals(expected.toString(), actual.toString()); }