I have made a java project, and use H2 for first time to test my program. I am using H2 to run my Junit & cucumber test.
I have a query which get data from few tables.
SELECT film.TITLE, film.DIRECTOR, cinema.LOCATION, cinema.THEATER_NAME, SUM(income.NUMBER_VIEW)
FROM DRFGIRF7B_OPE.MOVIE as film
INNER JOIN DRFGIRF7B_OPE.MOVIE_THEATER as income ON film.FILM_ID = income.FILM_ID
INNER JOIN DRFGIRF7B_OPE.THEATER as cinema ON income.THEATER_ID = cinema.THEATER_ID
WHERE film.COUNTRY_COD = 'FRA'
GROUP BY film.TITLE, film.DIRECTOR, cinema.LOCATION;
Here, "cinema.THEATER_NAME" is missing of GROUP BY statement. When I execute this query in a SQL IDE, I have this error message (which was expected) :
SQL Failed : Selected non-aggregate values must be part of the assiociated group
But a soon as I am running my test with Junit, H2 does not detect this issue, and all my tests pass, whereas the query is called.
Do you have an idea, why my test does not fail ?