@Test public void shouldUseSilentChangeExecutorForAllExecutions() { exemplaryList.add("initial value"); doAnswer(new Answer<Object>() { @Override public Object answer(final InvocationOnMock invocation) { return null; } }).when(silentChangeExecutor).execute(any(), any(Runnable.class)); final AddToList addToList = new AddToList(exemplaryListId, exemplaryVersionChange, new Value( "should not be added"), 0); final RemoveFromList removeFromList = new RemoveFromList(exemplaryListId, exemplaryVersionChange, 0, 20); final ReplaceInList replaceInList = new ReplaceInList(exemplaryListId, exemplaryVersionChange, new Value( "replaced"), 0); cut.execute(addToList); cut.execute(removeFromList); cut.execute(replaceInList); assertThat(exemplaryList).containsExactly("initial value"); }
@Override public void execute(final AddToList command) { final List<Object> list = getListOrFail(command); final Object value = valueMapper.map(command.getValue()); silentChangeExecutor.execute(list, new Runnable() { @Override public void run() { list.add(command.getPosition(), value); } }); updateVersion(command); }
SimpleListPropertyCommandExecutor implements ListPropertyCommandExecutor { @Override public void execute(final AddToList command) { final List<Object> list = getListOrFail(command); final Object value = valueMapper.map(command.getValue()); silentChangeExecutor.execute(list, new Runnable() { @Override public void run() { list.add(command.getPosition(), value); } }); updateVersion(command); } }
SimpleListPropertyCommandExecutor implements ListPropertyCommandExecutor { @Override public void execute(final AddToList command) { final List<Object> list = getListOrFail(command); final Object value = valueMapper.map(command.getValue()); silentChangeExecutor.execute(list, new Runnable() { @Override public void run() { list.add(command.getPosition(), value); } }); updateVersion(command); } SimpleListPropertyCommandExecutor(final WeakObjectRegistry objectRegistry,
            final SilentChangeExecutor silentChangeExecutor, final ValueMapper valueMapper,
            final ListPropertyMetaDataStore listVersions); }
SimpleListPropertyCommandExecutor implements ListPropertyCommandExecutor { @Override public void execute(final AddToList command) { final List<Object> list = getListOrFail(command); final Object value = valueMapper.map(command.getValue()); silentChangeExecutor.execute(list, new Runnable() { @Override public void run() { list.add(command.getPosition(), value); } }); updateVersion(command); } SimpleListPropertyCommandExecutor(final WeakObjectRegistry objectRegistry,
            final SilentChangeExecutor silentChangeExecutor, final ValueMapper valueMapper,
            final ListPropertyMetaDataStore listVersions); @Override void execute(final AddToList command); @Override void execute(final RemoveFromList command); @Override void execute(final ReplaceInList command); }
SimpleListPropertyCommandExecutor implements ListPropertyCommandExecutor { @Override public void execute(final AddToList command) { final List<Object> list = getListOrFail(command); final Object value = valueMapper.map(command.getValue()); silentChangeExecutor.execute(list, new Runnable() { @Override public void run() { list.add(command.getPosition(), value); } }); updateVersion(command); } SimpleListPropertyCommandExecutor(final WeakObjectRegistry objectRegistry,
            final SilentChangeExecutor silentChangeExecutor, final ValueMapper valueMapper,
            final ListPropertyMetaDataStore listVersions); @Override void execute(final AddToList command); @Override void execute(final RemoveFromList command); @Override void execute(final ReplaceInList command);  }