Package org.alfresco.rest.core.assertion
Class ModelAssertion<T>
java.lang.Object
org.alfresco.rest.core.assertion.ModelAssertion<T>
Assertion on Rest Model
Just pass your rest model as constructor
- Author:
- Paul Brodner
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassDSL assertion on Rest Model fieldsstatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidcheckFieldIsPresent(Object fieldNameToBeRetuned, Object fieldValueToBeRetuned) Use this DSL for asserting particular fields of your model if your model is like this (basic POJO) public class Person extends ModelAssertion{ private String id = "1234"; } you can use assert the id of this person as: Person p = new Person(); p.assertThat().field("id").is("1234") Use this method for asserting whole model with different model object.
-
Constructor Details
-
ModelAssertion
-
-
Method Details
-
checkFieldIsPresent
-
field
Use this DSL for asserting particular fields of your model if your model is like this (basic POJO) public class Person extends ModelAssertion{ private String id = "1234"; } you can use assert the id of this person as: Person p = new Person(); p.assertThat().field("id").is("1234") - Parameters:
fieldName-- Returns:
- Throws:
IllegalStateException- If the field cannot be converted to JSON.
-
fieldsCount
-
isEqualTo
Use this method for asserting whole model with different model object. Method allows to ignore particular fields during the comparison. WARNING: For proper work model should implementtoString()andequals()methods.- Parameters:
expected- - expected model.ignoreFields- - fields which should be ignored during assertion.- Returns:
- model.
-