### Question:
Schema { private Schema(Builder builder) { this.fieldNames = builder.fields.stream().map(Field::name).collect(toList()); this.fields = ImmutableList.copyOf(builder.fields); this.optionalFields = ImmutableSet.copyOf(builder.optionalFields); this.constraints = ImmutableList.copyOf(builder.constraints); this.ignore = builder.pass; this.name = builder.name.length() > 0 ? builder.name : String.join(", ", this.fieldNames); } private  Schema(Builder builder); Set<String> optionalFields(); List<String> fieldNames(); List<Field> fields(); List<Constraint> constraints(); String name(); boolean ignore(); Builder newBuilder();  }### Answer:
@Test public void list_checksThatSubobjectUnionDiscriminatorAttributeExists() throws Exception { Exception e = assertThrows(InvalidSchemaException.class, () -> schema(field("name", string()), field("config", union("type")) )); assertEquals("Discriminator attribute 'type' not present.", e.getMessage()); }
@Test public void checksThatSubobjectUnionDiscriminatorAttributeIsString() throws Exception { Exception e = assertThrows(InvalidSchemaException.class, () -> schema(field("name", string()), field("type", integer()), field("config", union("type")) )); assertThat(e.getMessage(), matchesPattern("Discriminator attribute 'type' must be a string \\(but it is not\\)")); }