mercredi 30 octobre 2019

How to write easyMock.expect for int[]

Throwing error Targetinvocationexception.

public class A{
      public method_name(){
      int[] selections = grid.getSelectedIndices(); // Facing issue here...!
      // Problem occur above line.
      }
}

public class A_test{
    Grid grid = EasyMock.createNicemock(Grid.class);
    EasyMock.expect(grid.getSelectedIndices().andReturn(EasyMock.arEq(new int[] {1})));
    EasyMock.replay(grid);    

// I able to invoke method with the help of reflection
// method.invoke();
}

Question: I am not able to expect on "getSelectedIndices()". At some changes it give me error of 0 matcher and 1 reported. As cannot able to match mock object and raw value





Aucun commentaire:

Enregistrer un commentaire