DATAREST-632 - Fixed gap in JSON Schema unit tests.
Consolidated constraint tests for JSON Schema test for User and Profile. Original pull request: #192.
This commit is contained in:
committed by
Oliver Gierke
parent
f020127ad7
commit
1bd4e6c7cc
@@ -50,6 +50,7 @@ import com.jayway.jsonpath.JsonPath;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = { MongoDbRepositoryConfig.class, TestConfiguration.class })
|
||||
@@ -84,10 +85,14 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
|
||||
converter = new PersistentEntityToJsonSchemaConverter(entities, mappings, accessor, objectMapper, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-631, DATAREST-632
|
||||
*/
|
||||
@Test
|
||||
public void fulfillsConstraintsForProfile() {
|
||||
|
||||
List<Constraint> constraints = new ArrayList<Constraint>();
|
||||
constraints.add(new Constraint("$.properties.id", is(notNullValue()), "Has descriptor for id property"));
|
||||
constraints.add(new Constraint("$.description", is("Profile description"), "Adds description to schema root"));
|
||||
constraints.add(new Constraint("$.properties.renamed", is(notNullValue()), "Has descriptor for renamed property"));
|
||||
constraints.add(new Constraint("$.properties.aliased", is(nullValue()),
|
||||
@@ -96,10 +101,14 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
|
||||
assertConstraints(Profile.class, constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-632
|
||||
*/
|
||||
@Test
|
||||
public void fulfilsConstraintsForUser() throws Exception {
|
||||
public void fulfillsConstraintsForUser() throws Exception {
|
||||
|
||||
List<Constraint> constraints = new ArrayList<Constraint>();
|
||||
constraints.add(new Constraint("$.properties.id", is(nullValue()), "Does NOT have descriptor for id property"));
|
||||
constraints.add(new Constraint("$.properties.firstname.type", is("string"), "Exposes firstname as String"));
|
||||
constraints.add(new Constraint("$.descriptors.address", is(notNullValue()),
|
||||
"Exposes nested objects as descriptors."));
|
||||
@@ -133,18 +142,6 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
|
||||
assertConstraints(User.class, constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-631
|
||||
*/
|
||||
@Test
|
||||
public void fulfilsConstraintsForProfile() {
|
||||
|
||||
List<Constraint> constraints = new ArrayList<Constraint>();
|
||||
constraints.add(new Constraint("$.properties.id", is(notNullValue()), "Has descriptor for id property"));
|
||||
|
||||
assertConstraints(Profile.class, constraints);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void assertConstraints(Class<?> type, Iterable<Constraint> constraints) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user