Created
January 11, 2011 03:32
-
-
Save rhiguchi/773970 to your computer and use it in GitHub Desktop.
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
/** | |
* Creating a instance by using FEST Reflection for testing of Swing Application Framework | |
* require import static org.fest.reflect.core.Reflection.*; | |
*/ | |
protected static <C extends Application> C createApplicationInstance(Class<C> appClass, String[] args) { | |
C application = | |
staticMethod("create") | |
.withReturnType(appClass) | |
.withParameterTypes(Class.class) | |
.in(appClass) | |
.invoke(appClass); | |
method("initialize") | |
.withParameterTypes(String[].class) | |
.in(application) | |
.invoke((Object)args); | |
method("startup").in(application).invoke(); | |
return application; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: