StructTypeInfoBuilder { public StructTypeInfoBuilder add(String name, TypeInfo typeInfo) { if (name == null || name.trim().length() == 0) { throw new IllegalArgumentException("name must not be null or empty"); } for (String existingName : names) { if (existingName.equalsIgnoreCase(name)) { throw new IllegalArgumentException("duplicate name: " + name); } } if (typeInfo == null) { throw new IllegalArgumentException("typeInfo must not be null"); } names.add(name); typeInfos.add(typeInfo); return this; }  StructTypeInfoBuilder add(String name, TypeInfo typeInfo); StructTypeInfo build();  }
@Test(expected = IllegalArgumentException.class) public void tabName() { new StructTypeInfoBuilder().add("\t", TypeInfoFactory.stringTypeInfo); }
@Test(expected = IllegalArgumentException.class) public void nullTypeInfo() { new StructTypeInfoBuilder().add("col0", null); }
@Test(expected = IllegalArgumentException.class) public void duplicateName() { new StructTypeInfoBuilder().add("col0", TypeInfoFactory.stringTypeInfo).add("col0", TypeInfoFactory.stringTypeInfo); }
@Test(expected = IllegalArgumentException.class) public void nullName() { new StructTypeInfoBuilder().add(null, TypeInfoFactory.stringTypeInfo); }
@Test(expected = IllegalArgumentException.class) public void emptyName() { new StructTypeInfoBuilder().add("", TypeInfoFactory.stringTypeInfo); }
@Test(expected = IllegalArgumentException.class) public void whitespaceName() { new StructTypeInfoBuilder().add(" ", TypeInfoFactory.stringTypeInfo); }