DATAREST-1006 - Polishing.
Added unit test on MappingProperties directly. Original pull request: #258.
This commit is contained in:
@@ -24,6 +24,7 @@ import org.springframework.data.mapping.PersistentEntity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty.Access;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
@@ -67,11 +68,19 @@ public class MappedPropertiesUnitTests {
|
||||
assertThat(properties.getMappedName(entity.getRequiredPersistentProperty("emailAddress"))).isEqualTo("email");
|
||||
}
|
||||
|
||||
@Test // DATAREST-1006
|
||||
public void doesNotExposeIgnoredPropertyViaJsonProperty() {
|
||||
|
||||
assertThat(properties.hasPersistentPropertyForField("readOnlyProperty")).isFalse();
|
||||
assertThat(properties.getPersistentProperty("readOnlyProperty")).isNull();
|
||||
}
|
||||
|
||||
static class Sample {
|
||||
|
||||
public @Transient String notExposedBySpringData;
|
||||
public @JsonIgnore String notExposedByJackson;
|
||||
public String exposedProperty;
|
||||
public @JsonProperty("email") String emailAddress;
|
||||
public @JsonProperty(access = Access.READ_ONLY) String readOnlyProperty;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user