FieldDefBuilder implements FieldDef { @Override public FieldDef template(final String template) { Preconditions.checkNotNull(template); return new FieldDefBuilder( this.dataType, this.name, Optional.<TemplateValue>of(new StringTemplateValue(template)) ); } private  FieldDefBuilder(
            final DataType dataType,
            final Optional<String> name,
            final Optional<TemplateValue> template); @Override Optional<String> getName(); @Override DataType getDataType(); @Override Optional<TemplateValue> getTemplate(); @Override FieldDef name(final String name); @Override FieldDef template(final String template); @Override FieldDef template(final TemplateValue templateValue); @Override String toString(); static FieldDef fd(final DataType dataType); @Override FieldType resolve(final TableType tableType);  }
@Test(expected = NullPointerException.class) public void templateWithNull_should_fail() { final FieldDef fd = someFd().template((String) null); assertThat(fd, Matchers.is(nullValue())); }
@Test(expected = NullPointerException.class) public void withTemplateValueWithNull_should_fail() { final FieldDef fd = someFd().template((TemplateValue) null); assertThat(fd, Matchers.is(nullValue())); }