V1DocumentBuilder extends AbstractDocumentBuilder { @NotNull @Override public DocumentBuilder withField( @NotNull final String name, @NotNull final UnsignedByteArray value, @NotNull final IndexOption index, @NotNull final IndexType length) { if (name.equals(PAYLOAD)) throw new IllegalArgumentException("Reserved field name <" + PAYLOAD + ">"); return doWithField(name, value, index, length); }  @NotNull @Override DocumentBuilder withPayload(
            @NotNull
            final byte[] payload); @NotNull @Override DocumentBuilder withField(
            @NotNull
            final String name,
            @NotNull
            final UnsignedByteArray value,
            @NotNull
            final IndexOption index,
            @NotNull
            final IndexType length);  }
@Test(expected = IllegalArgumentException.class) public void differentIndexOptions() { new V1DocumentBuilder() .withField("k", "v1", DocumentBuilder.IndexOption.FILTERABLE) .withField("k", "v2", DocumentBuilder.IndexOption.SORTABLE); }
@Test(expected = IllegalArgumentException.class) public void differentLength() { new V1DocumentBuilder() .withField("k", "0", DocumentBuilder.IndexOption.FULL) .withField("k", 0, DocumentBuilder.IndexOption.FULL); }
@Test(expected = IllegalArgumentException.class) public void payloadStoredField() { new V1DocumentBuilder() .withField( DocumentBuilder.PAYLOAD, "0", DocumentBuilder.IndexOption.STORED); }