Package com.google.eclipse.protobuf.protobuf

Examples of com.google.eclipse.protobuf.protobuf.MessageField


  //
  // message Person {
  //  optional String firstName = 6;
  // }
  @Test public void should_return_unchanged_name_if_element_is_Field() {
    MessageField field = xtext.find("firstName", MessageField.class);
    assertThat(options.nameForOption(field), equalTo("firstName"));
  }
View Full Code Here


  //
  // message Person {
  //  optional String firstName = 6;
  // }
  @Test public void should_set_index_of_MessageField() {
    MessageField field = xtext.find("firstName", MessageField.class);
    indexedElements.setIndexTo(field, 1L);
    assertThat(field.getIndex(), equalTo(1L));
  }
View Full Code Here

  //
  // message Person {
  //  optional bool active = 1 [default = false, deprecated = true];
  // }
  @Test public void should_return_options_of_MessageField() {
    MessageField field = xtext.find("active", MessageField.class);
    List<FieldOption> fieldOptions = indexedElements.fieldOptionsOf(field);
    assertThat(fieldOptions.size(), equalTo(2));
  }
View Full Code Here

  //
  // message Person {
  //   optional int32 id = 1;
  // }
  @Test public void should_return_package_if_proto_has_one() {
    MessageField field = xtext.find("id", MessageField.class);
    Package aPackage = modelObjects.packageOf(field);
    assertThat(aPackage.getName(), equalTo("person.test"));
  }
View Full Code Here

  //
  // message Person {
  //   optional int32 id = 1;
  // }
  @Test public void should_return_null_if_proto_does_not_have_package() {
    MessageField field = xtext.find("id", MessageField.class);
    assertNull(modelObjects.packageOf(field));
  }
View Full Code Here

  //
  // message Person {
  //   optional string name = 1;
  // }
  @Test public void should_return_true_if_field_is_string() {
    MessageField field = xtext.find("name", MessageField.class);
    assertTrue(fields.isString(field));
  }
View Full Code Here

  //
  // message Person {
  //   optional double code = 1;
  // }
  @Test public void should_return_false_if_field_is_not_string() {
    MessageField field = xtext.find("code", MessageField.class);
    assertFalse(fields.isString(field));
  }
View Full Code Here

  //
  // message Contact {
  //   optional Type type = 1;
  // }
  @Test public void should_provide_Types() {
    MessageField field = xtext.find("type", MessageField.class);
    IScope scope = scopeProvider.scope_ComplexTypeLink_target(typeOf(field), reference);
    assertThat(descriptionsIn(scope), containAll("Type", "proto.Type", "google.proto.Type", "com.google.proto.Type",
                                                 ".com.google.proto.Type",
                                                 "Address", "proto.Address", "google.proto.Address",
                                                 "com.google.proto.Address", ".com.google.proto.Address",
View Full Code Here

  //
  // message Contact {
  //   optional com.google.test.Type type = 1;
  // }
  @Test public void should_provide_imported_Types() {
    MessageField field = xtext.find("type", " =", MessageField.class);
    IScope scope = scopeProvider.scope_ComplexTypeLink_target(typeOf(field), reference);
    assertThat(descriptionsIn(scope), containAll("test.proto.Type", ".test.proto.Type",
                                                 "test.proto.Address", ".test.proto.Address",
                                                 "Contact", "proto.Contact", "google.proto.Contact",
                                                 "com.google.proto.Contact", ".com.google.proto.Contact"));
View Full Code Here

  //
  // message Contact {
  //   optional com.google.test.Type type = 1;
  // }
  @Test public void should_provide_imported_Types_with_equal_package() {
    MessageField field = xtext.find("type", " =", MessageField.class);
    IScope scope = scopeProvider.scope_ComplexTypeLink_target(typeOf(field), reference);
    assertThat(descriptionsIn(scope), containAll("Type", "proto.Type", "google.proto.Type", "com.google.proto.Type",
                                                 ".com.google.proto.Type",
                                                 "Address", "proto.Address", "google.proto.Address",
                                                 "com.google.proto.Address", ".com.google.proto.Address",
View Full Code Here

TOP

Related Classes of com.google.eclipse.protobuf.protobuf.MessageField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.