### Question:
HtmlLanguageBuilder { public HtmlLanguageBuilder name(String name) { requireNonNull(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); HtmlLanguageBuilder setSupportsImages(boolean supportsImages); HtmlLanguage create();  }### Answer:
@Test public void nameNull() { NullPointerException npe = assertThrows(NullPointerException.class, () -> builder.name(null)); assertTrue(npe.getMessage().contains("Must provide a name")); }
@Test public void nameEmpty() { IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> builder.name("")); assertTrue(iae.getMessage().contains("Name must not be empty")); }
@Test public void nameLeadingWhitespace() { IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> builder.name(" Name")); assertTrue(iae.getMessage().contains("Name must not have leading or trailing whitespace")); }
@Test public void nameBlacklisted() { IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> builder.name(HtmlLanguage.NAME_HTML)); assertTrue(iae.getMessage().contains("Name must not be equal to " + HtmlLanguage.NAME_HTML)); }
@Test public void nameBlacklisted2() { IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> builder.name(HtmlLanguage.NAME_HTML.toLowerCase())); assertTrue(iae.getMessage().contains("Name must not be equal to " + HtmlLanguage.NAME_HTML)); }
@Test public void nameBlacklisted3() { IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> builder.name(HtmlLanguage.NAME_HTML.toUpperCase())); assertTrue(iae.getMessage().contains("Name must not be equal to " + HtmlLanguage.NAME_HTML)); }
@Test public void name() { assertNotNull(builder.name("Test")); assertSame(builder, builder.name("Test")); }