AbstractGeneratedTypeBuilder extends AbstractBaseType implements GeneratedTypeBuilderBase<T> { @Override public Constant addConstant(final Type type, final String name, final Object value) { checkArgument(type != null, "Returning Type for Constant cannot be null!"); checkArgument(name != null, "Name of constant cannot be null!"); checkArgument(!containsConstant(name), "This generated type already contains a \"%s\" constant", name); final Constant constant = new ConstantImpl(this, type, name, value); this.constants = LazyCollections.lazyAdd(this.constants, constant); return constant; } protected  AbstractGeneratedTypeBuilder(final JavaTypeName identifier); @Override boolean isAbstract(); @Override List<Type> getImplementsTypes(); @Override List<MethodSignatureBuilder> getMethodDefinitions(); @Override GeneratedTOBuilder addEnclosingTransferObject(final String name); @Override T addEnclosingTransferObject(final GeneratedTOBuilder genTOBuilder); @Override T addComment(final TypeComment newComment); @Override AnnotationTypeBuilder addAnnotation(final JavaTypeName identifier); @Override T setAbstract(final boolean newIsAbstract); @Override T addImplementsType(final Type genType); @Override Constant addConstant(final Type type, final String name, final Object value); boolean containsConstant(final String name); @Override EnumBuilder addEnumeration(final String name); @Override MethodSignatureBuilder addMethod(final String name); @Override boolean containsMethod(final String name); @Override GeneratedPropertyBuilder addProperty(final String name); @Override boolean containsProperty(final String name); Type getParent(); @Override List<GeneratedPropertyBuilder> getProperties(); @Override Optional<YangSourceDefinition> getYangSourceDefinition(); @Override void setYangSourceDefinition(final YangSourceDefinition definition);  }
@Test(expected = IllegalArgumentException.class) public void addConstantIllegalArgumentTest() { CodegenGeneratedTypeBuilder generatedTypeBuilder = new CodegenGeneratedTypeBuilder( JavaTypeName.create("my.package", "MyName")); generatedTypeBuilder.addConstant(Types.STRING, "myName", "Value"); generatedTypeBuilder.addConstant(Types.BOOLEAN, "myName", true); }