Ejemplo n.º 1
0
  @Test
  public void shouldOnlyNotifyAboutAnswersForNow() {
    IObservable unobservable =
        new IObservable() {
          public void addObserver(IObserver o) {}

          public void removeObserver(IObserver o) {}

          public boolean hasObserver(IObserver o) {
            return false;
          }

          public void notifyObservers(Object arg) {}
        };
    this.norbert.observe(unobservable, null);
    this.norbert.observe(this.question, null);
    assertEquals(this.norbert.getNotifications().size(), 0);

    // keep Cobertura happy
    unobservable.addObserver(this.norbert);
    unobservable.removeObserver(this.norbert);
    assertFalse(unobservable.hasObserver(this.norbert));
    unobservable.notifyObservers(this.norbert);
  }