### Question:
KVSaver extends Observable implements Saver { @Override public void save(String category, String key, String value) { synchronized (items) { Map<String, String> keyValues = items.get(category); if (keyValues == null) { keyValues = new LinkedHashMap<>(); items.put(category, keyValues); } keyValues.put(key, value); } setChanged(); notifyObservers(); }  @Override void save(String category, String key, String value); @Override void remove(String category, String key); @Override void remove(String category);  }### Answer:
@Test public void save_notifies_about_change() { final Observer observable = Mockito.mock(Observer.class); saver.addObserver(observable); saver.save("cat", "key1", "val1"); Mockito.verify(observable).update(Mockito.eq(saver), Mockito.any()); }
@Test public void update_notifies_about_change() { final Observer observable = Mockito.mock(Observer.class); saver.save("cat", "key1", "val1"); saver.addObserver(observable); saver.save("cat", "key1", "val2"); Mockito.verify(observable).update(Mockito.eq(saver), Mockito.any()); }