Subject: BDD Testing MessageService

Thanks for the work-around!  Very helpful and reveals how easy it is to
override a domain service.  I created a StubMessageService class in the
domainapp.modules.simple.specglue package:

@DomainService(menuOrder = "1")
public class StubMessageService extends MessageServiceDefault {
   @Getter  @Setter
    private String informMessage;
    @Getter @Setter
    private String warnMessage;
    @Getter @Setter
    private String errorMessage;

    public void informUser(String message) {
... // same for warnUser and raiseError methods

Injecting this service into my glue class, I check getInformMessage() to
see if the message was sent.

I like how Apache Isis maps out a lot of the aspects needed to work a
robust application development project.  It would be great if tests had a
MessageService available by default that you can query for feature examples
that involve user messages.  Maybe the same for the other domain services
(EmailService, audit service?).   Maybe have a higher level testing or
history service to review the service calls as command objects.

I am uncertain if I should be testing for exceptions in the spec tests, so
I'm testing for actions the application takes to handle them.  The language
to implement a Gherkin example to check for an exception seems bit odd to

Given expecting an exception
When user submits form
Then expected exception is thrown

As a manual tester following this test case, I guess I'd get a net ready?

I'm thinking that testing for an expected exception might belong in a JUnit
unit or integration test, not as spec glue.  The user message or any other
action to handle the exception, on the other hand, can be described
fluently with Gherkin.

Thanks again!

On Mon, Sep 10, 2018 at 11:13 PM Dan Haywood <[EMAIL PROTECTED]>