You need to sign in to do that
Don't have an account?
User Users
Package creation and installation problem
Hello,
I am creating a package with test method and install that package on another account then it will give "Cannot call test methods in non-test context".
How can I resolve it? Without test method I am not able to create package.
Thanks.
I am creating a package with test method and install that package on another account then it will give "Cannot call test methods in non-test context".
How can I resolve it? Without test method I am not able to create package.
Thanks.
@isTest
global class UserRetrieval{
static String getUserExtension() {
List<User> users = new List<User>();
String uid = UserInfo.getUserId();
for (User user : Database.query('Select id, extension, username, name from User where id=\'' + uid + '\'')){
System.debug(user);
users.add(user);
}
String JSONString = JSON.serialize(users);
return JSONString;
}
static String getCallerDetail(String extension){
String JSONString='';
List<Contact> contacts = new List<Contact>();
for (Contact contact : Database.query('Select id, name, phone, email, MobilePhone from contact where phone=\'' + extension + '\' or MobilePhone=\'' + extension + '\'')){
contacts.add(contact);
}
if(!contacts.isEmpty()){
JSONString = JSON.serialize(contacts);
}
return JSONString;
}
static testMethod void testDemo(){}
}
I put testDemo() only to create package. Because without test method I am not able to create package. I am not using testDemo() anywhere in my apex code.