KogitoCommandRegistry implements Registry<C> { @Override public void setMaxSize(int size) { if (size < 0) { throw new IllegalArgumentException("The registry size should be a positive number"); } wrapped.setMaxSize(size); } KogitoCommandRegistry();   KogitoCommandRegistry(Supplier<Boolean> envelopeEnabledSupplier, Supplier<KogitoJSCommandRegistry<C>> kogitoJSCommandRegistrySupplier); @Override void register(C item); @Override C peek(); @Override C pop(); @Override List<C> getHistory(); @Override void setMaxSize(int size); @Override void clear(); @Override boolean isEmpty(); @Override void setRegistryChangeListener(final RegistryChangeListener registryChangeListener);  }
@Test public void testSetMaxSize() { commandRegistry.setMaxSize(1); verify(kogitoJSCommandRegistry).setMaxSize(eq(1)); }
@Test public void testSettingWrongMaxSize() { Assertions.assertThatThrownBy(() -> commandRegistry.setMaxSize(-1)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("The registry size should be a positive number"); }