@Test public void addHeadingsUpperBounds() { builder.addHeadings(6); IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> builder.addHeadings(7)); assertTrue(iae.getMessage().contains("Heading level must be between 1 and 6")); }
public HtmlLanguageBuilder addHeadings(int level) { checkArgument(level > 0 && level <= 6, "Heading level must be between 1 and 6"); headingLevel = level; return this; }
HtmlLanguageBuilder { public HtmlLanguageBuilder addHeadings(int level) { checkArgument(level > 0 && level <= 6, "Heading level must be between 1 and 6"); headingLevel = level; return this; } }
HtmlLanguageBuilder { public HtmlLanguageBuilder addHeadings(int level) { checkArgument(level > 0 && level <= 6, "Heading level must be between 1 and 6"); headingLevel = level; return this; } HtmlLanguageBuilder(); }
HtmlLanguageBuilder { public HtmlLanguageBuilder addHeadings(int level) { checkArgument(level > 0 && level <= 6, "Heading level must be between 1 and 6"); headingLevel = level; return this; } HtmlLanguageBuilder(); HtmlLanguageBuilder name(String name); HtmlLanguageBuilder add(BlockType blockType); HtmlLanguageBuilder add(SpanType spanType); HtmlLanguageBuilder addSubstitution(SpanType spanType, String alternativeTagName); HtmlLanguageBuilder addHeadings(int level); HtmlLanguageBuilder addSpanFont(); HtmlLanguageBuilder setXhtmlStrict(boolean xhtmlStrict); HtmlLanguageBuilder document(String prefix, String suffix); HtmlLanguageBuilder setSupportsImages(boolean supportsImages); HtmlLanguage create(); }
HtmlLanguageBuilder { public HtmlLanguageBuilder addHeadings(int level) { checkArgument(level > 0 && level <= 6, "Heading level must be between 1 and 6"); headingLevel = level; return this; } HtmlLanguageBuilder(); HtmlLanguageBuilder name(String name); HtmlLanguageBuilder add(BlockType blockType); HtmlLanguageBuilder add(SpanType spanType); HtmlLanguageBuilder addSubstitution(SpanType spanType, String alternativeTagName); HtmlLanguageBuilder addHeadings(int level); HtmlLanguageBuilder addSpanFont(); HtmlLanguageBuilder setXhtmlStrict(boolean xhtmlStrict); HtmlLanguageBuilder document(String prefix, String suffix); HtmlLanguageBuilder setSupportsImages(boolean supportsImages); HtmlLanguage create();  }