Allow null arguments in method calls to DyanmicProxyable repositories.
Closes #2025. Signed-off-by: mikereiche <michael.reiche@couchbase.com>
This commit is contained in:
@@ -74,6 +74,8 @@ public class FindMethod {
|
||||
continue;
|
||||
if(params[j] == boolean.class && parameterTypes[j] == Boolean.class )
|
||||
continue;
|
||||
if(parameterTypes[j] == null && Object.class.isAssignableFrom(params[j])) // any non-primitive
|
||||
continue;
|
||||
if (!params[j].isAssignableFrom(parameterTypes[j]))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.data.couchbase.repository;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@@ -141,7 +142,20 @@ public class ReactiveCouchbaseRepositoryQueryIntegrationTests extends JavaIntegr
|
||||
Airport airport1 = reactiveAirportRepository.findById(airports.get(0).getId()).block();
|
||||
assertEquals(airport1.getIata(), vie.getIata());
|
||||
Airport airport2 = reactiveAirportRepository.findByIata(airports.get(0).getIata()).block();
|
||||
assertEquals(airport1.getId(), vie.getId());
|
||||
assertEquals(airport2.getId(), vie.getId());
|
||||
} finally {
|
||||
reactiveAirportRepository.delete(vie).block();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNullParamToDyanmicProxyable() {
|
||||
Airport vie = null;
|
||||
try {
|
||||
vie = new Airport("airports::vie", "vie", "low2");
|
||||
reactiveAirportRepository.save(vie).block();
|
||||
Airport airport2 = reactiveAirportRepository.withCollection("_default").findByIata(null).block();
|
||||
assertNull(airport2);
|
||||
} finally {
|
||||
reactiveAirportRepository.delete(vie).block();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user