public abstract class AFailFastException extends RuntimeException implements IFailFastException
Exception is a checked exception that would require try-catches, but RuntimeException is not.
To use checked exceptions would be against one of the purposes of the fail-fast principle (to avoid complex try-catch code).
The purpose of this is to ease the burden of concrete implementations.
To extend this in a concrete implementation is optional.
Modifier | Constructor and Description |
---|---|
protected |
AFailFastException(String message) |
protected |
AFailFastException(String message,
Throwable throwable) |
Modifier and Type | Method and Description |
---|---|
Object[] |
getCheckerExtraArguments()
Extra arguments used by the checker implementation.
|
Class<?> |
getCheckerSpecificationType()
The Checker specification type with check-method that asserted.
|
Object[] |
getCheckerUserArguments()
Arguments supplied at the call of the asserting check-method.
|
Object[] |
getFailerExtraArguments()
Extra arguments used by the failer implementation.
|
Class<? extends IFail> |
getFailerSpecificationType()
The Failer specification type with fail-method that produced this
exception.
|
Object[] |
getFailerUserArguments()
Arguments supplied by at the call of the fail-method.
|
String |
getFailMessageArguments()
Comma-separated list of ids of checker-call and failer-call arguments
supplied by either user or implementation.
|
String |
getFailMessageFormat()
Exception message formatting string for thrown exception.
|
void |
setCheckerExtraArguments(Object[] checkerExtraArguments)
Set the Extra arguments used by the checker implementation.
|
void |
setCheckerSpecificationType(Class<?> checkerSpecificationType)
Set the Checker specification type with check-method that asserted.
|
void |
setCheckerUserArguments(Object[] checkerUserArguments)
Sets the arguments supplied at the call of the asserting check-method.
|
void |
setFailerExtraArguments(Object[] failerExtraArguments)
Sets the Extra arguments used by the failer implementation.
|
void |
setFailerMessageArguments(String failMessageArguments)
Sets the comma-separated list of ids of checker-call and failer-call
arguments supplied by either user or implementation.
|
void |
setFailerSpecificationType(Class<? extends IFail> failerSpecificationType)
Sets the Failer specification type with fail-method that produced this
exception.
|
void |
setFailerUserArguments(Object[] failerUserArguments)
Sets the arguments supplied at the call of the fail-method.
|
void |
setMessageFormat(String failMessageFormat)
Sets the exception message formatting string for thrown exception.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
protected AFailFastException(String message)
public Class<?> getCheckerSpecificationType()
IFailFastException
getCheckerSpecificationType
in interface IFailFastException
public void setCheckerSpecificationType(Class<?> checkerSpecificationType)
IFailFastException
setCheckerSpecificationType
in interface IFailFastException
checkerSpecificationType
- Checker specification type with check-method that asserted.public Object[] getCheckerUserArguments()
IFailFastException
getCheckerUserArguments
in interface IFailFastException
public void setCheckerUserArguments(Object[] checkerUserArguments)
IFailFastException
setCheckerUserArguments
in interface IFailFastException
checkerUserArguments
- the arguments supplied at the call of the asserting
check-method.public Object[] getCheckerExtraArguments()
IFailFastException
getCheckerExtraArguments
in interface IFailFastException
public void setCheckerExtraArguments(Object[] checkerExtraArguments)
IFailFastException
setCheckerExtraArguments
in interface IFailFastException
checkerExtraArguments
- Extra arguments used by the checker implementation.public Class<? extends IFail> getFailerSpecificationType()
IFailFastException
getFailerSpecificationType
in interface IFailFastException
public void setFailerSpecificationType(Class<? extends IFail> failerSpecificationType)
IFailFastException
setFailerSpecificationType
in interface IFailFastException
failerSpecificationType
- the Failer specification type with fail-method that produced
this exception.public Object[] getFailerUserArguments()
IFailFastException
getFailerUserArguments
in interface IFailFastException
public void setFailerUserArguments(Object[] failerUserArguments)
IFailFastException
setFailerUserArguments
in interface IFailFastException
failerUserArguments
- the arguments supplied at the call of the fail-method.public Object[] getFailerExtraArguments()
IFailFastException
getFailerExtraArguments
in interface IFailFastException
public void setFailerExtraArguments(Object[] failerExtraArguments)
IFailFastException
setFailerExtraArguments
in interface IFailFastException
failerExtraArguments
- Extra arguments used by the failer implementation.public String getFailMessageFormat()
IFailFastException
failMessageArguments is used to produce an Object[] with this.
An example could be "%s: %s(%s) and %s(%s) are NOT equals".
getFailMessageFormat
in interface IFailFastException
public void setMessageFormat(String failMessageFormat)
IFailFastException
setMessageFormat
in interface IFailFastException
failMessageFormat
- the exception message formatting string for thrown exceptionpublic String getFailMessageArguments()
IFailFastException
This list determines the order and content of an Object[] used with failMessageFormat.
Checker-call argument ids are cu0, cu1, cu2, ... e.g. cu0 being caller, cu1 being referenceA
Failer-call argument ids are fu0, fu1, fu2, ... e.g. fu0 being caller, fu1 being "referenceA"
An example could be "cu0,fu1,cu1,fu2,cu2" to map caller and 2 arguments (both name and value) to failMessageFormat
Checker-implementation argument ids are cx0, cx1, cx2, ... e.g. cx0 being default value used in checker
Failer-implementation argument ids are fx0, fx1, cx2, ... e.g. fx0 being current time supplied by failer
getFailMessageArguments
in interface IFailFastException
public void setFailerMessageArguments(String failMessageArguments)
IFailFastException
setFailerMessageArguments
in interface IFailFastException
failMessageArguments
- comma-separated list of ids of checker-call and failer-call
arguments supplied by either user or implementation.The MIT License (MIT) - Copyright © 2014-2015 Keld Oelykke. All Rights Reserved.