How to instruct pitest to skip some methods.

27 views
Skip to first unread message

Kevin Patel

unread,
Jun 3, 2023, 1:24:18 PM6/3/23
to PIT Users
Hii 

I am Kevin. 

Is there any way to skip some methods in Pitest? 
For example:- 
```
public Set<DetailAST> getMethodCalls() { return Collections.unmodifiableSet(methodCalls); }
``` 

The code is mutated as 

```
public Set<DetailAST> getMethodCalls() { return methodCalls;
}
```
How can we instruct Pitest to not mutate Collections.unmodifiableSet? 


henry

unread,
Jun 3, 2023, 1:30:14 PM6/3/23
to PIT Users
You can use the `avoidCallsTo` parameter to provide a list of methods where no mutants should be created on the line on which they are called. By default this is set to a list of common logging methods, but you can redefine it to include `java.util.Collections.unmodifiableSet`.

If you don't want to avoid every instance of unmodifiableSet, you could use the Arcmutate exclusions functionality to avoid individual lines.


Henry
Reply all
Reply to author
Forward
0 new messages