// Path: mug-guava/src/main/java/com/google/mu/collect/Immutables.java
// public static <E> ImmutableList<E> list() {
//   return ImmutableList.of();
// }
// 
// Path: mug-guava/src/main/java/com/google/mu/collect/Immutables.java
// public static <K, V> ImmutableMap<K, V> map() {
//   return ImmutableMap.of();
// }
// 
// Path: mug-guava/src/main/java/com/google/mu/collect/Immutables.java
// public static <R, C, V> ImmutableTable<R, C, V> table() {
//   return ImmutableTable.of();
// }
// 
// Path: mug-protobuf/src/main/java/com/google/mu/protobuf/util/MoreStructs.java
// public static Struct struct(String name, boolean value) {
//   return struct(name, valueOf(value));
// }
// 
// Path: mug-protobuf/src/main/java/com/google/mu/protobuf/util/MoreValues.java
// public static ListValue listValueOf(double... values) {
//   return stream(values).mapToObj(MoreValues::valueOf).collect(toListValue());
// }


import static com.google.common.truth.Truth.assertThat;
import static com.google.mu.collect.Immutables.list;
import static com.google.mu.collect.Immutables.map;
import static com.google.mu.collect.Immutables.table;
import static com.google.mu.protobuf.util.MoreStructs.struct;
import static com.google.mu.protobuf.util.MoreValues.listValueOf;
import static org.junit.Assert.assertThrows;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.testing.NullPointerTester;
import com.google.protobuf.ListValue;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import com.google.protobuf.util.Structs;
import com.google.protobuf.util.Values;
    assertThat(new StructBuilder().add("k", new StructBuilder()).build())
        .isEqualTo(Structs.of("k", Values.of(Struct.getDefaultInstance())));
  }

  @Test public void testAdd_nonEmptyStructBuilder() {
    assertThat(new StructBuilder().add("k", new StructBuilder().add("name", "value")).build())
        .isEqualTo(Structs.of("k", Values.of(struct("name", "value"))));
  }

  @Test public void testAdd_value() {
    assertThat(new StructBuilder().add("k", Values.of(1)).build())
        .isEqualTo(Structs.of("k", Values.of(1)));
  }

  @Test public void testAddAllFields_fromStruct() {
    Struct struct =  struct("name", "v");
    assertThat(new StructBuilder().addAllFields(struct).build())
        .isEqualTo(struct);
  }

  @Test public void testAddAllFields_fromStructBuilder() {
    assertThat(new StructBuilder().addAllFields(new StructBuilder().add("name", 1)).build())
        .isEqualTo(struct("name", 1));
  }

  @Test public void testAddAllFields_cyclic() {
    StructBuilder builder = new StructBuilder();
    assertThrows(IllegalArgumentException.class, () -> builder.addAllFields(builder));
  }

// Path: mug-guava/src/main/java/com/google/mu/collect/Immutables.java
// public static <E> ImmutableList<E> list() {
//   return ImmutableList.of();
// }
// 
// Path: mug-guava/src/main/java/com/google/mu/collect/Immutables.java
// public static <K, V> ImmutableMap<K, V> map() {
//   return ImmutableMap.of();
// }
// 
// Path: mug-guava/src/main/java/com/google/mu/collect/Immutables.java
// public static <R, C, V> ImmutableTable<R, C, V> table() {
//   return ImmutableTable.of();
// }
// 
// Path: mug-protobuf/src/main/java/com/google/mu/protobuf/util/MoreStructs.java
// public static Struct struct(String name, boolean value) {
//   return struct(name, valueOf(value));
// }
// 
// Path: mug-protobuf/src/main/java/com/google/mu/protobuf/util/MoreValues.java
// public static ListValue listValueOf(double... values) {
//   return stream(values).mapToObj(MoreValues::valueOf).collect(toListValue());
// }


// Path: mug-protobuf/src/test/java/com/google/mu/protobuf/util/StructBuilderTest.java
import static com.google.common.truth.Truth.assertThat;
import static com.google.mu.collect.Immutables.list;
import static com.google.mu.collect.Immutables.map;
import static com.google.mu.collect.Immutables.table;
import static com.google.mu.protobuf.util.MoreStructs.struct;
import static com.google.mu.protobuf.util.MoreValues.listValueOf;
import static org.junit.Assert.assertThrows;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.testing.NullPointerTester;
import com.google.protobuf.ListValue;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import com.google.protobuf.util.Structs;
import com.google.protobuf.util.Values;

    assertThat(new StructBuilder().add("k", new StructBuilder()).build())
        .isEqualTo(Structs.of("k", Values.of(Struct.getDefaultInstance())));
  }

  @Test public void testAdd_nonEmptyStructBuilder() {
    assertThat(new StructBuilder().add("k", new StructBuilder().add("name", "value")).build())
        .isEqualTo(Structs.of("k", Values.of(struct("name", "value"))));
  }

  @Test public void testAdd_value() {
    assertThat(new StructBuilder().add("k", Values.of(1)).build())
        .isEqualTo(Structs.of("k", Values.of(1)));
  }

  @Test public void testAddAllFields_fromStruct() {
    Struct struct =  struct("name", "v");
    assertThat(new StructBuilder().addAllFields(struct).build())
        .isEqualTo(struct);
  }

  @Test public void testAddAllFields_fromStructBuilder() {
    assertThat(new StructBuilder().addAllFields(new StructBuilder().add("name", 1)).build())
        .isEqualTo(struct("name", 1));
  }

  @Test public void testAddAllFields_cyclic() {
    StructBuilder builder = new StructBuilder();
    assertThrows(IllegalArgumentException.class, () -> builder.addAllFields(builder));
  }

  @Test public void testToString() {