Set error pattern using setErrorPattern method and call mayFail method anywhere you expect an exception to be thrown. By default BridgeException will be thrown but you can extend ErrorGenerator with your own version of mayFail (which should be named differently or have otherwise different signature) and use shouldFail method as an indicator that a failure should occur.
To differentiate between several error generators setName method can be used to give it a distinctive name. This name will be mentioned in generated exceptions.
Since error generators are designed to be used at development and testing time they must be explicitly enabled by setting system property lt.baltic_amadeus.jqbridge.util.ErrorGenerator and listing any generator names that should be enabled. Generators with a name set to null are enabled as long as a system property exists. If this property is not set ErrorGenerators will never throw an exception and can be safely left in production code.
@author Baltic Amadeus, JSC
@author Antanas Kompanas
| |
| |