DATACMNS-840 - Repository query methods returning enums are not considered projecting now.
This commit is contained in:
@@ -299,6 +299,7 @@ public abstract class ReturnedType {
|
||||
|
||||
private boolean isDto() {
|
||||
return !Object.class.equals(type) && //
|
||||
!type.isEnum() && //
|
||||
!isDomainSubtype() && //
|
||||
!isPrimitiveOrWrapper() && //
|
||||
!Number.class.isAssignableFrom(type) && //
|
||||
|
||||
@@ -142,6 +142,18 @@ public class ReturnedTypeUnitTests {
|
||||
assertThat(type.needsCustomConstruction(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-840
|
||||
*/
|
||||
@Test
|
||||
public void doesNotConsiderAnEnumProjecting() throws Exception {
|
||||
|
||||
ReturnedType type = getReturnedType("findEnum");
|
||||
|
||||
assertThat(type.needsCustomConstruction(), is(false));
|
||||
assertThat(type.isProjecting(), is(false));
|
||||
}
|
||||
|
||||
private static ReturnedType getReturnedType(String methodName, Class<?>... parameters) throws Exception {
|
||||
return getQueryMethod(methodName, parameters).getResultProcessor().getReturnedType();
|
||||
}
|
||||
@@ -176,6 +188,12 @@ public class ReturnedTypeUnitTests {
|
||||
BigInteger countQuery();
|
||||
|
||||
SampleDtoWithMultipleConstructors dtoWithMultipleConstructors();
|
||||
|
||||
MyEnum findEnum();
|
||||
|
||||
static enum MyEnum {
|
||||
VALUE
|
||||
}
|
||||
}
|
||||
|
||||
static class Sample {
|
||||
|
||||
Reference in New Issue
Block a user