Class MessageTester<D>

java.lang.Object
eu.bandm.tools.testsupport.MessageTester<D>
Type Parameters:
D - the document identifier used by the locations
All Implemented Interfaces:
MessageReceiver<SimpleMessage<D>>, Consumer<SimpleMessage<D>>

public class MessageTester<D> extends Object implements MessageReceiver<SimpleMessage<D>>
A message receiver which provides filtering, counting, analyzing of the received messages, for test purposes. For test driven debugging, the filtered messages can be printed for the programmer.
  • Field Details

  • Constructor Details

    • MessageTester

      public MessageTester()
  • Method Details

    • receive

      public void receive(SimpleMessage<D> msg)
      Description copied from interface: MessageReceiver
      Receive the given message.
      Specified by:
      receive in interface MessageReceiver<D>
      Parameters:
      msg - the message to receive.
    • setTracelevel

      public void setTracelevel(int level)
    • setPrintFilter

      public void setPrintFilter(Message.Kind... kinds)
    • setPrintFilter

      public void setPrintFilter(EnumSet<Message.Kind> set)
    • showWarningsErrorsAndHints

      public void showWarningsErrorsAndHints()
    • showWarningsAndErrors

      public void showWarningsAndErrors()
    • checkMessages

      public void checkMessages(MessageStore<SimpleMessage<D>> store, @Opt String... expected)
      The string values of the (formatted) messages in the given message store must correspond to the sequence of string constants.

      If the expected value contains guilemets »...« it must not contain double quotes. If the actual value contains double quotes (= comes from an older version of the tested software), all guilemets in the expected value are replaced by double quotes.

      Parameters:
      store - MessageStore to check
      expected - list of expected string values. A null value stands for any string.
    • checkMessagesPrefix

      public void checkMessagesPrefix(MessageStore<SimpleMessage<D>> store, @Opt String... expected)