Here is a list of the identified Java mutation operators for the MoDisco Java meta-model useful for mutation testing:
Replaces an arithmetic operator by a plus operator
modify one InfixExpression where {operator in ['-', '*', '/', '%']
and leftOperand <> null and rightOperand <> null}
with {operator = '+'}
Replaces an arithmetic operator by a minus operator
modify one InfixExpression where {operator in ['+', '*', '/', '%']
and leftOperand <> null and rightOperand <> null
and leftOperand not typed StringLiteral and rightOperand not typed StringLiteral}
with {operator = '-'}
Replaces an arithmetic operator by a times operator
modify one InfixExpression where {operator in ['+', '-', '/', '%']
and leftOperand <> null and rightOperand <> null
and leftOperand not typed StringLiteral and rightOperand not typed StringLiteral}
with {operator = '*'}
Replaces an arithmetic operator by a division operator
modify one InfixExpression where {operator in ['+', '-', '*', '%']
and leftOperand <> null and rightOperand <> null
and leftOperand not typed StringLiteral and rightOperand not typed StringLiteral}
with {operator = '/'}
Replaces an arithmetic operator by a remainder operator
modify one InfixExpression where {operator in ['+', '-', '*', '/']
and leftOperand <> null and rightOperand <> null
and leftOperand not typed StringLiteral and rightOperand not typed StringLiteral}
with {operator = '%'}
Replaces a postfix '++' operator by a postfix '--' operator
modify one PostfixExpression where {operator = '++' and operand <> null}
with {operator = '--'}
Replaces a postfix '--' operator by a postfix '++' operator
modify one PostfixExpression where {operator = '--' and operand <> null}
with {operator = '++'}
Replaces a prefix '++' operator by a prefix '--' operator
modify one PrefixExpression where {operator = '++' and operand <> null}
with {operator = '--'}
Replaces a prefix '--' operator by a prefix '++' operator
modify one PrefixExpression where {operator = '--' and operand <> null}
with {operator = '++'}
Replaces a prefix '+' operator by a prefix '-' operator
modify one PrefixExpression where {operator = '+' and operand <> null}
with {operator = '-'}
Replaces a prefix '-' operator by a prefix '+' operator
modify one PrefixExpression where {operator = '-' and operand <> null}
with {operator = '+'}
Replaces a prefix '+' or '-' operator by a prefix '--' operator
modify one PrefixExpression where {operator in ['+', '-']
and operand <> null and operand not typed NumberLiteral}
with {operator = '--'}
Replaces a prefix '+' or '-' operator by a prefix '++' operator
modify one PrefixExpression where {operator in ['+', '-']
and operand <> null and operand not typed NumberLiteral}
with {operator = '++'}
Replaces a prefix '++' or '--' operator by a prefix '+' operator
modify one PrefixExpression where {operator in ['++', '--'] and operand <> null}
with {operator = '+'}
Replaces a relational operator by a relational greater than operator
modify one InfixExpression where {operator in ['>=', '<', '<=', '==', '!=']
and leftOperand <> null and rightOperand <> null}
with {operator = '>'}
Replaces a relational operator by a relational greater than or equals operator
modify one InfixExpression where {operator in ['>', '<', '<=', '==', '!=']
and leftOperand <> null and rightOperand <> null}
with {operator = '>='}
Replaces a relational operator by a relational less than operator
modify one InfixExpression where {operator in ['>', '>=', '<=', '==', '!=']
and leftOperand <> null and rightOperand <> null}
with {operator = '<'}
Replaces a relational operator by a relational less than or equals operator
modify one InfixExpression where {operator in ['>', '>=', '<', '==', '!=']
and leftOperand <> null and rightOperand <> null}
with {operator = '<='}
Replaces a relational operator by a relational equals operator
modify one InfixExpression where {operator in ['>', '>=', '<', '<=', '!=']
and leftOperand <> null and rightOperand <> null}
with {operator = '=='}
Replaces a relational operator by a distinct operator
modify one InfixExpression where {operator in ['>', '>=', '<', '<=', '==']
and leftOperand <> null and rightOperand <> null}
with {operator = '!='}
Replaces a conditional operator by a '&&' operator
modify one InfixExpression where {operator in ['||', '^']
and leftOperand <> null and rightOperand <> null}
with {operator = '&&'}
Replaces a conditional operator by a '||' operator
modify one InfixExpression where {operator in ['&&', '^']
and leftOperand <> null and rightOperand <> null}
with {operator = '||'}
Replaces a conditional operator by a conditional '^' operator
modify one InfixExpression where {operator in ['&&', '||']
and leftOperand <> null and rightOperand <> null}
with {operator = '^'}
Replaces a logic operator by a logic '&' operator
modify one InfixExpression where {operator in ['|', '^']
and leftOperand <> null and rightOperand <> null}
with {operator = '&'}
Replaces a logic operator by a logic '|' operator
modify one InfixExpression where {operator in ['&', '^']
and leftOperand <> null and rightOperand <> null}
with {operator = '|'}
Replaces a logic operator by a logic '^' operator
modify one InfixExpression where {operator in ['&', '|']
and leftOperand <> null and rightOperand <> null}
with {operator = '^'}
Replaces a shift operator by a shift '>>' operator
modify one InfixExpression where {operator in ['>>>', '<<']
and leftOperand <> null and rightOperand <> null}
with {operator = '>>'}
Replaces a shift operator by a shift '>>>' operator
modify one InfixExpression where {operator in ['>>', '<<']
and leftOperand <> null and rightOperand <> null}
with {operator = '>>>'}
Replaces a shift operator by a shift '<<' operator
modify one InfixExpression where {operator in ['>>', '>>>']
and leftOperand <> null and rightOperand <> null}
with {operator = '<<'}
Replaces an assignment operator by an assignment '+=' operator
modify one Assignment where {operator in ['-=', '*=', '/=', '%=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '+='}
Replaces an assignment operator by an assignment '-=' operator
modify one Assignment where {operator in ['+=', '*=', '/=', '%=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '-='}
Replaces an assignment operator by an assignment '*=' operator
modify one Assignment where {operator in ['+=', '-=', '/=', '%=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '*='}
Replaces an assignment operator by an assignment '/=' operator
modify one Assignment where {operator in ['+=', '-=', '*=', '%=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '/='}
Replaces an assignment operator by an assignment '%=' operator
modify one Assignment where {operator in ['+=', '-=', '*=', '/=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '%='}
Replaces an assignment operator by an assignment '&=' operator
modify one Assignment where {operator in ['|=', '^=', '>>=', '>>>=', '<<=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '&='}
Replaces an assignment operator by an assignment '|=' operator
modify one Assignment where {operator in ['&=', '^=', '>>=', '>>>=', '<<=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '|='}
Replaces an assignment operator by an assignment '^=' operator
modify one Assignment where {operator in ['&=', '|=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '^='}
Replaces an assignment operator by an assignment '>>=' operator
modify one Assignment where {operator in ['>>>=', '<<=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '>>='}
Replaces an assignment operator by an assignment '>>>=' operator
modify one Assignment where {operator in ['>>=', '<<=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '>>>='}
Replaces an assignment operator by an assignment '<<=' operator
modify one Assignment where {operator in ['>>=', '>>>=']
and leftHandSide <> null and rightHandSide <> null}
with {operator = '<<='}
Transforms a number literal to a random number
modify one NumberLiteral with {tokenValue = random-int-string(0, 9)}
Deletes a call to a void method
remove one MethodInvocation
where {method->returnType->type is typed PrimitiveTypeVoid}
Deletes a call to a non-void method
remove one MethodInvocation
where {method->returnType->type not typed PrimitiveTypeVoid}
Replaces a call to a constructor method by null
a = select one Assignment
where {rightHandSideis typed ClassInstanceCreation}
create NullLiteral in a->rightHandSide
Removes an assignment
remove one Assignment
where {rightHandSide is typed NumberLiteral}
Argument propagation in a return statement
stmt = select one ReturnStatement where {expression is typed MethodInvocation}
method = select one MethodInvocation in stmt->expression
param = select one SingleVariableAccess in method->arguments
modify stmt with {expression = param}
Argument propagation in the right operand of an infix expression
exp = select one InfixExpression where {rightOperand is typed MethodInvocation}
method = select one MethodInvocation in exp->rightOperand
param = select one SingleVariableAccess in method->arguments
modify exp with {rightOperand = param}
Argument propagation in the left operand of an infix expression
exp = select one InfixExpression where {leftOperand is typed MethodInvocation}
method = select one MethodInvocation in exp->leftOperand
param = select one SingleVariableAccess in method->arguments
modify exp with {leftOperand = param}
Argument propagation in an assignment
a = select one Assignment where {rightHandSide is typed MethodInvocation}
method = select one MethodInvocation in a->rightHandSide
param = select one SingleVariableAccess in method->arguments
modify a with {rightHandSide = param}
Increment of a number literal in the right operand of an infix expression
exp = select one InfixExpression where {rightOperand is typed NumberLiteral}
n = select one NumberLiteral in exp->rightOperand
inc = deep clone n with {tokenValue = '1'}
create InfixExpression in exp->rightOperand
with {leftOperand = n, operator = '+', rightOperand = inc}
Increment of a number literal in the left operand of an infix expression
exp = select one InfixExpression where {leftOperand is typed NumberLiteral}
n = select one NumberLiteral in exp->leftOperand
inc = deep clone n1 with {tokenValue = '1'}
create InfixExpression in exp0->leftOperand
with {leftOperand = n, operator = '+', rightOperand = inc}
Increment of a number literal in a return statement
exp = select one ReturnStatement where {expression is typed NumberLiteral}
n = select one NumberLiteral in exp->expression
inc = deep clone n with {tokenValue = '1'}
create InfixExpression in exp->expression
with {leftOperand = n, operator = '+', rightOperand = inc}
Increment of a number literal in the right hand side of an assignment
exp = select one Assignment where {rightHandSide is typed NumberLiteral}
n = select one NumberLiteral in exp->rightHandSide
inc = deep clone n with {tokenValue = '1'}
create InfixExpression in exp->rightHandSide
with {leftOperand = n, operator = '+', rightOperand = inc}
Changes a boolean value to true
modify one BooleanLiteral where {value = false} with {value = true}
Changes a boolean value to false
modify one BooleanLiteral where {value = true} with {value = false}
Replaces a number literal value by 1
modify one NumberLiteral where {tokenValue <> '1'} with {tokenValue = '1'}
Replaces a return statement by a null literal
rt = select one ReturnStatement
create NullLiteral in rt->expression
Replaces a number literal value by 0
modify one NumberLiteral where {tokenValue <> '0'} with {tokenValue = '0'}
Replaces a number literal value in the left operand of an infix expression with -1
exp = select one InfixExpression where {leftOperand is typed NumberLiteral}
modify exp with {leftOperand.tokenValue = '1'}
p = create PrefixExpression with {operator = '-', operand = exp->leftOperand}
modify exp with {leftOperand = p}
Replaces a number literal value in the right operand of an infix expression with -1
exp = select one InfixExpression where {rightOperand is typed NumberLiteral}
modify exp with {rightOperand.tokenValue = '1'}
p = create PrefixExpression with {operator = '-', operand = exp->rightOperand}
modify exp with {rightOperand = p}
Replaces a number literal value in a return statement with -1
rt = select one ReturnStatement where {expression is typed NumberLiteral}
modify rt with {expression.tokenValue = '1'}
p = create PrefixExpression with {operator = '-', operand = rt->expression}
modify rt with {expression = p}
Replaces a number literal value in the right hand side of an assignment with -1
a = select one Assignment where {rightHandSide is typed NumberLiteral}
modify a with {rightHandSide.tokenValue = '1'}
p = create PrefixExpression with {operator = '-', operand = a->rightHandSide}
modify a with {rightHandSide = p}
Replaces a string literal return value with ''
modify one StringLiteral where {escapedValue <> ''} with {escapedValue = ''}
Removes a unary conditional operator in an if statement
if = select one IfStatement where {expression is typed PrefixExpression}
pre = select one PrefixExpression in if->expression where {operator = '!'}
exp = select one Expression in pre->operand
modify if with {expression = exp}
Removes a unary conditional operator in a return statement
rt = select one ReturnStatement where {expression is typed PrefixExpression}
pre = select one PrefixExpression in rt->expression where {operator = '!'}
exp = select one Expression in pre->operand
modify rt with {expression = exp}
Removes a unary conditional operator in the right operand of an infix expression
inf = select one InfixExpression where {rightOperand is typed PrefixExpression}
pre = select one PrefixExpression in inf->rightOperand where {operator = '!'}
exp = select one Expression in pre->operand
modify inf with {rightOperand = exp}
Removes a unary conditional operator in the left operand of an infix expression
inf = select one InfixExpression where {leftOperand is typed PrefixExpression}
pre = select one PrefixExpression in inf->leftOperand where {operator = '!'}
exp = select one Expression in pre->operand
modify inf with {leftOperand = exp}
Removes one statement
remove one Statement where {self not typed VariableDeclarationStatement}
Conditional negation in an if statement
if = select one IfStatement
exp = select one InfixExpression in if->expression
neg = create PrefixExpression in if->expression with {operator = '!'}
par = create ParenthesizedExpression in neg->operand with {expression = exp}
Conditional negation in a return statement
rt = select one ReturnStatement
exp = select one InfixExpression in rt->expression
neg = create PrefixExpression in rt->expression with {operator = '!'}
par = create ParenthesizedExpression in neg->operand with {expression = exp}
Conditional negation in the left operand of an infix expression
exp0 = select one InfixExpression
exp1 = select one InfixExpression in exp0->leftOperand
neg = create PrefixExpression in exp0->leftOperand with {operator = '!'}
par = create ParenthesizedExpression in neg->operand with {expression = exp1}
Conditional negation in the right operand of an infix expression
exp0 = select one InfixExpression
exp1 = select one InfixExpression in exp0->rightOperand
neg = create PrefixExpression in exp0->rightOperand with {operator = '!'}
par = create ParenthesizedExpression in neg->operand with {expression = exp1}
Remove a conditional statement
main = select one Block where {statements is typed IfStatement}
if = select one IfStatement in main->statements
b = select one Block in if->thenStatement
modify main with {statements += b2}
remove if
Subtract 1 to a number literal in the left operand of an infix expression
exp = select one InfixExpression where {leftOperand is typed NumberLiteral}
n = select one NumberLiteral in exp->leftOperand
dec = deep clone n with {tokenValue = '1'}
create InfixExpression in exp->leftOperand
with {leftOperand = n, operator = '-', rightOperand = dec}
Subtract 1 to a number literal in the right operand of an infix expression
exp = select one InfixExpression where {rightOperand is typed NumberLiteral}
n = select one NumberLiteral in exp->rightOperand
dec = deep clone n with {tokenValue = '1'}
create InfixExpression in exp->rightOperand
with {leftOperand = n, operator = '-', rightOperand = dec}
Subtract 1 to a number literal in a return statement
exp = select one ReturnStatement where {expression is typed NumberLiteral}
n = select one NumberLiteral in exp->expression
dec = deep clone n with {tokenValue = '1'}
create InfixExpression in exp->expression
with {leftOperand = n, operator = '-', rightOperand = dec}
Subtract 1 to the right hand side of an assignment
exp = select one Assignment where {rightHandSide is typed NumberLiteral}
n = select one NumberLiteral in exp->rightHandSide
dec = deep clone n with {tokenValue = '1'}
create InfixExpression in exp->rightHandSide
with {leftOperand = n, operator = '-', rightOperand = dec}
This work has been funded by the Spanish Ministry of Science (RTI2018-095255-B-I00, project "MASSIVE") and the R&D programme of Madrid (P2018/TCS-4314, project "FORTE").