I have a piece of code to test -
public class Test {
public List<Long> getListExpiryTime(long time){
List<Long> tempList = new ArrayList<Long>();
tempList.add(getExpiryTime(time));
return tempList;
}
private long getExpiryTime(long time) {
long currentTime = Calendar.getInstance().getTimeInMillis();
return time - currentTime / 1000;
}
}
I want to test whether the List returned has a certain value after I give an input time and we mock Calendar.getInstance().getTimeInMillis();. How exactly do I do this? I prefer to do this using Mockito
Aucun commentaire:
Enregistrer un commentaire