@Test public void nameLeadingWhitespace() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Name must not have leading or trailing whitespace"); builder.name(" Name"); }
public HtmlLanguageBuilder name(String name) { checkNotNull(name, "Must provide a name"); checkArgument(!Strings.isNullOrEmpty(name), "Name must not be empty"); checkArgument(!name.equalsIgnoreCase(HtmlLanguage.NAME_HTML), "Name must not be equal to %s", HtmlLanguage.NAME_HTML); checkArgument(name.equals(name.trim()), "Name must not have leading or trailing whitespace"); this.name = name; return this; }
HtmlLanguageBuilder { public HtmlLanguageBuilder name(String name) { checkNotNull(name, "Must provide a name"); checkArgument(!Strings.isNullOrEmpty(name), "Name must not be empty"); checkArgument(!name.equalsIgnoreCase(HtmlLanguage.NAME_HTML), "Name must not be equal to %s", HtmlLanguage.NAME_HTML); checkArgument(name.equals(name.trim()), "Name must not have leading or trailing whitespace"); this.name = name; return this; } }
HtmlLanguageBuilder { public HtmlLanguageBuilder name(String name) { checkNotNull(name, "Must provide a name"); checkArgument(!Strings.isNullOrEmpty(name), "Name must not be empty"); checkArgument(!name.equalsIgnoreCase(HtmlLanguage.NAME_HTML), "Name must not be equal to %s", HtmlLanguage.NAME_HTML); checkArgument(name.equals(name.trim()), "Name must not have leading or trailing whitespace"); this.name = name; return this; } HtmlLanguageBuilder(); }
HtmlLanguageBuilder { public HtmlLanguageBuilder name(String name) { checkNotNull(name, "Must provide a name"); checkArgument(!Strings.isNullOrEmpty(name), "Name must not be empty"); checkArgument(!name.equalsIgnoreCase(HtmlLanguage.NAME_HTML), "Name must not be equal to %s", HtmlLanguage.NAME_HTML); checkArgument(name.equals(name.trim()), "Name must not have leading or trailing whitespace"); this.name = name; 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); HtmlLanguage create(); }
HtmlLanguageBuilder { public HtmlLanguageBuilder name(String name) { checkNotNull(name, "Must provide a name"); checkArgument(!Strings.isNullOrEmpty(name), "Name must not be empty"); checkArgument(!name.equalsIgnoreCase(HtmlLanguage.NAME_HTML), "Name must not be equal to %s", HtmlLanguage.NAME_HTML); checkArgument(name.equals(name.trim()), "Name must not have leading or trailing whitespace"); this.name = name; 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); HtmlLanguage create();  }