use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldPrependAllToSet.
// DATACASS-770
@Test
void shouldPrependAllToSet() {
Update update = updateMapper.getMappedObject(Update.empty().addTo("set").prependAll(currencyUSD, currencyEUR), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("set_col = {'US Dollar','Euro'} + set_col");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldCreateSetAtIndexUpdate.
// DATACASS-343
@Test
void shouldCreateSetAtIndexUpdate() {
Update update = updateMapper.getMappedObject(Update.empty().set("list").atIndex(10).to(currencyEUR), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("list[10] = 'Euro'");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldCreateSimpleUpdate.
// DATACASS-343
@Test
void shouldCreateSimpleUpdate() {
Update update = updateMapper.getMappedObject(Update.empty().set("firstName", "foo"), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("first_name = 'foo'");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldAppendAllToSet.
// DATACASS-770
@Test
void shouldAppendAllToSet() {
Update update = updateMapper.getMappedObject(Update.empty().addTo("set").appendAll(currencyUSD, currencyEUR), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("set_col = set_col + {'US Dollar','Euro'}");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldMapTuple.
// DATACASS-523
@Test
void shouldMapTuple() {
Update update = this.updateMapper.getMappedObject(Update.empty().set("tuple", new MappedTuple("foo")), this.persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("tuple = ('foo')");
}
Aggregations