plugins - Platform.getBundle(Activator.PLUGIN_ID) returns null -
i have function ex
public void func { .... .... url url = platform.getbundle(activator.plugin_id).getentry("config"); .... .... }
now writing junit test case above function in different test plugin. when call func in junit test method getting null pointer exception.
i tried printing
platform.getbundle(activator.plugin_id) returns null platform.isrunning() returns false.
please let me know how solve this? can junit testcase successful.
thank in advance.
just pseudo code... private platform platform; public void func() { //.... //.... url url = getplatform().getentry("config"); //.... //.... } public platform getplatform() { return platform.getbundle(activator.plugin_id); } in testcase, override getplatform() method mock/stub. class yourclass = new yourclass() { @override public platform getplatform() { return mock/stub!!; } }
Comments
Post a Comment