I can see that these observers are correctly recorded in the script result (witnesses with the detailed disclosure checked).
You can’t directly test that the exercise was observed. You can however test if you can observe the consequences. E.g., if the exercise resulted in a create, test that you can try fetching that to make sure that it has been divulged. Note that
queryContractId is not sufficient for that. This will only return contracts you are a stakeholder on. But you can do something like the following:
template Fetcher with stakeholder : Party fetcher : Party where signatory stakeholder choice Fetch : T with cid : ContractId T controller fetcher do fetch cid
stakeholder needs to be a stakeholder of the contract to get past the authorization check. If
fetcher has observed the creation or a fetch of
cid, this will succeed, otherwise it will fail.
@cocreature How would one see an exercise from the Ledger API, would it be visible via the completion api?
Only the transaction tree stream exposes exercise events.
The completion stream is only useful to see if a command that you submitted succeeded or failed but id does not contain the resulting transaction. It does however contain the transaction id so you can use that to query the transaction by id.