use of com.scalar.db.io.TextColumn in project scalardb by scalar-labs.
the class PutTest method withValue_ProperValueGiven_ShouldReturnWhatsSet.
@Test
public void withValue_ProperValueGiven_ShouldReturnWhatsSet() {
// Arrange
Put put = preparePut();
TextColumn column2 = TextColumn.of(ANY_NAME_2, ANY_TEXT_2);
TextColumn column1 = TextColumn.of(ANY_NAME_1, ANY_TEXT_1);
// Act
put.withValue(column1).withValue(column2);
// Assert
assertThat(put.getValues()).isEqualTo(ImmutableMap.of(column1.getName(), ScalarDbUtils.toValue(column1), column2.getName(), ScalarDbUtils.toValue(column2)));
assertThat(put.getColumns()).isEqualTo(ImmutableMap.of(column1.getName(), column1, column2.getName(), column2));
assertThat(put.getContainedColumnNames()).isEqualTo(ImmutableSet.of(ANY_NAME_1, ANY_NAME_2));
assertThat(put.containsColumn(ANY_NAME_1)).isTrue();
assertThat(put.isNullValue(ANY_NAME_1)).isFalse();
assertThat(put.getTextValue(ANY_NAME_1)).isEqualTo(ANY_TEXT_1);
assertThat(put.getValueAsObject(ANY_NAME_1)).isEqualTo(ANY_TEXT_1);
assertThat(put.containsColumn(ANY_NAME_2)).isTrue();
assertThat(put.isNullValue(ANY_NAME_2)).isFalse();
assertThat(put.getTextValue(ANY_NAME_2)).isEqualTo(ANY_TEXT_2);
assertThat(put.getValueAsObject(ANY_NAME_2)).isEqualTo(ANY_TEXT_2);
}
Aggregations