title: How to check whether MatSnackBar is opened?
body: <p>Whenever there are errors, the snack bar should be opened, else it is dismissed. I want to test this,</p>
  
  <pre><code> handleErrors(error: ErrorMessage): void {
  this.snackBar.open(error.message, '', {
    duration: 15000
  })
  }
  
  routeToTallyConfig() {
   this.router.navigateByUrl(ROUTE_TALLY_CONFIG)
  }
  
  onStateChange(state) {
  if (Util.isNotNull(state)) {
    // check errors
    if (Util.isNotNull(state.error)) {
      this.loader.display(false)
      this.handleErrors(state.error)
    } else {
      // no errors
      this.loader.display(false)
      if (Util.isNotNull(state.user) &amp;&amp; Util.isNotNull(state.user.id)) {
        this.routeToTallyConfig()
      }
    }
  }
  }
  </code></pre>
  
  <p>In my tests, I will call the <code>onStateChange()</code> function by passing different values for state. On passing error, the snackbar should be displayed and it should be dismissed if there is no error. How can I test this behaviour in angular 4?</p>