### Question:
ReadOnlyStyledDocumentBuilder { public ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraphs(List<List<SEG>> listOfSegLists, StyleSpans<S> entireDocumentStyleSpans) { return addParagraphList(listOfSegLists, entireDocumentStyleSpans, ignore -> null, Function.identity()); } ReadOnlyStyledDocumentBuilder(SegmentOps<SEG, S> segmentOps, PS defaultParagraphStyle);  ReadOnlyStyledDocumentBuilder(SegmentOps<SEG, S> segmentOps, PS defaultParagraphStyle, int initialCapacity); private  ReadOnlyStyledDocumentBuilder(SegmentOps<SEG, S> segmentOps, PS defaultParagraphStyle, List<Paragraph<PS, SEG, S>> list); static ReadOnlyStyledDocument<PS, SEG, S> constructDocument(
            SegmentOps<SEG, S> segmentOps, PS defaultParagraphStyle,
            Consumer<ReadOnlyStyledDocumentBuilder<PS, SEG, S>> configuration); static ReadOnlyStyledDocument<PS, SEG, S> constructDocument(
            SegmentOps<SEG, S> segmentOps, PS defaultParagraphStyle,
            int initialCapacity, Consumer<ReadOnlyStyledDocumentBuilder<PS, SEG, S>> configuration); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(List<StyledSegment<SEG, S>> styledSegments); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(List<StyledSegment<SEG, S>> styledSegments, PS paragraphStyle); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(SEG segment, S style); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(SEG segment, S style, PS paragraphStyle); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(SEG segment, StyleSpans<S> styles); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(SEG segment, StyleSpans<S> styles, PS paragraphStyle); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(List<SEG> segments, StyleSpans<S> styles); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(List<SEG> segments, StyleSpans<S> styles, PS paragraphStyle); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraphs(List<List<SEG>> listOfSegLists,
                                 StyleSpans<S> entireDocumentStyleSpans); ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraphs0(List<Tuple2<PS, List<SEG>>> paragraphArgList,
                                 StyleSpans<S> entireDocumentStyleSpans); ReadOnlyStyledDocument<PS, SEG, S> build();  }### Answer:
@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) { } }