title: trying to write a test for an apex trigger
body: <p>I'm working on a trigger/test class and i can't figure out how to get the test class to work. I know that i need to update my opportunity to use the trigger but i'm not sure how to and then how to verify that my trigger is working.</p>
  
  <p>Trigger:</p>
  
  <pre><code>trigger add_primary_advisor on Opportunity(before update) {
  for(Opportunity o: Trigger.new){    
  
       if (o.IsClosed &amp;&amp; !Trigger.oldMap.get(o.id).IsClosed) {
         OpportunityContactRole contactRole =
              [select ContactID from OpportunityContactRole where IsPrimary = true and OpportunityId = :o.id];
         if (contactRole != null) {
           o.Primary_Advisor__c=contactRole.ContactID;
         }
       }
     }    
  }
  </code></pre>
  
  <p>Test class:</p>
  
  <pre><code>@isTest
  private class primary_advisor_test {
      static testMethod void primary_advisor(){
      Opportunity opp = new Opportunity(Name='test opp', StageName='stage', Probability = 95, CloseDate=system.today());
      insert opp;
  
  
  update opp; 
  
  }
  </code></pre>
  
  <p>}</p>