javaspring-bootjunit5spring-testmutation-testing

pieTest - Mutation Test failure


All, There is an issue while running mutation test cases.

Getting the mutation test case failures as follows:

removed call to java/util/List::sort → SURVIVED
removed call to java/util/List::forEach → SURVIVED

The code:

List<CustomClass> data;//address is the field in the CustomClass
UseCase useCase; //setEventBus is the method
   data.sort(Comparator.comparingInt(CustomClass::getAddress));
     
   data.forEach(frame -> useCase.setEventBus(frameList, data.getAddress()));

I have written couple of unit test cases but mutants survived. Can anyone help here for this problem?


Solution

  • The failed mutation cases are solved.

    removed call to java/util/List::sort → SURVIVED:

    Added the test case for the below line data.sort(Comparator.comparingInt(CustomClass::getAddress)); The test case is added to store the unsorted data in 'data' object.