Skip to content

Commit

Permalink
[quarkusio#29089] Test for Panache Reactive and ORM
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideD committed Nov 10, 2022
1 parent e6164ca commit 9becd8a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,18 @@ public String testProjection() {
long countDistinct = projectionDistinctQuery.count();
Assertions.assertEquals(1L, countDistinct);

// We are checking that not everything gets lowercased
PanacheQuery<CatProjectionBean> letterCaseQuery = Cat
// The spaces at the beginning are intentional
.find(" SELECT disTINct 'GARFIELD', 'JoN ArBuCkLe' from Cat c where name = :NamE group by name ",
Parameters.with("NamE", bubulle.name))
.project(CatProjectionBean.class);

CatProjectionBean catView = letterCaseQuery.firstResult();
// Must keep the letter case
Assertions.assertEquals("GARFIELD", catView.getName());
Assertions.assertEquals("JoN ArBuCkLe", catView.getOwnerName());

Cat.deleteAll();
CatOwner.deleteAll();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,16 @@ public Uni<String> testProjection2() {
Assertions.assertTrue(
exception.getMessage().startsWith("Unable to perform a projection on a 'select new' query"));
})
.chain(() -> Cat
.find(" SELECT disTINct 'GARFIELD', 'JoN ArBuCkLe' from Cat c where name = :NamE group by name ",
Parameters.with("NamE", catName))
.project(CatProjectionBean.class)
.<CatProjectionBean> firstResult())
.invoke(catView -> {
// Must keep the letter case
Assertions.assertEquals("GARFIELD", catView.name);
Assertions.assertEquals("JoN ArBuCkLe", catView.ownerName);
})
.replaceWith("OK");
}

Expand Down

0 comments on commit 9becd8a

Please sign in to comment.