use of com.datastax.oss.driver.internal.querybuilder.insert.DefaultInsert in project java-driver by datastax.
the class RegularInsertTest method should_throw_exception_with_invalid_timestamp.
@Test
public void should_throw_exception_with_invalid_timestamp() {
DefaultInsert defaultInsert = (DefaultInsert) insertInto("foo").value("a", bindMarker()).usingTimestamp(1);
Throwable t = catchThrowable(() -> new DefaultInsert(defaultInsert.getKeyspace(), defaultInsert.getTable(), (Term) defaultInsert.getJson(), defaultInsert.getMissingJsonBehavior(), defaultInsert.getAssignments(), // invalid timestamp object)
new Object(), defaultInsert.getTtlInSeconds(), defaultInsert.isIfNotExists()));
assertThat(t).isInstanceOf(IllegalArgumentException.class).hasMessage("TIMESTAMP value must be a BindMarker or a Long");
}
use of com.datastax.oss.driver.internal.querybuilder.insert.DefaultInsert in project java-driver by datastax.
the class RegularInsertTest method should_throw_exception_with_invalid_ttl.
@Test
public void should_throw_exception_with_invalid_ttl() {
DefaultInsert defaultInsert = (DefaultInsert) insertInto("foo").value("a", bindMarker()).usingTtl(10);
Throwable t = catchThrowable(() -> new DefaultInsert(defaultInsert.getKeyspace(), defaultInsert.getTable(), (Term) defaultInsert.getJson(), defaultInsert.getMissingJsonBehavior(), defaultInsert.getAssignments(), defaultInsert.getTimestamp(), // invalid TTL object
new Object(), defaultInsert.isIfNotExists()));
assertThat(t).isInstanceOf(IllegalArgumentException.class).hasMessage("TTL value must be a BindMarker or an Integer");
}
Aggregations