/** Binds to {@code Value.bytesArray(values)} */ public R toBytesArray(@Nullable Iterable<ByteArray> values) { return handle(Value.bytesArray(values)); }
@Override public com.google.protobuf.Value apply(List<ByteArray> input) { return Value.bytesArray(input).toProto(); } },
@Test public void bytesArray() { ByteArray a = newByteArray("a"); ByteArray c = newByteArray("c"); Value v = Value.bytesArray(Arrays.asList(a, null, c)); assertThat(v.isNull()).isFalse(); assertThat(v.getBytesArray()).containsExactly(a, null, c).inOrder(); assertThat(v.toString()).isEqualTo(String.format("[%s,NULL,%s]", a, c)); }
@Test public void bytesArrayTryGetStringArray() { Value value = Value.bytesArray(Arrays.asList(newByteArray("a"))); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Expected: ARRAY<STRING> actual: ARRAY<BYTES>"); value.getStringArray(); }
@Test public void bytesArrayNull() { Value v = Value.bytesArray(null); assertThat(v.isNull()).isTrue(); assertThat(v.toString()).isEqualTo(NULL_STRING); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("null value"); v.getBytesArray(); }
return Value.stringArray(value.getStringList(fieldIndex)); case BYTES: return Value.bytesArray(value.getBytesList(fieldIndex)); case FLOAT64: return Value.float64Array(value.getDoubleArray(fieldIndex));
.to(Value.float64Array(doubleArray)) .set("byteArray") .to(Value.bytesArray(Arrays.asList(byteArray))) .set("timestampArray") .to(Value.timestampArray(Arrays.asList(timestampArray))) .to(Value.float64Array(doubleArray)) .set("byteArray") .to(Value.bytesArray(Arrays.asList(byteArray))) .set("timestampArray") .to(Value.timestampArray(Arrays.asList(timestampArray)))
Value.bytesArray(Arrays.asList(newByteArray("a"), newByteArray("b"))), Value.bytesArray(Arrays.asList(newByteArray("a"), newByteArray("b")))); tester.addEqualityGroup(Value.bytesArray(Arrays.asList(newByteArray("c")))); tester.addEqualityGroup(Value.bytesArray(null));
Value.bytesArray(BrokenSerializationList.of(newByteArray("a"), newByteArray("b")))); reserializeAndAssert(Value.bytesArray(null));
/** Binds to {@code Value.bytesArray(values)} */ public R toBytesArray(@Nullable Iterable<ByteArray> values) { return handle(Value.bytesArray(values)); }
return Value.stringArray(value.getStringList(fieldIndex)); case BYTES: return Value.bytesArray(value.getBytesList(fieldIndex)); case FLOAT64: return Value.float64Array(value.getDoubleArray(fieldIndex));