title: First error: INVALID_CROSS_REFERENCE_KEY, Assigned To ID: owner cannot be blank: [OwnerId]
body: <p>I am writing a test for my controller. For that I have to insert an event in the test database.</p>
  
  <p>My test method is:</p>
  
  <pre><code>static TestMethod void Test1_TestInsertWithValue()
  {
      Meeting_Master__c master = new Meeting_Master__c();
      Event event = new Event();
      Profile p = [SELECT Id From Profile WHERE Name='Standard User'];
      User u2 = new User(Alias = 'newUser', Email = 'newuser@testorg.com', EmailEncodingKey = 'UTF-8', LastName = 'Testing',
      LanguageLocaleKey = 'en_US', LocaleSidKey='America/Los_Angeles', UserName='newuser@testorg.com', ProfileId=p.Id);
  
      event.OwnerId = u2.Id;
      event.StartDateTime = datetime.newInstance(2008, 12, 1);
      event.EndDateTime = datetime.newInstance(2008, 12, 30);
      event.subject = 'call';
      event.WhatId = master.Id;
      insert master;
      insert event;
      ...........
  }
  </code></pre>
  
  <p>When the insert event occurs, I am facing this error:</p>
  
  <blockquote>
    <p>System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Assigned To ID: owner cannot be blank: [OwnerId]</p>
  </blockquote>
  
  <p>How do I rectify this error?</p>