AbstractGeneratedTypeBuilder extends AbstractBaseType implements GeneratedTypeBuilderBase<T> { @Override public EnumBuilder addEnumeration(final String name) { checkArgument(name != null, "Name of enumeration cannot be null!"); final EnumBuilder builder = newEnumerationBuilder(getIdentifier().createEnclosed(name, "$")); checkArgument(!enumDefinitions.contains(builder), "Generated type %s already contains an enumeration for %s", this, builder); this.enumDefinitions = LazyCollections.lazyAdd(this.enumDefinitions, builder); return builder; } 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 addEnumerationIllegalArgumentTest() { CodegenGeneratedTypeBuilder generatedTypeBuilder = new CodegenGeneratedTypeBuilder( JavaTypeName.create("my.package", "MyName")); generatedTypeBuilder.addEnumeration("myName"); generatedTypeBuilder.addEnumeration("myName"); }