InitialConfigStorage implements ConfigStorage { @Override public void saveConfig(long version, NodeContext config) throws ConfigStorageException { if (version == INITIAL_VERSION) { throw new AssertionError("Invalid version: " + version); } underlying.saveConfig(version, config); } InitialConfigStorage(ConfigStorage underlying); @Override Config getConfig(long version); @Override void saveConfig(long version, NodeContext config); @Override void reset();  }
@Test(expected = AssertionError.class) public void attemptToSaveInitialVersion() throws Exception { InitialConfigStorage storage = new InitialConfigStorage(underlying); storage.saveConfig(0L, topology); }
@Test public void saveOtherVersion() throws Exception { InitialConfigStorage storage = new InitialConfigStorage(underlying); storage.saveConfig(1L, topology); verify(underlying).saveConfig(1L, topology); }