1

Hi I am trying to have an orderitem into my test class in order to test a trigger.

class is : `

public static testmethod void TaskTrigger_Test1()
    {
          Account a = new Account(`enter preformatted text here`Name = 'Test');
        insert a;

            Order o = new Order(name='Test1',AccountId=a.id,EffectiveDate=system.today(),status='draft');
            insert o;

            OrderItem oi = new OrderItem(OrderId=o.id,Quantity='decimal.valueof('1')',PricebookEntryId='test');
            insert oi;


        Task t = new Task(whatid=o.id,Priority = 'normal',status='open',subject='Email:xxxx');
        insert t;

        system.assertequals('Sent',o.status);
     }
   }

but I get this error. Any ideas?

Error: Compile Error: expecting a right parentheses, found '1' at line 33 column 81

1 Answer 1

2

remove the single quote for Quantity = decimal.valueof('1') if not try passing Quantity =1 (internally already its decimal placess are defined)

OrderItem oi = new OrderItem(OrderId=o.id,Quantity='decimal.valueof('1')',PricebookEntryId='test'); insert oi;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .