Class TestFrame<D>

java.lang.Object
eu.bandm.tools.test.TestFrame<D>

public class TestFrame<D> extends Object
Base class with convenience methods for JUnit tests. Currently we are using "junit 4" = https://junit.org/junit4/"
  • Field Details

  • Constructor Details

    • TestFrame

      public TestFrame()
  • Method Details

    • filesystemRelativeProjectRoot

      public static String filesystemRelativeProjectRoot(Class cl)
      Assumes that all class source is under "$(PRJ)/src/..." or "$(PRJ)/test".
      Returns:
      the relative path to the root of the project.
    • setTracelevel

      public void setTracelevel(int level)
    • setPrintFilter

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

      protected void showWarningsErrorsAndHints()
    • showWarningsAndErrors

      protected void showWarningsAndErrors()
    • matchMessages

      protected void matchMessages(MessageStore<SimpleMessage<D>> store, @Opt @Opt Pattern<? super Integer> size, Pattern<? super Message>... expectedPrefix)
    • checkMessages

      protected void checkMessages(MessageStore<SimpleMessage<D>> store, @Opt @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 uses guilemets »...« it is assumed NOT to use double quotes. If the actual value uses double quotes (= is an OLDER version), all guilemets in the expected value are replaced by double quotes.

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

      protected String methodName()
    • printStart

      protected void printStart()
    • printStart

      protected void printStart(boolean interactive)
    • printEnd

      protected void printEnd()
    • expectYes

      protected void expectYes()
    • expectNo

      protected void expectNo()
    • incrementAndPrintInteractionNumber

      protected void incrementAndPrintInteractionNumber()
    • doit

      protected void doit(String text)
    • askYes

      protected void askYes(String text)
    • askNo

      protected void askNo(String text)
    • requestReturn

      protected void requestReturn(String text)
    • writeTmpFile

      protected static void writeTmpFile(File testDir, String fileName, String... lines)
      Write the strings into a file with the given name in the given directory.
    • writeTmpFile

      protected static File writeTmpFile(String fileName, String... lines)
      Write the string into a file with the given name, in some temp directory.
      Returns:
      the temp directory