Mutator { public static Schema superSetOf(Schema schema, Field... newFields) { return superSetOf("superSetSchema" + (COUNTER++), schema, newFields); }  static Schema minusFields(Schema schema, String... minusFields); static Schema minusFields(String newName, Schema schema, String... minusFields); static Schema subSetOf(Schema schema, String... subSetFields); static Schema subSetOf(String newName, Schema schema, String... subSetFields); static Schema superSetOf(Schema schema, Field... newFields); static Schema superSetOf(String newName, Schema schema, Field... newFields); static Schema jointSchema(Schema leftSchema, Schema rightSchema); static Schema jointSchema(String newName, Schema leftSchema, Schema rightSchema); static int COUNTER; }
@Test public void testSuperSet() { Schema schema = new Schema("a_schema", Fields.parse("a:int, b:int, c:double, e:string")); Schema mutated = Mutator.superSetOf("mutated", schema, Field.create("f", Type.BOOLEAN), Field.create("h", Type.LONG)); assertEquals(new Schema("mutated", Fields.parse("a:int, b:int, c:double, e:string, f:boolean, h:long")), mutated); }