Field implements JsonSerializable { @NonNull public static Builder newBuilder() { return new Builder(); } Field(@NonNull Builder builder); @NonNull static Builder newBuilder(); @NonNull @Override String toString(); @NonNull @Override JsonValue toJsonValue();  }
@Test public void testFieldVariations() { Field.newBuilder() .setName("name") .setValue(5) .build(); Field.newBuilder() .setName("name") .setLabel("label") .build(); }
@Test(expected = IllegalStateException.class) public void testFieldOnlyLabel() { Field.newBuilder() .setLabel("label") .build(); }