@@ -174,77 +174,60 @@ class StringBuilderCallSiteTest extends AgentTestRunner {
174174 ex.stackTrace.find { it.className == StringBuilderCallSite.name } == null
175175 }
176176
177- def ' test string builder substring call site' () {
177+ def ' test string #type substring call site' () {
178178 setup:
179179 final iastModule = Mock(StringModule)
180180 InstrumentationBridge.registerIastModule(iastModule)
181181
182182 when:
183- final result = TestStringBuilderSuite .substring(param, beginIndex)
183+ final result = suite .substring(param, beginIndex)
184184
185185 then:
186186 result == expected
187187 1 * iastModule.onStringSubSequence(param, beginIndex, param.length(), expected)
188188 0 * _
189189
190190 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 '
193194 }
194195
195- def ' test string buffer substring call site' () {
196+ def ' test string #type substring with endIndex call site' () {
196197 setup:
197198 final iastModule = Mock(StringModule)
198199 InstrumentationBridge.registerIastModule(iastModule)
199200
200201 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)
220203
221204 then:
222205 result == expected
223206 1 * iastModule.onStringSubSequence(param, beginIndex, endIndex, expected)
224207 0 * _
225208
226209 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 '
230213 }
231214
232- def ' test string builder / buffer #method with endIndex call site' () {
215+ def ' test string #type subSequence with endIndex call site' () {
233216 setup:
234217 final iastModule = Mock(StringModule)
235218 InstrumentationBridge.registerIastModule(iastModule)
236219
237220 when:
238- final result = suite."$method" (param, beginIndex, endIndex)
221+ final result = suite.subSequence (param, beginIndex, endIndex)
239222
240223 then:
241224 result == expected
242225 1 * iastModule.onStringSubSequence(param, beginIndex, endIndex, expected)
243226 0 * _
244227
245228 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 '
248231 }
249232
250233 private static class BrokenToString {
0 commit comments