Skip to content

Commit d8c1b96

Browse files
committed
Add test that is failing
1 parent 601bc55 commit d8c1b96

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/java/com/yannbriancon/interceptor/NPlusOneQueriesExceptionTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,15 @@ void nPlusOneQueriesDetection_isNotThrowingExceptionWhenNoNPlusOneQueries() {
6666
.collect(Collectors.toList());
6767
}
6868

69-
7069
@Test
71-
void hibernateQueryInterceptor_isDetectingNPlusOneQueriesWhenMissingEagerFetchingOnManyToOne() {
70+
void nPlusOneQueriesDetection_isNotThrowingExceptionWhenLoopingOnSameMethod() {
71+
for (Long id = 0L; id < 2; id++) {
72+
messageRepository.findById(id);
73+
}
74+
}
7275

76+
@Test
77+
void nPlusOneQueriesDetection_throwsExceptionWhenMissingEagerFetchingOnManyToOne() {
7378
try {
7479
// Test a method that should return a N+1 query
7580
// The query triggers N+1 queries to eager fetch the user field

0 commit comments

Comments
 (0)