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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -