• DestinyLomas
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

I am trying to fix my apex class testing code except I do not understand a way around what it is telling me to do. It tells me that in line 17, its expecting a right parenthesis, but only found a ;...however when I attempt to put a right parenthesis in it begins telling me all manor of things. It tells me that it does not expect token 'product' in the next line, that it is now expecting a close right curly bracket in line 17, etc. Please help!

 

This is my code, you will probably recognize it from the force.com workbook spring 13 release. I followed their instructions exactly:

 

@isTest

private

class TestHandleProductPriceChange {

 

  

statictestMethodvoid testPriceChange () {

  

Invoice_Statement__c Invoice = newInvoice_Statement__c(Status__c = 'Negotiating');

  

insert Invoice;

  

  

Merchandise__c[] products = new merchandise__c[]{

  

newMerchandise__c(Name = 'item 1', Description__c =

  

'test product 1', Price__c = 10,Total_Inventory__c = 10),

  

newMerchandise__c(Name = 'item 2', Description__c =

  

'test product 2', Price__c = 11,Total_Inventory__c = 10)

    };

    Insert products;

  

Line_Items__c[] LineItems = newLine_Items__c[] {

  

newLine_Items__c(Invoice_Statement__c = invoice.id,

  

Merchandise__c = products[0].price__c = 20; //raise price

    prodcts[1].price__c = 5;

//lower price

    Test.startTest();

  

update products;

    Test,stopTest();

  

    lineItems =

    [

SELECT id, unit_price__c FROM Line_items__c WHERE id IN :lineItems];

    System.assert(lineItems[0].unit_price__c ==10);

//unchanged

    System.assert(lineItems[1].unit_price__c == 5);

//changed!!

    };

  

insert lineItems;

  

    products[0].price__c = 20;

    Test.startTest();

  

update products;

    Test.stopTest ();

  

    lineItems = [

SELECT id, unit_Price__c FROMLine_Items__cWHERE id IN :lineItems];

  

  

system.assert(lineItems[0].unit_Price__c == 10);

    }

    }

 

 

 

any help would be much appreciated

I am trying to fix my apex class testing code except I do not understand a way around what it is telling me to do. It tells me that in line 17, its expecting a right parenthesis, but only found a ;...however when I attempt to put a right parenthesis in it begins telling me all manor of things. It tells me that it does not expect token 'product' in the next line, that it is now expecting a close right curly bracket in line 17, etc. Please help!

 

This is my code, you will probably recognize it from the force.com workbook spring 13 release. I followed their instructions exactly:

 

@isTest

private

class TestHandleProductPriceChange {

 

  

statictestMethodvoid testPriceChange () {

  

Invoice_Statement__c Invoice = newInvoice_Statement__c(Status__c = 'Negotiating');

  

insert Invoice;

  

  

Merchandise__c[] products = new merchandise__c[]{

  

newMerchandise__c(Name = 'item 1', Description__c =

  

'test product 1', Price__c = 10,Total_Inventory__c = 10),

  

newMerchandise__c(Name = 'item 2', Description__c =

  

'test product 2', Price__c = 11,Total_Inventory__c = 10)

    };

    Insert products;

  

Line_Items__c[] LineItems = newLine_Items__c[] {

  

newLine_Items__c(Invoice_Statement__c = invoice.id,

  

Merchandise__c = products[0].price__c = 20; //raise price

    prodcts[1].price__c = 5;

//lower price

    Test.startTest();

  

update products;

    Test,stopTest();

  

    lineItems =

    [

SELECT id, unit_price__c FROM Line_items__c WHERE id IN :lineItems];

    System.assert(lineItems[0].unit_price__c ==10);

//unchanged

    System.assert(lineItems[1].unit_price__c == 5);

//changed!!

    };

  

insert lineItems;

  

    products[0].price__c = 20;

    Test.startTest();

  

update products;

    Test.stopTest ();

  

    lineItems = [

SELECT id, unit_Price__c FROMLine_Items__cWHERE id IN :lineItems];

  

  

system.assert(lineItems[0].unit_Price__c == 10);

    }

    }

 

 

 

any help would be much appreciated

Good Morning,

 

I was hoping (preying) that someone could help me with a problem I am having getting some pretty simple (IMO) fields completed.

 

In Leads - I have 4 custom fields:

 

Phone_Call_Attempts__c (Number(3, 0)

Successful_Phone_Calls__c (Number(3, 0)

Future_Dated_Task_Scheduled__c (Checkbox)

Overdue_Task_Flag__c (Checkbox)

 

When a Task is created (related to the lead) and has its Status' set to 'Completed', then I would like this to record as '1' in the Phone_Call_Attempts__c field on the related lead. Additional tasks of the same criteria would result in the number of Phone_Call_Attempts__c increasing. So if their had been 4 tasks with a status of completed, the Phone_Call_Attempts__c field would read '4'.

 

In addition, When a task (related to the lead) has its 'Status' set to 'Completed' and its 'Outcome' (Outcome__c (Picklist)) is 'Call Successful - Spoke with contact' I would like this to record as '1' in the 'Successful_Phone_Calls__c' field on the related Lead. Additional tasks of the same criteria would result in the number of 'Successful_Phone_Calls__c' increaseing. So if their had been 4 tasks with the outcome of 'Call Successful - Spoke with contact' then the Successful_Phone_Calls__c field would read '4'.

 

Where a task is raised against the lead that has a future date and has a 'Status' of 'Not Started' then this would result in the Future_Dated_Task_Scheduled__c checkbox being ticked. This should be unticked when/if the task is later completed.

 

Finally - where a task has a 'Status' of 'Not Started' and the 'ActivityDate' is in the past - the Overdue_Task_Flag__c should be ticked.

 

ANY help would be VERY VERY appreciated.

 

Steve