Я новичок в вершине, я создал кнопку, чтобы вызвать класс apex через страницу визуальной силы. Вот мой код страницы визуальной силы.Как передать метод PageReference из класса apex test
<apex:page standardController="Opportunity"
extensions="myclass"
action="{!autoRun}">
</apex:page>
Это мой класс apex.
public class myclass {
private final Opportunity o;
String tmp;
public myclass(ApexPages.StandardController stdController) {
this.o = (Opportunity)stdController.getRecord();
}
public PageReference autoRun() {
String theId = ApexPages.currentPage().getParameters().get('id');
for (Opportunity o:[select id, name, AccountId, from Opportunity where id =:theId]) {
//Create the Order
Order odr = new Order(
OpportunityId=o.id
,AccountId = o.AccountId
,Name = o.Name
,EffectiveDate=Date.today()
,Status='Draft'
);
insert odr;
tmp=odr.id;
}
PageReference pageRef = new PageReference('/' + tmp);
pageRef.setRedirect(true);
return pageRef;
}
}
Я хочу создать испытательный класс. Я не знаю, как ссылаться на метод PageReference autoRun() из тестового класса. Ребята нуждаются в помощи, если кто-то может рассказать мне о тестовом классе этого класса apex.