use of com.google.cloud.Date in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindDateArray.
@Test
public void bindDateArray() {
Date d1 = Date.parseDate("2016-09-18");
Date d2 = Date.parseDate("2016-09-19");
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toDateArray(Arrays.asList(d1, d2, null)), Type.array(Type.date()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDateList(0)).containsExactly(d1, d2, null).inOrder();
}
use of com.google.cloud.Date in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindDateArrayEmpty.
@Test
public void bindDateArrayEmpty() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toDateArray(Arrays.<Date>asList()), Type.array(Type.date()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDateList(0)).containsExactly();
}
use of com.google.cloud.Date in project google-cloud-java by GoogleCloudPlatform.
the class ITWriteTest method writeDate.
@Test
public void writeDate() {
Date date = Date.parseDate("2016-09-15");
write(baseInsert().set("DateValue").to(date).build());
Struct row = readLastRow("DateValue");
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDate(0)).isEqualTo(date);
}
use of com.google.cloud.Date in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindDateNull.
@Test
public void bindDateNull() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").to((Date) null), Type.date());
assertThat(row.isNull(0)).isTrue();
}
use of com.google.cloud.Date in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindDate.
@Test
public void bindDate() {
Date d = Date.parseDate("2016-09-18");
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").to(d), Type.date());
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDate(0)).isEqualTo(d);
}
Aggregations