use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITWriteTest method writeBool.
@Test
public void writeBool() {
write(baseInsert().set("BoolValue").to(true).build());
Struct row = readLastRow("BoolValue");
assertThat(row.isNull(0)).isFalse();
assertThat(row.getBoolean(0)).isTrue();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITWriteTest method writeBytes.
@Test
public void writeBytes() {
ByteArray data = ByteArray.copyFrom("V1");
write(baseInsert().set("BytesValue").to(data).build());
Struct row = readLastRow("BytesValue");
assertThat(row.isNull(0)).isFalse();
assertThat(row.getBytes(0)).isEqualTo(data);
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITWriteTest method writeBoolNull.
@Test
public void writeBoolNull() {
write(baseInsert().set("BoolValue").to((Boolean) null).build());
Struct row = readLastRow("BoolValue");
assertThat(row.isNull(0)).isTrue();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITWriteTest method writeFloat64NonNumbers.
@Test
public void writeFloat64NonNumbers() {
write(baseInsert().set("Float64Value").to(Double.NEGATIVE_INFINITY).build());
Struct row = readLastRow("Float64Value");
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDouble(0)).isNegativeInfinity();
write(baseInsert().set("Float64Value").to(Double.POSITIVE_INFINITY).build());
row = readLastRow("Float64Value");
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDouble(0)).isPositiveInfinity();
write(baseInsert().set("Float64Value").to(Double.NaN).build());
row = readLastRow("Float64Value");
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDouble(0)).isNaN();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITWriteTest method writeBoolArray.
@Test
public void writeBoolArray() {
write(baseInsert().set("BoolArrayValue").toBoolArray(Arrays.asList(true, null, false)).build());
Struct row = readLastRow("BoolArrayValue");
assertThat(row.isNull(0)).isFalse();
assertThat(row.getBooleanList(0)).containsExactly(true, null, false).inOrder();
expectedException.expect(NullPointerException.class);
row.getBooleanArray(0);
}
Aggregations