In the context of mocking, the Whitebox class of Mockito is incredibly useful.
For example, with Java 7, it got harder to mock java.io.File because of the
following method:
final boolean isInvalid() {
if (status == null) {
status = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED
: PathStatus.INVALID;
}
return status == PathStatus.INVALID;
}
To get around the problem that this method will always yield PathStatus.INVALID
we have to set the private field path.
Original issue reported on code.google.com by Alexander.Weickmann@gmail.com on 2 May 2014 at 9:31
Original issue reported on code.google.com by
Alexander.Weickmann@gmail.com
on 2 May 2014 at 9:31