Class ModelAssertion<T>

java.lang.Object
org.alfresco.rest.core.assertion.ModelAssertion<T>

public class ModelAssertion<T> extends Object
Assertion on Rest Model Just pass your rest model as constructor
Author:
Paul Brodner
  • Constructor Details

    • ModelAssertion

      public ModelAssertion(Object model)
  • Method Details

    • checkFieldIsPresent

      protected static void checkFieldIsPresent(Object fieldNameToBeRetuned, Object fieldValueToBeRetuned)
    • field

      public ModelAssertion<T>.AssertionVerbs field(String fieldName)
      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

      public ModelAssertion<T>.AssertionItemVerbs fieldsCount()
    • isEqualTo

      public T isEqualTo(T expected, String... ignoreFields)
      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 implement toString() and equals() methods.
      Parameters:
      expected - - expected model.
      ignoreFields - - fields which should be ignored during assertion.
      Returns:
      model.