stariy95 commented on code in PR #550:
URL: https://github.com/apache/cayenne/pull/550#discussion_r1057613533
##########
cayenne-server/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesIT.java:
##########
@@ -233,87 +234,143 @@ public void testSelectColumnQuery() throws Exception {
ColumnSelect<CompoundPaintingLongNames> originalQuery =
ObjectSelect.query(CompoundPaintingLongNames.class)
.column(CompoundPaintingLongNames.SELF);
- CompoundPaintingLongNames beforeCompoundPainting =
originalQuery.selectFirst(context);
+ CompoundPaintingLongNames beforeCompoundPainting =
originalQuery.select(context)
Review Comment:
I think it could be easier to update test code, to be sure we have single
entry in the DB. Something like `tArtist.deleteAll(); tPainting.deleteAll();`
calls before test data creation should do the trick.
##########
cayenne-server/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesIT.java:
##########
@@ -233,87 +234,143 @@ public void testSelectColumnQuery() throws Exception {
ColumnSelect<CompoundPaintingLongNames> originalQuery =
ObjectSelect.query(CompoundPaintingLongNames.class)
.column(CompoundPaintingLongNames.SELF);
- CompoundPaintingLongNames beforeCompoundPainting =
originalQuery.selectFirst(context);
+ CompoundPaintingLongNames beforeCompoundPainting =
originalQuery.select(context)
+ .stream()
+ .filter(c -> c.getArtistLongName().equals("artist1"))
+ .findFirst()
+ .orElseThrow();
String beforeArtistNameFromContext =
beforeCompoundPainting.getArtistLongName();
String beforePaintingTitleFromContext =
beforeCompoundPainting.getPaintingTitle();
- Object beforeArtistNameFromDatabase = tArtist.selectAll().get(0)[1];
- Object beforePaintingTitleFromDatabase =
tPainting.selectAll().get(0)[1];
+ String beforeArtistNameFromDatabase = tArtist.selectAll().stream()
Review Comment:
Like a comment above, resetting DB state could make this part (and all
similar bellow) much cleaner.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]