Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed an unmanaged app (by @michaelforce 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?

share|improve this question
Here is the line from the test: System.assert(oPEE.priceBookCheck()!=null); – Bart__c Jan 31 '13 at 22:59
up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
I did comment out that (below) section, and the test passed. Now what? System.assert(oPEE.priceBookCheck()!=null); – Bart__c Jan 31 '13 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. – Peter Knolle Jan 31 '13 at 23:26
It worked! Thanks so much! – Bart__c Jan 31 '13 at 23:55
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. – Peter Knolle Feb 1 '13 at 0:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.