com.tibco.cep.runtime.service.tester.beunit

## Class Expecter

- java.lang.Object
- - com.tibco.cep.runtime.service.tester.beunit.Expecter

-     public class Expecter
      extends java.lang.Object

  Base Class for BEUnit Test Suite Expecters.
  Since:
    5.4.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Expecter(BETestEngine engine)` Create a new Expecter object to be used by the unit test engine

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `expect(java.lang.String uri, ExpectationType type)` Expect that the `ExpectationType` operation occurred at least once for any entity specified by `uri` For example: `expect("/Concepts/Person", ExpectationType.CONCEPT_MODIFICATION)` tests whether at least one instance of '/Concepts/Person' has been modified Example 2: `expect("/Events/Fraud", ExpectationType.EVENT_CREATED)` tests whether at least one '/Events/Fraud' has been created
    `void` | `expectEventAsserted(java.lang.String eventUri)` Expect that an Event specified by `eventUri` has been created/asserted
    `void` | `expectEventSent(java.lang.String eventUri)` Expect that an Event specified by `eventUri` has been sent
    `void` | `expectInWorkingMemory(Entity entity)` Expect that the specified Entity currently exists in working memory.
    `void` | `expectInWorkingMemory(java.lang.String uri)` Expect that at least one entity specified by `uri` currently exists in working memory. For example: `expectInWorkingMemory("/Concepts/Person")` tests whether there is an instance of '/Concepts/Person' currently in working memory
    `void` | `expectInWorkingMemoryByExtId(java.lang.String extId)` Expect that at least one entity with the specified `extId` currently exists in working memory. For example: `expectInWorkingMemoryByExtId("MY_ID")` tests whether there is an entity with the extId 'MY_ID' currently in working memory
    `void` | `expectModified(java.lang.String uri)` Expect that a particular entity specified by `uri` has been modified For example, expectModified("/Concepts/Person") will test whether a Person concept has been modified Note that this will test whether any /Concepts/Person instance has been modified To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
    `void` | `expectModified(java.lang.String uri, java.lang.String propertyName)` Expect that a particular property with the name `propertyName` in the entity specified by `uri` has been modified For example, expectModified("/Concepts/Person", "department") will test whether a Person concept has a property named 'department' that has been modified Note that this will test whether any /Concepts/Person instance has been modified To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
    `void` | `expectModified(java.lang.String uri, java.lang.String propertyName, java.lang.Object newValue)` Expect that a particular property with the name `propertyName` in the entity specified by `uri` has been modified, and the new value of the property is equal to `newValue` For example, expectModified("/Concepts/Person", "department", 1234) will test whether a Person concept has a property named 'department' that has been modified to the value '1234' Note that this will test whether any /Concepts/Person has been modified to the expected value.
    `void` | `expectModifiedByExtId(java.lang.String extId)` Expect that a particular entity specified by `extId` has been modified For example, expectModifiedByExtId("MY_ID") will test whether a Concept or Event with the extId equal to "MY_ID" has been modified
    `void` | `expectModifiedByExtId(java.lang.String extId, java.lang.String propertyName)` Expect that a particular property with the name `propertyName` in the entity specified by `extId` has been modified For example, expectModifiedByExtId("MY_ID", "department") will test whether the Entity matching the extId has a property named 'department' that has been modified
    `void` | `expectModifiedByExtId(java.lang.String extId, java.lang.String propertyName, java.lang.Object newValue)` Expect that a particular property with the name `propertyName` in the entity with the matching `extId` has been modified, and the new value of the property is equal to `newValue` For example, expectModifiedByExtId("MY_ID", "department", 1234) will test whether an Entity matching extId 'MY_ID' has a property named 'department' that has been modified to the value '1234'
    `void` | `expectNothing()` Expect that nothing has happened in the current Rule Session.
    `void` | `expectNotInWorkingMemory(Entity entity)` Expect that the specified Entity does not currently exist in working memory.
    `void` | `expectNotInWorkingMemory(java.lang.String uri)` Expect that no entity specified by `uri` currently exists in working memory. For example: `expectNotInWorkingMemory("/Concepts/Person")` tests whether there is an instance of '/Concepts/Person' currently in working memory, and will fail if one is found
    `void` | `expectNotInWorkingMemoryByExtId(java.lang.String extId)` Expect that no entity with the matching `extId` currently exists in working memory. For example: `expectNotInWorkingMemory("MY_ID")` tests whether there is an Event or Concept currently in working memory with the extId of 'MY_ID', and will fail if one is found
    `void` | `expectOnce(java.lang.String uri, ExpectationType type)` Expect that the `ExpectationType` operation occurred only once for any entity specified by `uri` For example: `expectOnce("/Concepts/Person", ExpectationType.CONCEPT_MODIFICATION)` tests whether exactly one instance of '/Concepts/Person' has been modified Example 2: `expectOnce("/Events/Fraud", ExpectationType.EVENT_CREATED)` tests whether exactly one '/Events/Fraud' has been created
    `void` | `expectOrdered(java.util.List ruleURIs, ExpectationType type)` Expect that all rules specified in `ruleURIs` have fired, in a specific order.
    `void` | `expectRuleFired(java.lang.String ruleURI)` Expect that the rule specified by `ruleURI` has fired. For example: `expectRuleFired("/Rules/FraudDetected")` will check whether the rule 'FraudDetected' has fired, and will fail if not
    `void` | `expectScheduled(java.lang.String timeEventUri)` Expect that the Time Event specified by `timeEventUri` has been scheduled.
    `void` | `expectScheduled(java.lang.String timeEventUri, boolean failIfAlreadyFired)` Expect that the Time Event specified by `timeEventUri` has been scheduled.
    `void` | `expectScheduledByExtId(java.lang.String extId)` Expect that the Time Event specified by `timeEventUri` has been scheduled.
    `void` | `expectScheduledByExtId(java.lang.String extId, boolean failIfAlreadyFired)` Expect that the Time Event specified by `timeEventUri` has been scheduled.
    `void` | `expectSomething()` Expect that something has happened in the current Rule Session.
    `void` | `expectUnmodified(java.lang.String uri)` Expect that a particular entity specified by `uri` has not been modified For example, expectUnmodified("/Concepts/Person") will test whether a Person concept has been modified, and will fail if so Note that this will test whether any /Concepts/Person instance has been modified To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
    `void` | `expectUnmodified(java.lang.String uri, java.lang.String propertyName)` Expect that a particular property with the name `propertyName` in the entity specified by `uri` has not been modified For example, expectModified("/Concepts/Person", "department") will test whether a Person concept has a property named 'department' that has been modified, and will fail if so To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
    `void` | `expectUnmodifiedByExtId(java.lang.String extId)` Expect that a particular entity specified by `uri` has not been modified For example, expectUnmodified("/Concepts/Person") will test whether a Person concept has been modified, and will fail if so Note that this will test whether any /Concepts/Person instance has been modified To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
    `void` | `expectUnmodifiedByExtId(java.lang.String extId, java.lang.String propertyName)` Expect that a particular property with the name `propertyName` in the entity specified by `uri` has not been modified For example, expectModified("/Concepts/Person", "department") will test whether a Person concept has a property named 'department' that has been modified, and will fail if so To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
    `void` | `expectUnordered(java.util.List ruleURIs)` Expect that all rules specified in `ruleURIs` have fired, in any order.

- - ### Constructor Detail

    - #### Expecter

          public Expecter(BETestEngine engine)

      Create a new Expecter object to be used by the unit test engine
      Parameters:
        `engine` -

  - ### Method Detail

    - #### expectEventAsserted

          public void expectEventAsserted(java.lang.String eventUri)

      Expect that an Event specified by `eventUri` has been created/asserted
      Parameters:
        `eventUri` - - the Event uri, for example "/Events/FraudDetected"

    - #### expectEventSent

          public void expectEventSent(java.lang.String eventUri)

      Expect that an Event specified by `eventUri` has been sent
      Parameters:
        `eventUri` - - the Event uri, for example "/Events/FraudDetected"

    - #### expectInWorkingMemory

          public void expectInWorkingMemory(Entity entity)

      Expect that the specified Entity currently exists in working memory.
      Parameters:
        `entity` - - an instance of an Entity, typically created from the `TestDataHelper`
      Since:
        5.4

    - #### expectInWorkingMemory

          public void expectInWorkingMemory(java.lang.String uri)

      Expect that at least one entity specified by `uri` currently exists in working memory.
      For example:
      `expectInWorkingMemory("/Concepts/Person")`
      tests whether there is an instance of '/Concepts/Person' currently in working memory
      Parameters:
        `uri` - - the entity uri, for instance "/Concepts/Person"
      Since:
        5.4

    - #### expectModified

          public void expectModified(java.lang.String uri)

      Expect that a particular entity specified by `uri` has been modified For example, expectModified("/Concepts/Person") will test whether a Person concept has been modified
      Note that this will test whether any /Concepts/Person instance has been modified To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
      Parameters:
        `uri` - - the entity uri (i.e. "/Concepts/Person")
      Since:
        5.4

    - #### expectModified

          public void expectModified(java.lang.String uri,
                                     java.lang.String propertyName)

      Expect that a particular property with the name `propertyName` in the entity specified by `uri` has been modified For example, expectModified("/Concepts/Person", "department") will test whether a Person concept has a property named 'department' that has been modified
      Note that this will test whether any /Concepts/Person instance has been modified To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
      Parameters:
        `uri` - - the entity uri (i.e. "/Concepts/Person")
        `propertyName` - - the name of the property to check
      Since:
        5.4

    - #### expectModified

          public void expectModified(java.lang.String uri,
                                     java.lang.String propertyName,
                                     java.lang.Object newValue)

      Expect that a particular property with the name `propertyName` in the entity specified by `uri` has been modified, and the new value of the property is equal to `newValue`
      For example, expectModified("/Concepts/Person", "department", 1234) will test whether a Person concept has a property named 'department' that has been modified to the value '1234'
      Note that this will test whether any /Concepts/Person has been modified to the expected value. To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
      Parameters:
        `uri` - - the entity uri (i.e. "/Concepts/Person")
        `propertyName` - - the name of the property to check
        `newValue` - - the expected new value of the property. If null, then newValue will be ignored and no value check will occur
      Since:
        5.4

    - #### expectInWorkingMemoryByExtId

          public void expectInWorkingMemoryByExtId(java.lang.String extId)

      Expect that at least one entity with the specified `extId` currently exists in working memory.
      For example:
      `expectInWorkingMemoryByExtId("MY_ID")`
      tests whether there is an entity with the extId 'MY_ID' currently in working memory
      Parameters:
        `extId` - - the extId of the entity
      Since:
        5.4

    - #### expectModifiedByExtId

          public void expectModifiedByExtId(java.lang.String extId)

      Expect that a particular entity specified by `extId` has been modified For example, expectModifiedByExtId("MY_ID") will test whether a Concept or Event with the extId equal to "MY_ID" has been modified
      Parameters:
        `extId` - - the extId of the entity
      Since:
        5.4

    - #### expectModifiedByExtId

          public void expectModifiedByExtId(java.lang.String extId,
                                            java.lang.String propertyName)

      Expect that a particular property with the name `propertyName` in the entity specified by `extId` has been modified For example, expectModifiedByExtId("MY_ID", "department") will test whether the Entity matching the extId has a property named 'department' that has been modified
      Parameters:
        `extId` - - the extId of the entity
        `propertyName` - - the name of the property to check
      Since:
        5.4

    - #### expectModifiedByExtId

          public void expectModifiedByExtId(java.lang.String extId,
                                            java.lang.String propertyName,
                                            java.lang.Object newValue)

      Expect that a particular property with the name `propertyName` in the entity with the matching `extId` has been modified, and the new value of the property is equal to `newValue`
      For example, expectModifiedByExtId("MY_ID", "department", 1234) will test whether an Entity matching extId 'MY_ID' has a property named 'department' that has been modified to the value '1234'
      Parameters:
        `extId` - - the extId of the entity
        `propertyName` - - the name of the property to check
        `newValue` - - the expected new value of the property. If null, then newValue will be ignored and no value check will occur
      Since:
        5.4

    - #### expectNothing

          public void expectNothing()

      Expect that nothing has happened in the current Rule Session. This assumes the following:
      - No objects were created
      - No objects were modified
      - No objects were retracted
      - No rules were fired
      Since:
        5.4

    - #### expectNotInWorkingMemory

          public void expectNotInWorkingMemory(Entity entity)

      Expect that the specified Entity does not currently exist in working memory.
      Parameters:
        `entity` - - an instance of an Entity (i.e a Concept or an Event), typically created from the `TestDataHelper`
      Since:
        5.4

    - #### expectNotInWorkingMemory

          public void expectNotInWorkingMemory(java.lang.String uri)

      Expect that no entity specified by `uri` currently exists in working memory.
      For example:
      `expectNotInWorkingMemory("/Concepts/Person")`
      tests whether there is an instance of '/Concepts/Person' currently in working memory, and will fail if one is found
      Parameters:
        `uri` - - the entity uri, for instance "/Concepts/Person"
      Since:
        5.4

    - #### expectNotInWorkingMemoryByExtId

          public void expectNotInWorkingMemoryByExtId(java.lang.String extId)

      Expect that no entity with the matching `extId` currently exists in working memory.
      For example:
      `expectNotInWorkingMemory("MY_ID")`
      tests whether there is an Event or Concept currently in working memory with the extId of 'MY_ID', and will fail if one is found
      Parameters:
        `extId` - - the extId of the entity
      Since:
        5.4

    - #### expectOnce

          public void expectOnce(java.lang.String uri,
                                 ExpectationType type)

      Expect that the `ExpectationType` operation occurred only once for any entity specified by `uri`
      For example:
      `expectOnce("/Concepts/Person", ExpectationType.CONCEPT_MODIFICATION)`
      tests whether exactly one instance of '/Concepts/Person' has been modified
      Example 2:
      `expectOnce("/Events/Fraud", ExpectationType.EVENT_CREATED)`
      tests whether exactly one '/Events/Fraud' has been created
      Parameters:
        `uri` - - the entity uri, for instance "/Concepts/Person"
        `type` - - the `ExpectationType` operation
      Since:
        5.4

    - #### expect

          public void expect(java.lang.String uri,
                             ExpectationType type)

      Expect that the `ExpectationType` operation occurred at least once for any entity specified by `uri`
      For example:
      `expect("/Concepts/Person", ExpectationType.CONCEPT_MODIFICATION)`
      tests whether at least one instance of '/Concepts/Person' has been modified
      Example 2:
      `expect("/Events/Fraud", ExpectationType.EVENT_CREATED)`
      tests whether at least one '/Events/Fraud' has been created
      Parameters:
        `uri` - - the entity uri, for instance "/Concepts/Person"
        `type` - - the `ExpectationType` operation
      Since:
        5.4

    - #### expectOrdered

          public void expectOrdered(java.util.List ruleURIs,
                                    ExpectationType type)

      Expect that all rules specified in `ruleURIs` have fired, in a specific order. For example:
      `engine.executeRules();
      List rules = new ArrayList();
      rules.add("/Rules/ProcessApplication");
      rules.add("/Rules/FraudDetected");
      expecter.expectOrdered(rules, ExpectationType.RULE_EXECUTION);
      `
      will test whether the rule 'ProcessApplication' fired before the 'FraudDetected' rule, and will fail if any of the rules did not fire, or if the order of the executed rules differs from the specified order
      Parameters:
        `ruleURIs` - - a List of Strings corresponding to the expected order of rule execution
      Since:
        5.4

    - #### expectRuleFired

          public void expectRuleFired(java.lang.String ruleURI)

      Expect that the rule specified by `ruleURI` has fired.
      For example: `expectRuleFired("/Rules/FraudDetected")` will check whether the rule 'FraudDetected' has fired, and will fail if not
      Parameters:
        `ruleURI` - - the uri of the rule, for instance "/Rules/FraudDetected"
      Since:
        5.4

    - #### expectScheduled

          public void expectScheduled(java.lang.String timeEventUri)

      Expect that the Time Event specified by `timeEventUri` has been scheduled. Convenience method. This is fully equivalent to `expectScheduled(timeEventUri, false)`
      Parameters:
        `timeEventUri` - - the Time Event uri, for instance "/Events/ScheduledPaymentEvent"
      Since:
        5.4

    - #### expectScheduledByExtId

          public void expectScheduledByExtId(java.lang.String extId)

      Expect that the Time Event specified by `timeEventUri` has been scheduled. Convenience method. This is fully equivalent to `expectScheduled(timeEventUri, false)`
      Parameters:
        `extId` - - the extId of the Time Event
      Since:
        5.4

    - #### expectScheduled

          public void expectScheduled(java.lang.String timeEventUri,
                                      boolean failIfAlreadyFired)

      Expect that the Time Event specified by `timeEventUri` has been scheduled. If `failIfAlreadyFired` is set to true, an AssertionError will be thrown if the Time Event was scheduled but has already fired
      Parameters:
        `timeEventUri` - - the Time Event uri, for instance "/Events/ScheduledPaymentEvent"
        `failIfAlreadyFired` - - if true, an AssertionError will be thrown if the Time Event was scheduled but has already fired
      Since:
        5.4

    - #### expectScheduledByExtId

          public void expectScheduledByExtId(java.lang.String extId,
                                             boolean failIfAlreadyFired)

      Expect that the Time Event specified by `timeEventUri` has been scheduled. If `failIfAlreadyFired` is set to true, an AssertionError will be thrown if the Time Event was scheduled but has already fired
      Parameters:
        `extId` - - the extId of the Time Event
        `failIfAlreadyFired` - - if true, an AssertionError will be thrown if the Time Event was scheduled but has already fired
      Since:
        5.4

    - #### expectSomething

          public void expectSomething()

      Expect that something has happened in the current Rule Session. This assumes the following:
      - At least one object was created, OR
      - At least one object was modified, OR
      - At least one object was retracted, OR
      - At least one rule was fired
      Since:
        5.4

    - #### expectUnmodified

          public void expectUnmodified(java.lang.String uri)

      Expect that a particular entity specified by `uri` has not been modified For example, expectUnmodified("/Concepts/Person") will test whether a Person concept has been modified, and will fail if so
      Note that this will test whether any /Concepts/Person instance has been modified To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
      Parameters:
        `uri` - - the entity uri (i.e. "/Concepts/Person")
      Since:
        5.4

    - #### expectUnmodified

          public void expectUnmodified(java.lang.String uri,
                                       java.lang.String propertyName)

      Expect that a particular property with the name `propertyName` in the entity specified by `uri` has not been modified For example, expectModified("/Concepts/Person", "department") will test whether a Person concept has a property named 'department' that has been modified, and will fail if so
      To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
      Parameters:
        `uri` - - the entity uri (i.e. "/Concepts/Person")
        `propertyName` - - the name of the property to check
      Since:
        5.4

    - #### expectUnmodifiedByExtId

          public void expectUnmodifiedByExtId(java.lang.String extId)

      Expect that a particular entity specified by `uri` has not been modified For example, expectUnmodified("/Concepts/Person") will test whether a Person concept has been modified, and will fail if so
      Note that this will test whether any /Concepts/Person instance has been modified To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
      Parameters:
        `extId` - - the extId of the entity
      Since:
        5.4

    - #### expectUnmodifiedByExtId

          public void expectUnmodifiedByExtId(java.lang.String extId,
                                              java.lang.String propertyName)

      Expect that a particular property with the name `propertyName` in the entity specified by `uri` has not been modified For example, expectModified("/Concepts/Person", "department") will test whether a Person concept has a property named 'department' that has been modified, and will fail if so
      To test a specific entity instance, use the `expectModified(String uri, String propertyName, Object newValue, String extId)` method instead
      Parameters:
        `extId` - - the extId of the entity
        `propertyName` - - the name of the property to check
      Since:
        5.4

    - #### expectUnordered

          public void expectUnordered(java.util.List ruleURIs)

      Expect that all rules specified in `ruleURIs` have fired, in any order. For example:
      `engine.executeRules();
      List rules = new ArrayList();
      rules.add("/Rules/ProcessApplication");
      rules.add("/Rules/FraudDetected");
      `
      Will test whether the rules 'ProcessApplication' and 'FraudDetected' have fired, in any order, and will fail if any of the rules did not fire
      Parameters:
        `ruleURIs` - - a List of Strings corresponding to the expected rules
      Since:
        5.4