Suppose we have a class that we want to mock.
class Apple {
Color color
bool isFresh
}
We mock it with Mock. We execute the code we need to test. Mocked Apple object gets its Color color
updated. However, the field stays null.
// test class
Apple apple = Mock(Apple.class)
myService.myMethod(apple)
assert apple.color == Color.RED //FAIL because apple.color == null
// tested code of myMethod(Apple apple)
apple.color = Color.RED