    @Test
    public void creating_paragraph_with_different_segment_and_style_length_throws_exception() {

        String text = "a";
        int textStyle = 1;

        List<List<String>> singletonList = Collections.singletonList(
                Collections.singletonList(text)
        );
        int segmentLength = text.length();
        int spanLength = segmentLength + 10;
        StyleSpans<Integer> spans = StyleSpans.singleton(textStyle, spanLength);

        ReadOnlyStyledDocumentBuilder<Integer, String, Integer> builder = new ReadOnlyStyledDocumentBuilder<>(
                SegmentOps.styledTextOps(), 0
        );

        assertTrue(segmentLength != spanLength);

        try {
            builder.addParagraphs(singletonList, spans);
            fail("Style spans length must equal the length of all segments");
        } catch (IllegalArgumentException e) {
            // style spans' length is more than the length of all segments
        }
    }