// Path: src/main/java/com/squareup/protoparser/OptionElement.java
// public enum Kind {
//   STRING,
//   BOOLEAN,
//   NUMBER,
//   ENUM,
//   MAP,
//   LIST,
//   OPTION
// }
// 
// Path: src/main/java/com/squareup/protoparser/ProtoFile.java
// static final int MAX_TAG_VALUE = (1 << 29) - 1; // 536,870,911
// 
// Path: src/main/java/com/squareup/protoparser/ProtoFile.java
// static final int MIN_TAG_VALUE = 1;
// 
// Path: src/main/java/com/squareup/protoparser/ProtoFile.java
// static boolean isValidTag(int value) {
//   return (value >= MIN_TAG_VALUE && value < RESERVED_TAG_VALUE_START)
//       || (value > RESERVED_TAG_VALUE_END && value <= MAX_TAG_VALUE);
// }


import com.squareup.protoparser.OptionElement.Kind;
import java.util.Arrays;
import java.util.Collections;
import org.junit.Test;
import static com.squareup.protoparser.ProtoFile.MAX_TAG_VALUE;
import static com.squareup.protoparser.ProtoFile.MIN_TAG_VALUE;
import static com.squareup.protoparser.ProtoFile.Syntax.PROTO_2;
import static com.squareup.protoparser.ProtoFile.isValidTag;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
        + "\n"
        + "service Service {}\n";
    assertThat(file.toSchema()).isEqualTo(expected);
  }

  @Test public void addMultipleServices() {
    ServiceElement service1 = ServiceElement.builder().name("Service1").build();
    ServiceElement service2 = ServiceElement.builder().name("Service2").build();
    ProtoFile file = ProtoFile.builder("file.proto")
        .addServices(Arrays.asList(service1, service2))
        .build();
    assertThat(file.services()).hasSize(2);
  }

  @Test public void simpleWithOptionsToSchema() {
    TypeElement element = MessageElement.builder().name("Message").build();
    OptionElement option = OptionElement.create("kit", Kind.STRING, "kat");
    ProtoFile file = ProtoFile.builder("file.proto").addOption(option).addType(element).build();
    String expected = ""
        + "// file.proto\n"
        + "\n"
        + "option kit = \"kat\";\n"
        + "\n"
        + "message Message {}\n";
    assertThat(file.toSchema()).isEqualTo(expected);
  }

  @Test public void addMultipleOptions() {
    TypeElement element = MessageElement.builder().name("Message").build();
    OptionElement kitKat = OptionElement.create("kit", Kind.STRING, "kat");
// Path: src/main/java/com/squareup/protoparser/OptionElement.java
// public enum Kind {
//   STRING,
//   BOOLEAN,
//   NUMBER,
//   ENUM,
//   MAP,
//   LIST,
//   OPTION
// }
// 
// Path: src/main/java/com/squareup/protoparser/ProtoFile.java
// static final int MAX_TAG_VALUE = (1 << 29) - 1; // 536,870,911
// 
// Path: src/main/java/com/squareup/protoparser/ProtoFile.java
// static final int MIN_TAG_VALUE = 1;
// 
// Path: src/main/java/com/squareup/protoparser/ProtoFile.java
// static boolean isValidTag(int value) {
//   return (value >= MIN_TAG_VALUE && value < RESERVED_TAG_VALUE_START)
//       || (value > RESERVED_TAG_VALUE_END && value <= MAX_TAG_VALUE);
// }


// Path: src/test/java/com/squareup/protoparser/ProtoFileTest.java
import com.squareup.protoparser.OptionElement.Kind;
import java.util.Arrays;
import java.util.Collections;
import org.junit.Test;
import static com.squareup.protoparser.ProtoFile.MAX_TAG_VALUE;
import static com.squareup.protoparser.ProtoFile.MIN_TAG_VALUE;
import static com.squareup.protoparser.ProtoFile.Syntax.PROTO_2;
import static com.squareup.protoparser.ProtoFile.isValidTag;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;

        + "\n"
        + "service Service {}\n";
    assertThat(file.toSchema()).isEqualTo(expected);
  }

  @Test public void addMultipleServices() {
    ServiceElement service1 = ServiceElement.builder().name("Service1").build();
    ServiceElement service2 = ServiceElement.builder().name("Service2").build();
    ProtoFile file = ProtoFile.builder("file.proto")
        .addServices(Arrays.asList(service1, service2))
        .build();
    assertThat(file.services()).hasSize(2);
  }

  @Test public void simpleWithOptionsToSchema() {
    TypeElement element = MessageElement.builder().name("Message").build();
    OptionElement option = OptionElement.create("kit", Kind.STRING, "kat");
    ProtoFile file = ProtoFile.builder("file.proto").addOption(option).addType(element).build();
    String expected = ""
        + "// file.proto\n"
        + "\n"
        + "option kit = \"kat\";\n"
        + "\n"
        + "message Message {}\n";
    assertThat(file.toSchema()).isEqualTo(expected);
  }

  @Test public void addMultipleOptions() {
    TypeElement element = MessageElement.builder().name("Message").build();
    OptionElement kitKat = OptionElement.create("kit", Kind.STRING, "kat");
    OptionElement fooBar = OptionElement.create("foo", Kind.STRING, "bar");