use of com.scalar.db.io.TextColumn in project scalardb by scalar-labs.
the class ValueBinderTest method visit_AcceptCalledMultipleTimes_ShouldCallSetWithIncremented.
@Test
public void visit_AcceptCalledMultipleTimes_ShouldCallSetWithIncremented() {
// Arrange
TextColumn column1 = TextColumn.of(ANY_NAME, ANY_STRING);
IntColumn column2 = IntColumn.of(ANY_NAME, ANY_INT);
ValueBinder binder = new ValueBinder(bound);
// Act
column1.accept(binder);
column2.accept(binder);
// Assert
verify(bound).setString(0, ANY_STRING);
verify(bound).setInt(1, ANY_INT);
}
use of com.scalar.db.io.TextColumn in project scalardb by scalar-labs.
the class ValueBinderTest method visit_AcceptCalledMultipleTimesWithNullValue_ShouldSetProperly.
@Test
public void visit_AcceptCalledMultipleTimesWithNullValue_ShouldSetProperly() {
// Arrange
IntColumn column1 = IntColumn.of(ANY_NAME, ANY_INT);
BlobColumn column2 = BlobColumn.ofNull(ANY_NAME);
TextColumn column3 = TextColumn.ofNull(ANY_NAME);
IntColumn column4 = IntColumn.of(ANY_NAME, ANY_INT);
ValueBinder binder = new ValueBinder(bound);
// Act
column1.accept(binder);
column2.accept(binder);
column3.accept(binder);
column4.accept(binder);
// Assert
verify(bound).setInt(0, ANY_INT);
verify(bound).setToNull(1);
verify(bound).setToNull(2);
verify(bound).setInt(3, ANY_INT);
}
use of com.scalar.db.io.TextColumn in project scalardb by scalar-labs.
the class ValueBinderTest method visit_TextColumnAcceptCalled_ShouldCallSetString.
@Test
public void visit_TextColumnAcceptCalled_ShouldCallSetString() {
// Arrange
TextColumn column = TextColumn.of(ANY_NAME, ANY_STRING);
ValueBinder binder = new ValueBinder(bound);
// Act
column.accept(binder);
// Assert
verify(bound).setString(0, ANY_STRING);
}
use of com.scalar.db.io.TextColumn in project scalardb by scalar-labs.
the class PutTest method getColumns_TryToModifyReturned_ShouldThrowException.
@Test
public void getColumns_TryToModifyReturned_ShouldThrowException() {
// Arrange
Put put = preparePut();
TextColumn column1 = TextColumn.of(ANY_NAME_1, ANY_TEXT_1);
TextColumn column2 = TextColumn.of(ANY_NAME_2, ANY_TEXT_2);
put.withValue(column1).withValue(column2);
// Act Assert
Map<String, Column<?>> values = put.getColumns();
assertThatThrownBy(() -> values.put(ANY_NAME_3, TextColumn.of(ANY_NAME_3, ANY_TEXT_3))).isInstanceOf(UnsupportedOperationException.class);
}
use of com.scalar.db.io.TextColumn in project scalardb by scalar-labs.
the class ValueBinderTest method visit_TextColumnWithNullValueAcceptCalled_ShouldCallSetToNull.
@Test
public void visit_TextColumnWithNullValueAcceptCalled_ShouldCallSetToNull() {
// Arrange
TextColumn column = TextColumn.ofNull(ANY_NAME);
ValueBinder binder = new ValueBinder(bound);
// Act
column.accept(binder);
// Assert
verify(bound).setToNull(0);
}
Aggregations