public void testMatchingSourceAndSink() {
for (ParameterParser parser : allParsers) {
// These are doctored to match real data we've seen
List<DefaultCodePoint> chainedRequestParamElements1 = Arrays.asList(
new DefaultCodePoint("java/org/springframework/samples/petclinic/web/OwnerController.java",85,
"public String processFindForm(@RequestParam String lastName, @RequestParam String firstName) {"),
new DefaultCodePoint("java/org/springframework/samples/petclinic/web/OwnerController.java", 93,
"Collection<Owner> results = this.clinicService.findOwnerByLastName(lastName);"),
new DefaultCodePoint("java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java", 72,
"return ownerRepository.findByLastName(lastName);"),
new DefaultCodePoint("java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java", 84,
"\"SELECT id FROM owners WHERE last_name like '\" + lastName + \"%' or first_name like '\" + firstName + \"%'\",")
);
EndpointQuery finding = EndpointQueryBuilder.start()
.setCodePoints(chainedRequestParamElements1)
.generateQuery();
String result = parser.parse(finding);
assertTrue("Parameter was " + result + " instead of lastName", "lastName".equals(result));
// These are doctored to match real data we've seen
List<DefaultCodePoint> chainedRequestParamElements2 = Arrays.asList(
new DefaultCodePoint("java/org/springframework/samples/petclinic/web/OwnerController.java",85,
"public String processFindForm(@RequestParam String lastName, @RequestParam String firstName) {"),
new DefaultCodePoint("java/org/springframework/samples/petclinic/web/OwnerController.java", 94,
"Collection<Owner> results = this.clinicService.findOwnerByFirstName(firstName);"),
new DefaultCodePoint("java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java", 73,
"return ownerRepository.findByFirstName(firstName);"),
new DefaultCodePoint("java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java", 84,
"\"SELECT id FROM owners WHERE last_name like '\" + lastName + \"%' or first_name like '\" + firstName + \"%'\",")
);
finding = EndpointQueryBuilder.start()
.setCodePoints(chainedRequestParamElements2)