private void assertCharSequence(final CharSequence cs, final String expectedString) {
        final String annotated = TextUtils.annotateSpans(cs, s -> {
            if (s instanceof ForegroundColorSpan && ((ForegroundColorSpan) s).getForegroundColor() == Color.RED) {
                return new Pair<>("[", "]");
            }
            return new Pair<>("", "");
        });

        assertThat(annotated).isEqualTo(expectedString);
    }
checks whether a given error string is correct and has the right places highlighted with an error format
main/src/test/java/cgeo/geocaching/utils/formulas/FormulaTest.java