Observed location of bug:
com.mindfusion.common.BaseList.remove(Object)
Condition for reproduction:
List does not contain the element to be removed.
Observed behavior:
Method throws java.lang.ArrayIndexOutOfBoundsException.
Specified behavior (per java.util.Collection.remove(Object)):
Method returns false.
Tested with:
JPlanner 2.1.3
Stacktrace:
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:424)
at java.util.ArrayList.remove(ArrayList.java:501)
at com.mindfusion.common.BaseList.doRemove(Unknown Source)
at com.mindfusion.common.BaseList.remove(Unknown Source)
Reproducing unittest:
import static org.junit.Assert.assertFalse;
import com.mindfusion.common.BaseList;
import org.junit.Test;
public class BaseListTest {
BaseList<Object> sut = new BaseList<Object>() {
//
};
@Test
public void test() {
// Given
final Object o = new Object();
// When
final boolean actual = sut.remove(o);
// Then
assertFalse(actual);
}
}