SchemaGenerator { protected String buildField(Field field) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(this.buildIndex(field)); stringBuilder.append(field.getScope().toString().toLowerCase()); stringBuilder.append(" "); stringBuilder.append(field.getType()); stringBuilder.append(" "); stringBuilder.append(field.getName()); stringBuilder.append(" = "); stringBuilder.append(field.getIndex()); stringBuilder.append(";"); return stringBuilder.toString(); }  String generate(Schema schema);  }
@Test public void testBuildField() { { String generatedField = this.schemaGenerator.buildField(new Field(ProtobufScope.REQUIRED, "int32", "aField", 1)); String expected = "required int32 aField = 1;"; assertThat(generatedField).isEqualToIgnoringWhitespace(expected); } { String generatedField = this.schemaGenerator.buildField(new Field(ProtobufScope.OPTIONAL, "int32", "aField", 1)); String expected = "optional int32 aField = 1;"; assertThat(generatedField).isEqualToIgnoringWhitespace(expected); } { String generatedField = this.schemaGenerator.buildField(new Field(ProtobufScope.REPEATED, "int32", "aField", 1)); String expected = "repeated int32 aField = 1;"; assertThat(generatedField).isEqualToIgnoringWhitespace(expected); } }