public interface Testable<T>
Tester interface.
The idiomatic use of this pattern is for the tested class to encapsulate access to its private
members through an inner class with a private constructor:
public class Foo implements Testable$lt;Foo$gt; {
private int mSecret;
public class PrivateAccess {
private PrivateAccess() {}
public int getSecret() { return mSecret; }
public void setSecret(int secret) { mSecret = secret; }
}
public void grantAccess(Tester$lt;Foo> tester) {
tester.receiveAccess(new PrivateAccess());
}
}
| Modifier and Type | Method and Description |
|---|---|
void |
grantAccess(Tester<T> tester) |
Copyright © 2015. All Rights Reserved.