Search in sources :

Example 1 with BlobColumn

use of com.scalar.db.io.BlobColumn 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);
}
Also used : BlobColumn(com.scalar.db.io.BlobColumn) IntColumn(com.scalar.db.io.IntColumn) BigIntColumn(com.scalar.db.io.BigIntColumn) TextColumn(com.scalar.db.io.TextColumn) Test(org.junit.jupiter.api.Test)

Example 2 with BlobColumn

use of com.scalar.db.io.BlobColumn in project scalardb by scalar-labs.

the class ValueBinderTest method visit_BlobColumnAcceptCalled_ShouldCallSetString.

@Test
public void visit_BlobColumnAcceptCalled_ShouldCallSetString() {
    // Arrange
    BlobColumn column = BlobColumn.of(ANY_NAME, ANY_STRING.getBytes(StandardCharsets.UTF_8));
    ValueBinder binder = new ValueBinder(bound);
    // Act
    column.accept(binder);
    // Assert
    verify(bound).setBytes(0, (ByteBuffer) ByteBuffer.allocate(ANY_STRING.length()).put(ANY_STRING.getBytes(StandardCharsets.UTF_8)).flip());
}
Also used : BlobColumn(com.scalar.db.io.BlobColumn) Test(org.junit.jupiter.api.Test)

Example 3 with BlobColumn

use of com.scalar.db.io.BlobColumn in project scalardb by scalar-labs.

the class ValueBinderTest method visit_BlobColumnWithNullValueAcceptCalled_ShouldCallSetToNull.

@Test
public void visit_BlobColumnWithNullValueAcceptCalled_ShouldCallSetToNull() {
    // Arrange
    BlobColumn column = BlobColumn.ofNull(ANY_NAME);
    ValueBinder binder = new ValueBinder(bound);
    // Act
    column.accept(binder);
    // Assert
    verify(bound).setToNull(0);
}
Also used : BlobColumn(com.scalar.db.io.BlobColumn) Test(org.junit.jupiter.api.Test)

Aggregations

BlobColumn (com.scalar.db.io.BlobColumn)3 Test (org.junit.jupiter.api.Test)3 BigIntColumn (com.scalar.db.io.BigIntColumn)1 IntColumn (com.scalar.db.io.IntColumn)1 TextColumn (com.scalar.db.io.TextColumn)1