'Java | Mutation Testing | PiTEST | (negated conditional → SURVIVED) | (changed conditional boundary → SURVIVED)

I am getting piTest issues. Few mutations are getting survived.

PiTEST negated conditional → SURVIVED changed conditional boundary → SURVIVED

As per my understanding i am testing boundary conditions for a>=5 i.e. a=4, a=5, a=6. Do i need to add some other conditions?

  • negated conditional → SURVIVED &
  • changed conditional boundary → SURVIVED

CODE

public static Boolean test(Integer a) {
    if (a >= 5) {
        return false;
    }
    return true;
}

For the above code I have written the following Test Case:

TESTCASE

@Test
public void test1() {
    assertEquals(false, service.test(5));
    assertEquals(false, service.test(6));
    assertEquals(true, service.test(4));           
                
    //        assertTrue(service.test(0));
    //        assertTrue(service.test(-1));
    //        assertTrue(service.test(0));
    //        assertNotNull(service.test(5));
    //        assertNull(service.test(null));
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source