Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added passing @NotNull validation test

  • Loading branch information...
commit a1675900cb5e602e466cad0ba806c76646a1519f 1 parent 39483b3
@jexp jexp authored
View
6 ...est/java/org/springframework/data/neo4j/aspects/support/EntityPropertyValidationTest.java
@@ -21,6 +21,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.neo4j.model.NonNullNamed;
import org.springframework.data.neo4j.support.Neo4jTemplate;
import org.springframework.data.neo4j.support.node.Neo4jHelper;
import org.springframework.test.context.ContextConfiguration;
@@ -63,4 +64,9 @@ public void shouldFailValidationOnNegativeAge() {
public void shouldFailValidationOnBigAge() {
persistedPerson("Michael", 110);
}
+ @Test(expected = ValidationException.class)
+ @Transactional
+ public void shouldFailValidationOnNullName() {
+ template.save(new NonNullNamed());
+ }
}
View
16 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/model/NonNullNamed.java
@@ -0,0 +1,16 @@
+package org.springframework.data.neo4j.model;
+
+import org.springframework.data.neo4j.annotation.GraphId;
+import org.springframework.data.neo4j.annotation.Indexed;
+import org.springframework.data.neo4j.annotation.NodeEntity;
+
+import javax.validation.constraints.NotNull;
+
+@NodeEntity
+public class NonNullNamed {
+ @GraphId
+ private Long graphId;
+
+ @NotNull
+ private String name;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.