I have the following code:
public class ABC { private double a; Other_object other_object; public ABC(int a, int[] b){ this.a=a; other_object=new Other_object(b); } ... public int method_1(){ return other_object.other_method(); } public int method_2(){ if(method_1()>0 && a>0) return 1; else return 0; } }
I've created the following mock object: ABC a=mock(ABC.class); Mockito.when(a.method1()).thenReturn(0);
I cannot set a value for "int a". I tried to create a setter function in ABC, and mocking it, but it doesn't work. I would like to know why mocking the setter function doesn't work how can I mock this value (int a)?