You need to sign in to do that
Don't have an account?

Test class reqires for soql urgent
SOQL query to find all account records where billing state is not tokyo and california. Order the result by billing state in descending order with null value at the end.Display first 1000 record only
///Can anyone provide Test Class for following code?
public with sharing class BillingStateClass {
public void checkBillingState(){
List<Account> listAccount = [SELECT
Id,
Name
FROM
Account
WHERE
Account.BillingState
NOT IN
('tokyo','california')
ORDER BY
Account.BillingState DESC
NULLS
LAST
LIMIT
10000];
System.debug(listAccount);
}
}
///Can anyone provide Test Class for following code?
public with sharing class BillingStateClass {
public void checkBillingState(){
List<Account> listAccount = [SELECT
Id,
Name
FROM
Account
WHERE
Account.BillingState
NOT IN
('tokyo','california')
ORDER BY
Account.BillingState DESC
NULLS
LAST
LIMIT
10000];
System.debug(listAccount);
}
}
please mark this as BEST ANSWER, if this solves your problem
Hope this will help you & please remember to use system.assertEquals always because it verifies your test classes
Please mark it as Best Answer if it helps you.
Thank You
Ajay Dubedi
and can you please mention what changes are required if the method returns value.
public with sharing class BillingStateClass {
public static List<Account> checkBillingState(){
List<Account> listAccount = [SELECT
Id,
Name
FROM
Account
WHERE
Account.BillingState
NOT IN
('maharashtra','Kerala')
ORDER BY
Account.BillingState DESC
NULLS
LAST
LIMIT
10000];
System.debug(listAccount);
return listAccount;
}
}
please mark this as BEST ANSWER, if this solves your problem
Try the below code.
List<Account> accList=new List<Account>();
accList=[SELECT name FROM Account WHERE BillingState!='tokyo' OR BillingState!='california' ORDER BY BillingState DESC LIMIT 1000];
System.debug(accList);
Thanks.
Akshay