DefaultRegistryImpl implements DefaultRegistry<C> { @Override public void setMaxSize(final int size) { if (size < 0) { throw new IllegalArgumentException("The registry size should be a positive number"); } this.maxStackSize = size; }  @Override void setMaxSize(final int size); @Override void register(final C item); @Override void clear(); @Override List<C> getHistory(); @Override void setRegistryChangeListener(final RegistryChangeListener registryChangeListener); @Override C peek(); @Override C pop(); @Override boolean isEmpty();  }
@Test public void testSettingWrongMax() { Assertions.assertThatThrownBy(() -> registry.setMaxSize(-1)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("The registry size should be a positive number"); }