### Question:
DerivedSchemaContainer { public String getSchema() { StringBuilder total = new StringBuilder(); addRootType(total); addRootTypeMutations(total); for (DerivedTypeSchemaGenerator derivedObjectTypeSchemaGenerator : types.values()) { total.append(derivedObjectTypeSchemaGenerator.getSchema()); } for (DerivedTypeSchemaGenerator derivedObjectTypeSchemaGenerator : topLevelTypes.values()) { total.append(derivedObjectTypeSchemaGenerator.getSchema()); } return total.toString(); } DerivedSchemaContainer(String rootType, GraphQlNameGenerator graphQlNameGenerator,
                         PaginationArgumentsHelper argumentsHelper,
                         ReadOnlyChecker readOnlyChecker, CustomProvenance customProvenance); String getSchema(); boolean hasMutationTypes();  }### Answer:
@Test public void addsCustomProvenanceCreationMethod() { DerivedSchemaContainer instance = createWithProvenance(new CustomProvenance(newArrayList())); String schema = instance.getSchema(); assertThat(schema, containsString( "type rootTypeMutations{\n" + " setCustomProvenance(customProvenance: CustomProvenanceInput!): Message!" + " @setCustomProvenanceMutation(dataSet: \"rootType\")\n" )); }
@Test public void addProvenanceSchemaForField() throws Exception { DerivedSchemaContainer instance = createWithProvenance(CustomProvenance.getCustomProvenance( ImmutableMap.of("fields", Lists.newArrayList( ImmutableMap.of( "uri", NAME_URI, "isList", false, "valueType", STRING ) )) )); String schema = instance.getSchema(); assertThat(schema, containsString( "input rootTypeProvenanceInput{\n" + " schema_name: xsd_stringPropertyInput!" )); }
@Test public void addProvenanceSchemaForListField() throws Exception { DerivedSchemaContainer instance = createWithProvenance(CustomProvenance.getCustomProvenance( ImmutableMap.of("fields", Lists.newArrayList( ImmutableMap.of( "uri", NAME_URI, "isList", true, "valueType", STRING ) )) )); String schema = instance.getSchema(); assertThat(schema, containsString( "input rootTypeProvenanceInput{\n" + " schema_name: [xsd_stringPropertyInput!]!" )); }
@Test public void addProvenanceSchemaForObjectField() throws Exception { DerivedSchemaContainer instance = createWithProvenance(CustomProvenance.getCustomProvenance( ImmutableMap.of("fields", Lists.newArrayList( ImmutableMap.of( "uri", NAME_URI, "isList", false, "object", ImmutableMap.of( "type", PERSON_TYPE_URI, "fields", Lists.newArrayList( ImmutableMap.of( "uri", FIRST_NAME_URI, "isList", false, "valueType", STRING ) ) ) ) )) )); String schema = instance.getSchema(); assertThat(schema, containsString( "input rootTypeProvenanceInput{\n" + " schema_name: rootType_value_schema_Person!\n" + "}\n\n" + "input rootType_value_schema_Person{\n" + " uri: String\n" + " schema_name_first: xsd_stringPropertyInput!\n" + "}" )); }
@Test public void addProvenanceSchemaForListObjectField() throws Exception { DerivedSchemaContainer instance = createWithProvenance(CustomProvenance.getCustomProvenance( ImmutableMap.of("fields", Lists.newArrayList( ImmutableMap.of( "uri", NAME_URI, "isList", true, "object", ImmutableMap.of( "type", PERSON_TYPE_URI, "fields", Lists.newArrayList( ImmutableMap.of( "uri", FIRST_NAME_URI, "isList", false, "valueType", STRING ) ) ) ) )) )); String schema = instance.getSchema(); assertThat(schema, containsString( "input rootTypeProvenanceInput{\n" + " schema_name: [rootType_value_schema_Person!]!\n" + "}\n\n" + "input rootType_value_schema_Person{\n" + " uri: String\n" + " schema_name_first: xsd_stringPropertyInput!\n" + "}" )); }