title: jasmine angular 4 unit test router.url
body: <p>I am unit testing a function in angular 4 project using jasmine which a switch  statement like mentioned below:</p>
  
  <pre><code>    switch(this.router.url) {
  
      case 'firstpath': {
                 // some code
              }
          break;
      case 'secondpath': {
                 // some more code
              }
         break;
      default:
          break;
  
      }
  </code></pre>
  
  <p>In my spec.ts file. I can't stub or change the value of router.url.I want my cases to execute but default is executing. I tried different ways to set or spyOn and return value, but everytime url is '/'. Every suggestion or solution will be welcomed.  </p>