Package eu.bandm.tools.test
Class TestFrame<D>
java.lang.Object
eu.bandm.tools.test.TestFrame<D>
Base class with convenience methods for JUnit tests.
Currently we are using "junit 4" = https://junit.org/junit4/"
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionfinal MessageStore<SimpleMessage<D>>
final MessageStore<SimpleMessage<D>>
protected int
protected final MessageCounter
Make it accessible by sub-classes!final MessageStore<SimpleMessage<D>>
final MessageKindFilter<SimpleMessage<D>>
(package private) final MessageFormatter<D>
final MessageReceiver<SimpleMessage<D>>
Shall be used as a receiver of all messages generated by test code.protected final MessageTee<SimpleMessage<D>>
final MessageStore<SimpleMessage<D>>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected 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.protected void
protected void
expectNo()
protected void
protected void
protected void
matchMessages
(MessageStore<SimpleMessage<D>> store, @Opt Pattern<? super Integer> size, Pattern<? super Message>... expectedPrefix) protected String
protected void
printEnd()
protected void
protected void
printStart
(boolean interactive) protected void
requestReturn
(String text) protected static void
writeTmpFile
(File testDir, String fileName, String... lines) Write the strings into a file with the given name in the given directory.protected static File
writeTmpFile
(String fileName, String... lines) Write the string into a file with the given name, in some temp directory.
-
Field Details
-
mcounter
Make it accessible by sub-classes! -
mtee
-
mformatter
-
warnings
-
errors
-
hints
-
messages
-
messagesPrintFilter
-
msg
Shall be used as a receiver of all messages generated by test code. -
interactionNumber
protected int interactionNumber
-
-
Constructor Details
-
TestFrame
public TestFrame()
-
-
Method Details
-
matchMessages
protected void matchMessages(MessageStore<SimpleMessage<D>> store, @Opt @Opt Pattern<? super Integer> size, Pattern<? super Message>... expectedPrefix) -
checkMessages
The string values of the (formatted) messages in the given message store must correspond to the sequence of string constants.- Parameters:
store
- MessageStore to checkexpected
- list of expected string values. A "null" stands for any 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
-
askYes
-
askNo
-
requestReturn
-
writeTmpFile
Write the strings into a file with the given name in the given directory. -
writeTmpFile
Write the string into a file with the given name, in some temp directory.- Returns:
- the temp directory
-