I installed an unmanaged app (by @michaelforce http://goo.gl/8rx7t) to enhance the "Add Products to Opp" page. It works great in both Prod and Sandbox.

However, I need to add the Discount field to the VF page. Since Discount is not included in the select statement in the opportunityProductEntryExtension apex class, the page breaks when adding the code itself to the opportunityProductEntry VF page.

I tried to do an outbound/inbound change (Sandbox to Prod) and get this error:
Failure Message: "System.AssertException: Assertion Failed", Failure Stack Trace: "Class.opportunityProductEntryTests.theTests: line 80, column 1"

Here are lines 76 - 84 (bold 81)
76 }
78 public String getChosenCurrency(){
80 if(multipleCurrencies)
81 return (String)theOpp.get('CurrencyIsoCode');
82 else
83 return '';
84 }

We do not have multiple currencies set up. I cannot comment out this section as it is referenced in opportunityProductEntry

I cannot edit the class in prod, and cannot successfully deploy the updated, working-in-sandbox Apex class to Production. I also can't figure the error on line 80, above.


  • It is possible to make the Discount field available to the controller via a statement on the opportunityProductEntry VF page? How?

  • Should I attempt to edit the Apex page in production another way (via eclipse?)?

  • Can the Currencies error above be remedied?

  • Any other ideas?

  • Here is the line from the test: System.assert(oPEE.priceBookCheck()!=null);
    – Bart__c
    Jan 31, 2013 at 22:59

2 Answers 2


What is the actual assert? I'm assuming there's a line in a test method which calls getChosenCurrency() and checks the result of it for a specific value.

Chances are you could just comment out that part of the test (any parts dependant on it) without taking too large a hit on the test coverage. Posting the test code where the assertion is would make it a lot easier for people to help you with this.


Based on it working in the one environment and not the other I would not be surprised if the unit tests rely on actual data as opposed to creating their own data. You should be able to navigate to the class and see the API version. If it is below 24 it is likely that the test relies on actual data in your org. If that's the case you need to look at the queries in the unit test and make sure that the data they expect is in the DB or modify the tests so that they create the data they need.

I agree with @LaceySnr that it would be helpful if you posted line 80 of the test class where the assertion is made. The code that you posted looks like it is from line 80 of the code under test. You need to look at the class opportunityProductEntryTests and the method theTests and the assertion on line 80.

All that being said, your easiest fix is probably what @LaceySnr said to just comment out the failing assertion. Still, if you do that you should be very certain that it is OK to comment out that test and it isn't actually failing for a valid reason.

  • I did comment out that (below) section, and the test passed. Now what? System.assert(oPEE.priceBookCheck()!=null);
    – Bart__c
    Jan 31, 2013 at 23:14
  • There's nothing preventing you from deploying it anymore as long as you have enough code coverage. You can include the test class opportunityProductEntryTests that you made changes to in your change set. My suggestion was/is that it is a good idea for you to feel confident that the assertion wasn't failing for a valid reason. You don't have to do that, though. Jan 31, 2013 at 23:26
  • 1
    Sure. Please accept @LaceySnr's answer (his idea to comment it out) by clicking the check mark to the left of his answer, so that future visitors can easily see what worked for you. Feb 1, 2013 at 0:04

You must log in to answer this question.

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