### Question:
PotentialEmphasisSpan extends SourceSpan { boolean isRightFlanking(Cursor cursor, int length) { char charBefore = charBefore(cursor); char charAfter = charAfter(cursor, length); return !isWhitespace(charBefore) && !(isPunctuation(charBefore) && !isWhitespace(charAfter) && !isPunctuation(charAfter)); }  @Override Optional<? extends Inline> createInline(Cursor cursor);  }### Answer:
@Test public void isRightFlanking() { assertRightFlanking(false, "**", 0, 2); assertRightFlanking(true, "a** ", 1, 2); assertRightFlanking(true, "a**a", 1, 2); assertRightFlanking(true, "a**.", 1, 2); assertRightFlanking(true, "a**", 1, 2); assertRightFlanking(false, "***abc", 0, 3); assertRightFlanking(false, " _abc", 2, 1); assertRightFlanking(false, "**\"abc\"", 0, 2); assertRightFlanking(false, " _\"abc\"", 1, 1); assertRightFlanking(true, "abc***", 3, 3); assertRightFlanking(true, " abc_", 5, 1); assertRightFlanking(true, "\"abc\"**", 5, 2); assertRightFlanking(true, "\"abc\"_", 5, 1); assertRightFlanking(true, "abc**def", 3, 2); assertRightFlanking(true, "\"abc\"_\"def\"", 5, 1); assertRightFlanking(false, "abc *** def", 4, 3); assertRightFlanking(false, "a _ b", 2, 1); }