### Question:
HtmlEntitySpan extends SourceSpan { @Override public Optional<? extends Inline> createInline(Cursor cursor) { char c = cursor.getChar(); if (c == '&') { Matcher matcher = cursor.matcher(pattern); if (matcher.matches()) { String ent = matcher.group(1); int offset = cursor.getOffset(); int length = ent.length() + 2; Line lineAtOffset = cursor.getLineAtOffset(); if (isInvalidUnicodeCodepoint(ent)) { return Optional.of(new Characters(lineAtOffset, offset, length, "\ufffd")); } return Optional.of(new HtmlEntity(lineAtOffset, offset, length, ent)); } } return Optional.empty(); }  @Override Optional<? extends Inline> createInline(Cursor cursor);  }### Answer:
@Test public void createInline() { assertNoInline(createCursor("one")); assertNoInline(createCursor("&copy")); assertEntity(6, "copy", "&copy; ayyy"); assertEntity(5, "xa0", "&xa0; ayyy;"); assertEntity(6, "#160", "&#160;"); assertEntity(6, "nbsp", "&nbsp;"); assertEntity(6, "nbsp", "&nbsp; ab\ncd"); assertEntity(5, "#x9", "&#x9;"); assertEntity(5, "#X9", "&#X9;"); assertEntity(7, "#x912", "&#x912;"); assertCharacters(4, "\ufffd", "&#0;"); assertCharacters(5, "\ufffd", "&#00;"); assertCharacters(8, "\ufffd", "&#65536;"); assertCharacters(5, "\ufffd", "&#x0;"); assertCharacters(9, "\ufffd", "&#xfffff;"); }