Translator Extension
Introduction
This extension provides the ability to modify exception message text. While initially created to remove superfluous debug information from WebDriver exception messages, it could be used for translating exception messages to other languages.
Configuration
The easiest way to configure is to use the @Extension annotation on an TranslatorExtension instance field within the fixture class. For example:
For example, the following code configures the extension to remove text from the exception message starting from the string "Debug info:".
@Extension
public ConcordionExtension extension =
new TranslatorExtension(new ExampleMessageTranslator());
where ExampleMessageTranslator is:
public class ExampleMessageTranslator() implements MessageTranslator {
@Override
public String translate(String originalMessage) {
int debugInfoStart = originalMessage.indexOf("Build info:");
if (debugInfoStart > 0) {
return originalMessage.substring(0, debugInfoStart);
}
return originalMessage;
}
}
Specification
See also the translator specification.