@Test @SuppressWarnings("unchecked") public void testRollback() { Consumer<Command<AbstractCanvasHandler, CanvasViolation>> fireComplete = mock(Consumer.class); tested = new RequestCommands.Builder() .onComplete(fireComplete) .onRollback(c -> command = (CompositeCommand<AbstractCanvasHandler, CanvasViolation>) c) .build(); tested.start(); tested.push(c1); tested.push(c2); tested.rollback(); tested.push(c3); tested.complete(); assertNotNull(command); assertTrue(command.getCommands().contains(c1)); assertTrue(command.getCommands().contains(c2)); assertTrue(command.getCommands().contains(c3)); verify(fireComplete, never()).accept(any()); }
@Override public void rollback() { rollback = true; }
RequestCommands implements CommandRequestLifecycle { @Override public void rollback() { rollback = true; } }
RequestCommands implements CommandRequestLifecycle { @Override public void rollback() { rollback = true; } RequestCommands(final Consumer<Command<AbstractCanvasHandler, CanvasViolation>> completedCommand,
                    final Consumer<Command<AbstractCanvasHandler, CanvasViolation>> rollbackCommand); }
RequestCommands implements CommandRequestLifecycle { @Override public void rollback() { rollback = true; } RequestCommands(final Consumer<Command<AbstractCanvasHandler, CanvasViolation>> completedCommand,
                    final Consumer<Command<AbstractCanvasHandler, CanvasViolation>> rollbackCommand); @Override void start(); void push(Command<AbstractCanvasHandler, CanvasViolation> command); @Override void rollback(); @Override void complete(); }
RequestCommands implements CommandRequestLifecycle { @Override public void rollback() { rollback = true; } RequestCommands(final Consumer<Command<AbstractCanvasHandler, CanvasViolation>> completedCommand,
                    final Consumer<Command<AbstractCanvasHandler, CanvasViolation>> rollbackCommand); @Override void start(); void push(Command<AbstractCanvasHandler, CanvasViolation> command); @Override void rollback(); @Override void complete();  }