use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldClearSet.
// DATACASS-343
@Test
void shouldClearSet() {
Update update = updateMapper.getMappedObject(Update.empty().clear("set"), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("set_col = {}");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldCreateIncrementUpdate.
// DATACASS-343
@Test
void shouldCreateIncrementUpdate() {
Update update = updateMapper.getMappedObject(Update.empty().increment("number"), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("number = number + 1");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldAppendToSet.
// DATACASS-770
@Test
void shouldAppendToSet() {
Update update = updateMapper.getMappedObject(Update.empty().addTo("set").append(currencyEUR), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("set_col = set_col + {'Euro'}");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldMapEmbeddedEntity.
// DATACASS-167
@Test
void shouldMapEmbeddedEntity() {
Update update = this.updateMapper.getMappedObject(Update.empty().set("nested.firstname", "spring"), mappingContext.getRequiredPersistentEntity(WithNullableEmbeddedType.class));
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update.toString()).startsWith("firstname = 'spring'");
}
use of org.springframework.data.cassandra.core.query.Update in project spring-data-cassandra by spring-projects.
the class UpdateMapperUnitTests method shouldAppendAllToSetViaColumnNameCollectionOfElements.
// DATACASS-770
@Test
void shouldAppendAllToSetViaColumnNameCollectionOfElements() {
Update update = updateMapper.getMappedObject(Update.empty().addTo("set_col").appendAll(new LinkedHashSet<>(Arrays.asList(currencyUSD, currencyEUR))), persistentEntity);
assertThat(update.getUpdateOperations()).hasSize(1);
assertThat(update).hasToString("set_col = set_col + {'US Dollar','Euro'}");
}
Aggregations