public abstract class ACallContract extends Object implements ICallContract
The purpose of this is to ease the burden of concrete implementations.
To extend this in a concrete implementation is optional.
Constructor and Description |
---|
ACallContract() |
Modifier and Type | Method and Description |
---|---|
IChecker |
getAssertingChecker()
The checker with asserting check-method.
|
Object |
getCaller()
The caller that called asserting check-method and therefore must call fail-method.
|
Object[] |
getCheckArguments()
The arguments supplied the asserting check-method by the caller.
|
Object[] |
getCheckExtraArguments()
The extra arguments supplied by the asserting check-method implementation.
|
Class<? extends ICheck> |
getCheckSpecification()
The check specification (interface) with specification of asserting check-method.
|
Class<? extends RuntimeException> |
getCustomFailExceptionTypeOrNull()
Retrieves a custom exception class, if set, that fail-method should throw instead of the default class set in attribute of fail-method.
|
String |
getCustomFailMessageArgumentsOrNull()
Retrieves custom message arguments, if set, that fail-method should use instead of the
default arguments set in attribute of fail-method.
|
String |
getCustomFailMessageFormatOrNull()
Retrieves custom message format, if set, that fail-method should use instead of the
default format set in attribute of fail-method.
|
String |
getCustomFailMessagePostfixOrNull()
Retrieves a custom message postfix, if set, that will be added the exception message.
|
Class<? extends IFail> |
reflectFailSpecificationType()
Reflects the fail specification (interface) that should be used to end this contract.
|
void |
setAssertingChecker(IChecker assertingChecker)
The checker with asserting check-method.
|
void |
setCaller(Object caller)
The caller that called asserting check-method and therefore must call fail-method.
|
void |
setCheckArguments(Object[] checkArguments)
The arguments supplied the asserting check-method by the caller.
|
void |
setCheckExtraArguments(Object[] checkExtraArguments)
The extra arguments supplied by the asserting check-method implementation.
|
void |
setCheckSpecification(Class<? extends ICheck> checkSpecification)
The check specification (interface) with specification of asserting check-method.
|
void |
setCustomFailExceptionType(Class<? extends RuntimeException> failExceptionType)
Sets a custom exception class that fail-method should throw instead of
the default class set in attribute of fail-method.
|
void |
setCustomFailMessageArguments(String failMessageArguments)
Sets custom message arguments that fail-method should use instead of the
default arguments set in attribute of fail-method.
|
void |
setCustomFailMessageFormat(String failMessageFormat)
Sets custom message format that fail-method should use instead of the
default format set in attribute of fail-method.
|
void |
setCustomFailMessagePostfix(String failMessagePostfix)
Sets a custom message postfix that will be added the exception message of the exception to throw.
|
void |
validateContractData()
Validates the contract data e.g.
|
public Object getCaller()
ICallContract
getCaller
in interface ICallContract
public void setCaller(Object caller)
ICallContract
setCaller
in interface ICallContract
caller
- caller that called asserting check-method and therefore must call fail-methodpublic IChecker getAssertingChecker()
ICallContract
getAssertingChecker
in interface ICallContract
public void setAssertingChecker(IChecker assertingChecker)
ICallContract
setAssertingChecker
in interface ICallContract
assertingChecker
- checker with asserting check-methodpublic Class<? extends ICheck> getCheckSpecification()
ICallContract
The checkSpecification is annotated with a fail specification that needs to be called by the caller to end this contract.
getCheckSpecification
in interface ICallContract
public void setCheckSpecification(Class<? extends ICheck> checkSpecification)
ICallContract
The checkSpecification is annotated with a fail specification that needs to be called by the caller to end this contract.
setCheckSpecification
in interface ICallContract
checkSpecification
- check specification (interface) with specification of asserting check-methodpublic Object[] getCheckArguments()
ICallContract
getCheckArguments
in interface ICallContract
public void setCheckArguments(Object[] checkArguments)
ICallContract
setCheckArguments
in interface ICallContract
checkArguments
- arguments supplied the asserting check-method by the callerpublic Object[] getCheckExtraArguments()
ICallContract
getCheckExtraArguments
in interface ICallContract
public void setCheckExtraArguments(Object[] checkExtraArguments)
ICallContract
setCheckExtraArguments
in interface ICallContract
checkExtraArguments
- extra arguments supplied by the asserting check-method implementationpublic void validateContractData()
ICallContract
validateContractData
in interface ICallContract
public Class<? extends IFail> reflectFailSpecificationType()
ICallContract
reflectFailSpecificationType
in interface ICallContract
public Class<? extends RuntimeException> getCustomFailExceptionTypeOrNull()
ICallContract
getCustomFailExceptionTypeOrNull
in interface ICallContract
public void setCustomFailExceptionType(Class<? extends RuntimeException> failExceptionType)
ICallContract
If failExceptionType inherits
If failExceptionType does not inherit
setCustomFailExceptionType
in interface ICallContract
failExceptionType
- a custom exception class that fail-method should throwpublic String getCustomFailMessageFormatOrNull()
ICallContract
getCustomFailMessageFormatOrNull
in interface ICallContract
public void setCustomFailMessageFormat(String failMessageFormat)
ICallContract
setCustomFailMessageFormat
in interface ICallContract
failMessageFormat
- custom message format that fail-method should usepublic String getCustomFailMessageArgumentsOrNull()
ICallContract
getCustomFailMessageArgumentsOrNull
in interface ICallContract
public void setCustomFailMessageArguments(String failMessageArguments)
ICallContract
setCustomFailMessageArguments
in interface ICallContract
failMessageArguments
- custom message arguments that fail-method should usepublic String getCustomFailMessagePostfixOrNull()
ICallContract
getCustomFailMessagePostfixOrNull
in interface ICallContract
public void setCustomFailMessagePostfix(String failMessagePostfix)
ICallContract
setCustomFailMessagePostfix
in interface ICallContract
The MIT License (MIT) - Copyright © 2014-2015 Keld Oelykke. All Rights Reserved.