title: How to spyOn a private function in service factory
body: <p>For the below service factory I want to check if foo() is called or not. And also want to validate the return values of the foo() function. Would anyone tell me how to use spyOn to do this using Jasmine? I am new to the Jasmine framework.</p>
  
  <pre><code>angular.module('myapp').
  factory('messageservice', ['$http', '$q', function ($http, $q) {
  
  function foo(query) {
      return 'foo';
  }
  
  function getServerMessages(query) {
      var query=foo();
      return $http.get(query))
                      .then(function (result) {
                          console.log('success');
                      }, function (err) {
                          debugger;
                          console.log('error');
                      });
  }
  
  return {
      getMessages: getFolderMessages,
      getMessageDetails: getServerMessages
  };
  }]);
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>Krishna</p>