DATACMNS-380 - MappingContext.getPersistentPropertyPath(…) now throws MappingException.
This commit is contained in:
@@ -223,7 +223,7 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
P persistentProperty = current.getPersistentProperty(segment);
|
||||
|
||||
if (persistentProperty == null) {
|
||||
throw new IllegalArgumentException(String.format("No property %s found on %s!", segment, current.getName()));
|
||||
throw new MappingException(String.format("No property %s found on %s!", segment, current.getName()));
|
||||
}
|
||||
|
||||
result.add(persistentProperty);
|
||||
|
||||
@@ -185,6 +185,14 @@ public class AbstractMappingContextUnitTests {
|
||||
assertThat(path.getLeafProperty().getName(), is("name"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-380
|
||||
*/
|
||||
@Test(expected = MappingException.class)
|
||||
public void rejectsInvalidPropertyReferenceWithMappingException() {
|
||||
context.getPersistentPropertyPath("foo", Sample.class);
|
||||
}
|
||||
|
||||
class Person {
|
||||
String name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user