Examples of MessageField


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

  //
  // message Person {
  //   optional Type type = 1;
  // }
  @Test public void should_return_label_for_field_with_unresolved_type() {
    MessageField field = xtext.find("type", MessageField.class);
    Object label = labels.labelFor(field);
    assertThat(label, instanceOf(StyledString.class));
    StyledString labelText = (StyledString) label;
    assertThat(labelText.getString(), equalTo("type [1] : <unresolved>"));
  }
View Full Code Here

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

  //    * (Optional.)
  //    */
  //   optional bool active = 1;
  // }
  @Test public void should_return_single_line_comment_of_element() {
    MessageField field = xtext.find("active", MessageField.class);
    String documentation = provider.getDocumentation(field);
    String[] lines = documentation.split(lineSeparator());
    assertThat(lines[0], equalTo("Indicates whether the person is active or not."));
    assertThat(lines[1], equalTo("(Optional.)"));
  }
View Full Code Here

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

  //
  // message Person {
  //   optional bool active = 1;
  // }
  @Test public void should_return_empty_String_if_element_does_not_have_single_line_comment() {
    MessageField field = xtext.find("active", MessageField.class);
    String documentation = provider.getDocumentation(field);
    assertThat(documentation, equalTo(""));
  }
View Full Code Here

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

  //   // Indicates whether the person is active or not.
  //   // (Optional.)
  //   optional bool active = 1;
  // }
  @Test public void should_return_single_line_comment_of_element() {
    MessageField field = xtext.find("active", MessageField.class);
    String documentation = provider.getDocumentation(field);
    assertThat(documentation, equalTo("Indicates whether the person is active or not. (Optional.)"));
  }
View Full Code Here

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

  //
  // message Person {
  //   optional bool active = 1;
  // }
  @Test public void should_return_empty_String_if_element_does_not_have_single_line_comment() {
    MessageField field = xtext.find("active", MessageField.class);
    String documentation = provider.getDocumentation(field);
    assertThat(documentation, equalTo(""));
  }
View Full Code Here

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

  //
  // message Person {
  //   required string name = 2;
  // }
  @Test public void should_return_one_for_first_and_only_field() {
    MessageField field = xtext.find("name", MessageField.class);
    long index = indexedElements.calculateNewIndexFor(field);
    assertThat(index, equalTo(3L));
  }
View Full Code Here

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

  // message Person {
  //   required string name = 6;
  //   required int32 id = 8;
  // }
  @Test public void should_return_max_index_value_plus_one_for_new_field() {
    MessageField field = xtext.find("id", MessageField.class);
    long index = indexedElements.calculateNewIndexFor(field);
    assertThat(index, equalTo(9L));
  }
View Full Code Here

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

  //
  // message Person {
  //   optional int32 id = 1;
  // }
  @Test public void should_return_scalar_if_field_type_is_scalar() {
    MessageField field = xtext.find("id", MessageField.class);
    ScalarType type = fields.scalarTypeOf(field);
    assertThat(type.getName(), equalTo("int32"));
  }
View Full Code Here

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

  //
  // message PhoneNumber {
  //   optional PhoneType type = 1;
  // }
  @Test public void should_return_null_if_field_type_is_not_scalar() {
    MessageField field = xtext.find("type", MessageField.class);
    assertNull(fields.scalarTypeOf(field));
  }
View Full Code Here

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

    assertThat(options.option("message_set_wire_format"), isBool());
    assertThat(options.option("no_standard_descriptor_accessor"), isBool());
  }

  @Test public void should_return_all_field_options() {
    MessageField optionContainer = mock(MessageField.class);
    options.mapByName(descriptor.availableOptionsFor(optionContainer));
    assertNotNull(options.option("ctype"));
    assertThat(options.option("packed"), isBool());
    assertThat(options.option("deprecated"), isBool());
    assertThat(options.option("experimental_map_key"), isString());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.