File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -690,7 +690,29 @@ void tupleProjection(Class<?> resultType) {
690
690
.validateQuery ();
691
691
}
692
692
693
- // TODO: delete queries
693
+ @ ParameterizedTest
694
+ @ ValueSource (classes = { Long .class , List .class , Person .class })
695
+ void delete (Class <?> resultType ) {
696
+
697
+ queryCreator (PERSON ) //
698
+ .forTree (Person .class , "deletePersonByFirstname" ) //
699
+ .returing (resultType ) //
700
+ .withParameters ("chris" ) //
701
+ .as (QueryCreatorTester ::create ) //
702
+ .expectJpql ("SELECT p FROM %s p WHERE p.firstname = ?1" , Person .class .getName ()) //
703
+ .validateQuery ();
704
+ }
705
+
706
+ @ Test
707
+ void exists () {
708
+
709
+ queryCreator (PERSON ) //
710
+ .forTree (Person .class , "existsPersonByFirstname" ) //
711
+ .returing (Long .class ).withParameters ("chris" ) //
712
+ .as (QueryCreatorTester ::create ) //
713
+ .expectJpql ("SELECT p.id id FROM %s p WHERE p.firstname = ?1" , Person .class .getName ()) //
714
+ .validateQuery ();
715
+ }
694
716
695
717
QueryCreatorBuilder queryCreator (Metamodel metamodel ) {
696
718
return new DefaultCreatorBuilder (metamodel );
You can’t perform that action at this time.
0 commit comments