@Test
public void testParseWellFormedUnclosedEndAtCueEnd() throws Exception {

  Spanned text = parseCueText("An <u some trailing stuff>unclosed u tag with "
      + "<i>italic</i> inside");
  assertThat(text.toString()).isEqualTo("An unclosed u tag with italic inside");
  UnderlineSpan[] underlineSpans = getSpans(text, UnderlineSpan.class);
  StyleSpan[] styleSpans = getSpans(text, StyleSpan.class);
  assertThat(underlineSpans).hasLength(1);
  assertThat(styleSpans).hasLength(1);
  assertThat(styleSpans[0].getStyle()).isEqualTo(ITALIC);
  assertThat(text.getSpanStart(underlineSpans[0])).isEqualTo(3);
  assertThat(text.getSpanStart(styleSpans[0])).isEqualTo(23);
  assertThat(text.getSpanEnd(styleSpans[0])).isEqualTo(29);
  assertThat(text.getSpanEnd(underlineSpans[0])).isEqualTo(36);
}