@@ -174,77 +174,60 @@ class StringBuilderCallSiteTest extends AgentTestRunner {
174
174
ex.stackTrace.find { it.className == StringBuilderCallSite.name } == null
175
175
}
176
176
177
- def ' test string builder substring call site' () {
177
+ def ' test string #type substring call site' () {
178
178
setup:
179
179
final iastModule = Mock(StringModule)
180
180
InstrumentationBridge.registerIastModule(iastModule)
181
181
182
182
when:
183
- final result = TestStringBuilderSuite .substring(param, beginIndex)
183
+ final result = suite .substring(param, beginIndex)
184
184
185
185
then:
186
186
result == expected
187
187
1 * iastModule.onStringSubSequence(param, beginIndex, param.length(), expected)
188
188
0 * _
189
189
190
190
where:
191
- param | beginIndex | expected
192
- sb(' 012345 ' ) | 1 | ' 12345 '
191
+ type | suite | param | beginIndex | expected
192
+ "builder" | new TestStringBuilderSuite() | sb(' 012345 ' ) | 1 | ' 12345 '
193
+ "buffer" | new TestStringBufferSuite() | sbf(' 012345 ' ) | 1 | ' 12345 '
193
194
}
194
195
195
- def ' test string buffer substring call site' () {
196
+ def ' test string #type substring with endIndex call site' () {
196
197
setup:
197
198
final iastModule = Mock(StringModule)
198
199
InstrumentationBridge.registerIastModule(iastModule)
199
200
200
201
when:
201
- final result = TestStringBufferSuite.substring(param, beginIndex)
202
-
203
- then:
204
- result == expected
205
- 1 * iastModule.onStringSubSequence(param, beginIndex, param.length(), expected)
206
- 0 * _
207
-
208
- where:
209
- param | beginIndex | expected
210
- sbf(' 012345 ' ) | 1 | ' 12345 '
211
- }
212
-
213
- def ' test string builder/ buffer #method with endIndex call site' () {
214
- setup:
215
- final iastModule = Mock(StringModule)
216
- InstrumentationBridge.registerIastModule(iastModule)
217
-
218
- when:
219
- final result = suite."$method"(param, beginIndex, endIndex)
202
+ final result = suite.substring(param, beginIndex, endIndex)
220
203
221
204
then:
222
205
result == expected
223
206
1 * iastModule.onStringSubSequence(param, beginIndex, endIndex, expected)
224
207
0 * _
225
208
226
209
where:
227
- suite | method | param | beginIndex | endIndex | expected
228
- new TestStringBuilderSuite() | "substring" | sb(' 012345 ' ) | 1 | 5 | ' 1234 '
229
- new TestStringBufferSuite() | "substring" | sbf(' 012345 ' ) | 1 | 5 | ' 1234 '
210
+ type | suite | param | beginIndex | endIndex | expected
211
+ "builder" | new TestStringBuilderSuite() | sb(' 012345 ' ) | 1 | 5 | ' 1234 '
212
+ "buffer" | new TestStringBufferSuite() | sbf(' 012345 ' ) | 1 | 5 | ' 1234 '
230
213
}
231
214
232
- def ' test string builder / buffer #method with endIndex call site' () {
215
+ def ' test string #type subSequence with endIndex call site' () {
233
216
setup:
234
217
final iastModule = Mock(StringModule)
235
218
InstrumentationBridge.registerIastModule(iastModule)
236
219
237
220
when:
238
- final result = suite."$method" (param, beginIndex, endIndex)
221
+ final result = suite.subSequence (param, beginIndex, endIndex)
239
222
240
223
then:
241
224
result == expected
242
225
1 * iastModule.onStringSubSequence(param, beginIndex, endIndex, expected)
243
226
0 * _
244
227
245
228
where:
246
- suite | method | param | beginIndex | endIndex | expected
247
- new TestStringBuilderSuite() | "subSequence" | sb(' 012345 ' ) | 1 | 5 | ' 1234 '
229
+ type | suite | param | beginIndex | endIndex | expected
230
+ "builder" | new TestStringBuilderSuite() | sb(' 012345 ' ) | 1 | 5 | ' 1234 '
248
231
}
249
232
250
233
private static class BrokenToString {
0 commit comments