function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arav SundarArav Sundar 

need help on test class for webservice

Hi , 

Can anyone please help me the test class for the below webservice class ..


global class OpprtunityWEbservice2{
   
    webService static String test1(String year,String accId, String mheCourseId, String term, String stage, String name ,Boolean productInUseUpdate,String creationSourceId,String contactId,String productId, String pricebookEntryId,Double unitPrice, String targetedCreationSourceId, Boolean restrictOppLineCreation){
        String newOptyId;
      try{
        test2 o = new test2(Name=name,year__c=year,accountId=accId,MHE_Course__c=mheCourseId,Term__c=term,StageName=stage,CloseDate=System.Today(),Product_in_Use_Update__c=productInUseUpdate,Creation_Source_ID__c=creationSourceId);
        insert o;
        newOptyId =''+o.id;
         
        test 3 oc=new test 3(Name='test45',Contact_Name__c=contactId,Opportunity__c=newOptyId );
        insert oc;
        
        if(restrictOppLineCreation == false){
            System.debug('restrict oppline creation ::'+restrictOppLineCreation);
            test4 ol=new test4(OpportunityId=newOptyId ,Quantity=1,UnitPrice=unitPrice,PricebookEntryId=pricebookEntryId,Creation_Source_ID__c=targetedCreationSourceId);
            insert ol;
           }else{
               System.debug('restrict oppline creation*** ::'+restrictOppLineCreation);
           }
           
        
        return newOptyId;
      }catch(Exception e){
        return e.getmessage();
    }
    }
   
}


ANd the test class i am trying is below pls help 

@isTest Class Test_webservice{

private Static TestMethod void test1(){
   
   OpprtunityWEbservice2.test1 test = new OpprtunityWEbservice2.test1();



Getting an error (Invalid type: OpprtunityWEbservice2.test1 at line 101 column 65