Skip to content

Commit fe2a2da

Browse files
author
Christopher Wall
committed
Correct formatting on changes
1 parent 8bf6c52 commit fe2a2da

File tree

2 files changed

+71
-63
lines changed

2 files changed

+71
-63
lines changed

schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/GraphQLJpaQueryFactory.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,13 +1605,13 @@ private Predicate getCompoundPredicate(CriteriaBuilder cb, List<Predicate> predi
16051605
if (predicates.isEmpty()) return cb.disjunction();
16061606

16071607
if (predicates.size() == 1) {
1608-
if(logical == Logical.NOT){
1608+
if (logical == Logical.NOT) {
16091609
return cb.not(predicates.get(0));
16101610
}
16111611
return predicates.get(0);
16121612
}
16131613

1614-
switch (logical){
1614+
switch (logical) {
16151615
case OR:
16161616
return cb.or(predicates.toArray(new Predicate[0]));
16171617
case AND:
@@ -1621,7 +1621,9 @@ private Predicate getCompoundPredicate(CriteriaBuilder cb, List<Predicate> predi
16211621
case NOT:
16221622
throw new RuntimeException("NOT expression cannot be applied to multiple predicates at once");
16231623
default:
1624-
throw new RuntimeException("Unable to resolve applicable compound predicate for logical operand "+logical);
1624+
throw new RuntimeException(
1625+
"Unable to resolve applicable compound predicate for logical operand " + logical
1626+
);
16251627
}
16261628
}
16271629

schema/src/test/java/com/introproventures/graphql/jpa/query/support/GraphQLExecutorTestsSupport.java

Lines changed: 66 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,11 @@ public void queryForEnumNotEq() {
398398
//given
399399
String query = "{ Books(where: {genre: {NOT: {EQ:PLAY}}}) { select { id title, genre } }}";
400400

401-
String expected = "{Books={select=["
402-
+ "{id=2, title=War and Peace, genre=NOVEL}, "
403-
+ "{id=3, title=Anna Karenina, genre=NOVEL}"
404-
+ "]}}";
401+
String expected =
402+
"{Books={select=[" +
403+
"{id=2, title=War and Peace, genre=NOVEL}, " +
404+
"{id=3, title=Anna Karenina, genre=NOVEL}" +
405+
"]}}";
405406

406407
//when
407408
Object result = executor.execute(query).getData();
@@ -433,10 +434,11 @@ public void queryForEnumNotIn() {
433434
//given
434435
String query = "{ Books(where: {genre: {NOT: {IN: PLAY}}}) { select { id title, genre } }}";
435436

436-
String expected = "{Books={select=["
437-
+ "{id=2, title=War and Peace, genre=NOVEL}, "
438-
+ "{id=3, title=Anna Karenina, genre=NOVEL}"
439-
+ "]}}";
437+
String expected =
438+
"{Books={select=[" +
439+
"{id=2, title=War and Peace, genre=NOVEL}, " +
440+
"{id=3, title=Anna Karenina, genre=NOVEL}" +
441+
"]}}";
440442

441443
//when
442444
Object result = executor.execute(query).getData();
@@ -504,31 +506,33 @@ public void queryAuthorBooksWithExplictOptional() {
504506
@Test
505507
public void queryAuthorBooksWithExplictOptionalNotLike() {
506508
//given
507-
String query = "query { "
508-
+ "Authors(" +
509-
" where: {" +
510-
" books: {" +
511-
" title: {NOT: {LIKE: \"Th\"}}" +
512-
" }" +
513-
" }" +
514-
" ) {" +
515-
" select {" +
516-
" id" +
517-
" name" +
518-
" books(optional: true) {" +
519-
" id" +
520-
" title(orderBy: ASC)" +
521-
" genre" +
522-
" }" +
523-
" }" +
524-
" }"
525-
+ "}";
526-
527-
String expected = "{Authors={select=["
528-
+ "{id=1, name=Leo Tolstoy, books=["
529-
+ "{id=3, title=Anna Karenina, genre=NOVEL}, "
530-
+ "{id=2, title=War and Peace, genre=NOVEL}]}"
531-
+ "]}}";
509+
String query =
510+
"query { " +
511+
"Authors(" +
512+
" where: {" +
513+
" books: {" +
514+
" title: {NOT: {LIKE: \"Th\"}}" +
515+
" }" +
516+
" }" +
517+
" ) {" +
518+
" select {" +
519+
" id" +
520+
" name" +
521+
" books(optional: true) {" +
522+
" id" +
523+
" title(orderBy: ASC)" +
524+
" genre" +
525+
" }" +
526+
" }" +
527+
" }" +
528+
"}";
529+
530+
String expected =
531+
"{Authors={select=[" +
532+
"{id=1, name=Leo Tolstoy, books=[" +
533+
"{id=3, title=Anna Karenina, genre=NOVEL}, " +
534+
"{id=2, title=War and Peace, genre=NOVEL}]}" +
535+
"]}}";
532536

533537
//when
534538
Object result = executor.execute(query).getData();
@@ -540,33 +544,35 @@ public void queryAuthorBooksWithExplictOptionalNotLike() {
540544
@Test
541545
public void queryAuthorBooksWithExplictOptionalNotLikeConjunction() {
542546
//given
543-
String query = "query { "
544-
+ "Authors(" +
545-
" where: {" +
546-
" books: {" +
547-
" AND: [{title: {NOT: {LIKE: \"War\"}}} {title: {NOT: {LIKE: \"Anna\"}}}]" +
548-
" }" +
549-
" }" +
550-
" ) {" +
551-
" select {" +
552-
" id" +
553-
" name" +
554-
" books(optional: true) {" +
555-
" id" +
556-
" title(orderBy: ASC)" +
557-
" genre" +
558-
" }" +
559-
" }" +
560-
" }"
561-
+ "}";
562-
563-
String expected = "{Authors={select=["
564-
+ "{id=4, name=Anton Chekhov, books=["
565-
+ "{id=5, title=The Cherry Orchard, genre=PLAY}, "
566-
+ "{id=6, title=The Seagull, genre=PLAY}, "
567-
+ "{id=7, title=Three Sisters, genre=PLAY}"
568-
+ "]}"
569-
+ "]}}";
547+
String query =
548+
"query { " +
549+
"Authors(" +
550+
" where: {" +
551+
" books: {" +
552+
" AND: [{title: {NOT: {LIKE: \"War\"}}} {title: {NOT: {LIKE: \"Anna\"}}}]" +
553+
" }" +
554+
" }" +
555+
" ) {" +
556+
" select {" +
557+
" id" +
558+
" name" +
559+
" books(optional: true) {" +
560+
" id" +
561+
" title(orderBy: ASC)" +
562+
" genre" +
563+
" }" +
564+
" }" +
565+
" }" +
566+
"}";
567+
568+
String expected =
569+
"{Authors={select=[" +
570+
"{id=4, name=Anton Chekhov, books=[" +
571+
"{id=5, title=The Cherry Orchard, genre=PLAY}, " +
572+
"{id=6, title=The Seagull, genre=PLAY}, " +
573+
"{id=7, title=Three Sisters, genre=PLAY}" +
574+
"]}" +
575+
"]}}";
570576

571577
//when
572578
Object result = executor.execute(query).getData();

0 commit comments

Comments
 (0)