DATACMNS-1200 - Guard casts to primitive type in ClassGeneratingEntityInstantiator.
We now insert assertions for primitive types before passing these to the actual constructor to prevent NullPointerExceptions. We also output the index/parameter name if the parameter was null. Original pull request: #255.
This commit is contained in:
committed by
Oliver Gierke
parent
32536067f1
commit
78bd8fb0f7
@@ -264,6 +264,17 @@ public class ClassGeneratingEntityInstantiatorUnitTests<P extends PersistentProp
|
||||
});
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1200
|
||||
public void instantiateObjectCtor1ParamIntWithoutValue() {
|
||||
|
||||
doReturn(ObjectCtor1ParamInt.class).when(entity).getType();
|
||||
doReturn(PreferredConstructorDiscoverer.discover(ObjectCtor1ParamInt.class))//
|
||||
.when(entity).getPersistenceConstructor();
|
||||
|
||||
assertThatThrownBy(() -> this.instance.createInstance(entity, provider)) //
|
||||
.hasCauseInstanceOf(IllegalArgumentException.class);
|
||||
}
|
||||
|
||||
@Test // DATACMNS-578, DATACMNS-1126
|
||||
@SuppressWarnings("unchecked")
|
||||
public void instantiateObjectCtor7ParamsString5IntsString() {
|
||||
|
||||
Reference in New Issue
Block a user