DATAJDBC-235 - Incorporate feedback from review.

Refactor ResultSetParameterValueProvider into Function<Parameter, Object>. Remove unnecessary assertions.
This commit is contained in:
Mark Paluch
2018-07-18 14:33:33 +02:00
committed by Jens Schauder
parent fb858bf1b1
commit 2c5489b070
5 changed files with 15 additions and 44 deletions

View File

@@ -111,8 +111,6 @@ public class DefaultDataAccessStrategyUnitTests {
verify(jdbcOperations).update(sqlCaptor.capture(), paramSourceCaptor.capture(), any(KeyHolder.class));
assertThat(sqlCaptor.getValue()) //
.contains("INSERT INTO entity_with_boolean (flag, id) VALUES (:flag, :id)");
assertThat(paramSourceCaptor.getValue().getValue("id")).isEqualTo(ORIGINAL_ID);
assertThat(paramSourceCaptor.getValue().getValue("flag")).isEqualTo("T");
}

View File

@@ -22,8 +22,6 @@ import lombok.Value;
import org.junit.Test;
import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.mapping.PreferredConstructor.Parameter;
import org.springframework.data.mapping.model.ParameterValueProvider;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
@@ -78,12 +76,7 @@ public class BasicRelationalConverterUnitTests {
RelationalPersistentEntity<MyValue> entity = (RelationalPersistentEntity) context
.getRequiredPersistentEntity(MyValue.class);
MyValue result = converter.createInstance(entity, new ParameterValueProvider<RelationalPersistentProperty>() {
@Override
public <T> T getParameterValue(Parameter<T, RelationalPersistentProperty> parameter) {
return (T) "bar";
}
});
MyValue result = converter.createInstance(entity, it -> "bar");
assertThat(result.getFoo()).isEqualTo("bar");
}