I have a situation where I was querying standard pricebook with
SeeAlldata=true in test class.
Pricebook2 pb2 = [select Id, Name, IsActive from PriceBook2 where IsStandard=True LIMIT 1];
Later I changed
SeeAlldata=false and getting the id like this:
Id pricebookId = Test.getStandardPricebookId();
Now I'm executing a method from test class in which I'm querying standard pridebook. I cannot use the
Test.getStandardPricebookId(); in apex class.
How can I fix this issue without setting