|
1 | 1 | /* |
2 | | - * Copyright 2002-2019 the original author or authors. |
| 2 | + * Copyright 2002-2022 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -78,29 +78,39 @@ public void tooFewParameters() { |
78 | 78 |
|
79 | 79 | @Test |
80 | 80 | public void tooFewMapParameters() { |
| 81 | + operation.setDataSource(new DriverManagerDataSource()); |
81 | 82 | operation.setSql("select * from mytable"); |
82 | 83 | operation.setTypes(new int[] { Types.INTEGER }); |
83 | 84 | assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> |
84 | 85 | operation.validateNamedParameters((Map<String, String>) null)); |
85 | 86 | } |
86 | 87 |
|
87 | 88 | @Test |
88 | | - public void operationConfiguredViaJdbcTemplateMustGetDataSource() throws Exception { |
| 89 | + public void operationConfiguredViaJdbcTemplateMustGetDataSource() { |
89 | 90 | operation.setSql("foo"); |
90 | 91 | assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> |
91 | 92 | operation.compile()) |
92 | | - .withMessageContaining("ataSource"); |
| 93 | + .withMessageContaining("'dataSource'"); |
93 | 94 | } |
94 | 95 |
|
95 | 96 | @Test |
96 | 97 | public void tooManyParameters() { |
| 98 | + operation.setDataSource(new DriverManagerDataSource()); |
97 | 99 | operation.setSql("select * from mytable"); |
98 | 100 | assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> |
99 | 101 | operation.validateParameters(new Object[] { 1, 2 })); |
100 | 102 | } |
| 103 | + @Test |
| 104 | + public void tooManyMapParameters() { |
| 105 | + operation.setDataSource(new DriverManagerDataSource()); |
| 106 | + operation.setSql("select * from mytable"); |
| 107 | + assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> |
| 108 | + operation.validateNamedParameters(Map.of("a", "b", "c", "d"))); |
| 109 | + } |
101 | 110 |
|
102 | 111 | @Test |
103 | 112 | public void unspecifiedMapParameters() { |
| 113 | + operation.setDataSource(new DriverManagerDataSource()); |
104 | 114 | operation.setSql("select * from mytable"); |
105 | 115 | Map<String, String> params = new HashMap<>(); |
106 | 116 | params.put("col1", "value"); |
|
0 commit comments