Search in sources :

Example 1 with IntColumn

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

the class ValueBinderTest method visit_IntColumnAcceptCalled_ShouldCallSetInt.

@Test
public void visit_IntColumnAcceptCalled_ShouldCallSetInt() {
    // Arrange
    IntColumn column = IntColumn.of(ANY_NAME, ANY_INT);
    ValueBinder binder = new ValueBinder(bound);
    // Act
    column.accept(binder);
    // Assert
    verify(bound).setInt(0, ANY_INT);
}
Also used : IntColumn(com.scalar.db.io.IntColumn) BigIntColumn(com.scalar.db.io.BigIntColumn) Test(org.junit.jupiter.api.Test)

Example 2 with IntColumn

use of com.scalar.db.io.IntColumn 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);
}
Also used : 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 3 with IntColumn

use of com.scalar.db.io.IntColumn 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 4 with IntColumn

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

the class ValueBinderTest method visit_IntColumnWithNullValueAcceptCalled_ShouldCallSetToNull.

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

Aggregations

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