Created
April 11, 2018 14:35
-
-
Save trickyBytes/60771fd044067e1ce5af530249e35ae8 to your computer and use it in GitHub Desktop.
Exposing the instantiation of an inner context for testing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Enclosing { | |
public String methodA() { | |
getContext(); | |
...... | |
} | |
protected void getContext() { | |
Inner.getContext(); | |
...... | |
} | |
@Test | |
public void test_something() { | |
Enclosing enclosing = new Enclosing() { | |
@Override | |
protected void getContext() { | |
// do what you need here | |
} | |
}; | |
// your test code on enclosing where you control getContext | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment