I have a class A
that needs to the tested. The following is the definition of A
:
public class A {
public void methodOne(int argument) {
//some operations
methodTwo(int argument);
//some operations
}
private void methodTwo(int argument) {
DateTime dateTime = new DateTime();
//use dateTime to perform some operations
}
}
And based on the dateTime
value some data is to be manipulated, retrieved from the database. For this database, the values are persisted via a JSON file.
This complicates things. What I need is to set the dateTime
to some specific date while it is being tested. Is there a way I can mock a local variable's value using mockito?