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 7, 2022
1 parent 27a5641 commit 0435c97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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), Sort.by("name"))
.project(CatProjectionBean.class);

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

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

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

Expand Down

0 comments on commit 0435c97

Please sign in to comment.