use of com.laytonsmith.core.Static in project CommandHelper by EngineHub.
the class StaticTest method InstallFakeServerFrontend.
/**
* This installs a fake server frontend. You must have already included
*
* @PrepareForTest(Static.class) in the calling test code, which will allow the proper static methods to be mocked.
*/
public static void InstallFakeServerFrontend() {
if (frontendInstalled) {
return;
}
ClassDiscovery.getDefaultInstance().addDiscoveryLocation(ClassDiscovery.GetClassContainer(Static.class));
ClassDiscovery.getDefaultInstance().addDiscoveryLocation(ClassDiscovery.GetClassContainer(StaticTest.class));
ExtensionManager.Initialize(ClassDiscovery.getDefaultInstance());
Implementation.setServerType(Implementation.Type.TEST);
AliasCore fakeCore = mock(AliasCore.class);
fakeCore.autoIncludes = new ArrayList<File>();
SetPrivate(CommandHelperPlugin.class, "ac", fakeCore, AliasCore.class);
frontendInstalled = true;
try {
Prefs.init(new File("preferences.ini"));
} catch (IOException ex) {
Logger.getLogger(StaticTest.class.getName()).log(Level.SEVERE, null, ex);
}
CHLog.initialize(new File("."));
}
Aggregations