Reputation: 47
I have a method like below:
public void process {
ArrayList<String> data = new ArrayList<>();
...
...
}
data
is a local variable, the value of which I want to access after calling myObject.process()
inside the test function. Is there any way I can do that?
Upvotes: 1
Views: 3270
Reputation: 106
Mockito cannot access a local variable which is created by your code. The only way to test the code is to check whether something else is being effected by that variable and verify that change. This answer should help you out.
https://stackoverflow.com/a/30188745/17052051
Upvotes: 2