parent
1bdb67cda9
commit
608be54a58
|
@ -31,6 +31,7 @@ import org.springframework.jdbc.core.SqlOutParameter;
|
|||
import org.springframework.jdbc.core.SqlParameter;
|
||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||
|
||||
import static java.util.Map.entry;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
|
@ -50,6 +51,14 @@ public class RdbmsOperationTests {
|
|||
operation::compile);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSql() {
|
||||
String sql = "select * from mytable";
|
||||
operation.setDataSource(new DriverManagerDataSource());
|
||||
operation.setSql(sql);
|
||||
String strGotten = operation.getSql();
|
||||
assertThat(strGotten.equals(sql));
|
||||
}
|
||||
@Test
|
||||
public void setTypeAfterCompile() {
|
||||
operation.setDataSource(new DriverManagerDataSource());
|
||||
|
@ -98,6 +107,15 @@ public class RdbmsOperationTests {
|
|||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() ->
|
||||
operation.validateParameters(new Object[] { 1, 2 }));
|
||||
}
|
||||
@Test
|
||||
public void tooManyMapParameters() {
|
||||
operation.setSql("select * from mytable");
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() ->
|
||||
operation.validateNamedParameters(Map.ofEntries(
|
||||
entry("a", "b"),
|
||||
entry("c", "d")
|
||||
) ));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unspecifiedMapParameters() {
|
||||
|
|
Loading…
Reference in New Issue