Class IntExceptionGenerator
- java.lang.Object
-
- ru.ispras.testbase.knowledge.integer.IntExceptionGenerator
-
- All Implemented Interfaces:
Generator<IntNumber,IntException>
- Direct Known Subclasses:
IntAddExceptionGenerator
,IntSubExceptionGenerator
public abstract class IntExceptionGenerator extends java.lang.Object implements Generator<IntNumber,IntException>
IntExceptionGenerator
is a base interface for random generators targeted at the integer arithmetic exceptions.
-
-
Constructor Summary
Constructors Constructor Description IntExceptionGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
check(IntException situation, IntNumber[] operands)
Checks the test data against the test situation.protected abstract boolean
checkNormal(IntNumber[] operands)
Checks whether the operation does not cause exceptions.protected abstract boolean
checkOverflow(IntNumber[] operands)
Checks whether the operation causes the overflow exception.GeneratorResult<IntNumber>
generate(IntException situation, IntNumber[] operands)
Generates test data for the given test situation.protected abstract GeneratorResult<IntNumber>
generateNormal(IntNumber[] operands)
Tries to generate operands that do not cause exceptions.protected abstract GeneratorResult<IntNumber>
generateOverflow(IntNumber[] operands)
Tries to generate operands that cause the overflow exception.
-
-
-
Method Detail
-
check
public final boolean check(IntException situation, IntNumber[] operands)
Description copied from interface:Generator
Checks the test data against the test situation.- Specified by:
check
in interfaceGenerator<IntNumber,IntException>
- Parameters:
situation
- the test situation.operands
- the test data.- Returns:
true
if the test data correspond to the test situation;false
otherwise.
-
generate
public final GeneratorResult<IntNumber> generate(IntException situation, IntNumber[] operands)
Description copied from interface:Generator
Generates test data for the given test situation.- Specified by:
generate
in interfaceGenerator<IntNumber,IntException>
- Parameters:
situation
- the test situation.operands
- the test data having been fixed.- Returns:
- the test data.
-
checkNormal
protected abstract boolean checkNormal(IntNumber[] operands)
Checks whether the operation does not cause exceptions.- Parameters:
operands
- the operation operands.- Returns:
true
if the operation does not cause exceptions;false
otherwise.
-
generateNormal
protected abstract GeneratorResult<IntNumber> generateNormal(IntNumber[] operands)
Tries to generate operands that do not cause exceptions.- Parameters:
operands
- the operation operands (operand[i] == null
if the i-th operation is not fixed; otherwiseoperand[i]
contains the operand value).- Returns:
- the operation operands.
-
checkOverflow
protected abstract boolean checkOverflow(IntNumber[] operands)
Checks whether the operation causes the overflow exception.- Parameters:
operands
- the operation operands.- Returns:
true
if the operation causes the exception;false
otherwise.
-
generateOverflow
protected abstract GeneratorResult<IntNumber> generateOverflow(IntNumber[] operands)
Tries to generate operands that cause the overflow exception.- Parameters:
operands
- the operation operands (operand[i] == null
if the i-th operation is not fixed; otherwiseoperand[i]
contains the operand value).- Returns:
- the operation operands.
-
-