Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (32 sloc) 2.43 KB

Build Status Maven Central Apache License 2.0

This Concordion extension provides the capability 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.

The demo project demonstrates this extension using Concordion with Selenium WebDriver.

Installation

The extension is available from Maven Central.

Introduction

The easiest way to configure is to use the @Extension annotation on an instance field of type ExceptionTranslatorExtension within the fixture class.

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 ExceptionTranslatorExtension(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;
            }
        }

Further info