use of com.squareup.wire.schema.Reserved in project schema2proto by entur.
the class SerializationTest method testBuildProtoFile.
@Test
public void testBuildProtoFile() {
ProtoFile f = new ProtoFile(Syntax.PROTO_3, "default");
List<EnumConstant> values = new ArrayList<EnumConstant>();
List<OptionElement> elements = new ArrayList<>();
List<Reserved> reserveds = new ArrayList<>();
Options constantOptions = new Options(ProtoType.BOOL, elements);
Location valueLocation = new Location("base", "file", 1, 2);
values.add(new EnumConstant(valueLocation, "VAL1", 1, "doc", constantOptions));
Options options = new Options(ProtoType.BOOL, new ArrayList<>());
f.types().add(new EnumType(ProtoType.INT32, valueLocation, "doc", "Name", values, reserveds, options));
Location messagLocation = new Location("base", "path", 1, 1);
ImmutableList<Field> declaredFields = ImmutableList.copyOf(new ArrayList<>());
List<Field> extensionFields = new ArrayList<>();
ImmutableList<OneOf> oneOfs = ImmutableList.copyOf(new ArrayList<>());
ImmutableList<Type> nestedTypes = ImmutableList.copyOf(new ArrayList<>());
List<Extensions> extensionsList = new ArrayList<>();
List<OptionElement> messageOptionElements = new ArrayList<>();
Options messageOptions = new Options(ProtoType.BOOL, messageOptionElements);
MessageType message = new MessageType(ProtoType.BOOL, messagLocation, "doc", "messagename", declaredFields, extensionFields, oneOfs, nestedTypes, extensionsList, reserveds, messageOptions);
f.types().add(message);
String schema = f.toSchema();
assertNotNull(schema);
}
Aggregations