I’m trying to write mocking for to set a simple set in a class. I know that we do not need mocking for this specific example. But I'm using this example to learn how to use the framework. class Test{ Integer value;
public Integer getValue(){
return this.value;
}
public void setValue(int val){
this.value = val;
}
}
my mocking method looks like:
@Test
public void testSetMethod(){
Test v = Mockito.mock(Test.class);
Mockito.doCallRealMethod().when(v).setValue(10);
assertEquals(10,v.getValue());
}
I’m getting zero for v.getValue() in my assetEquals method instead of 10.