Пример #1
0
 @Override
 public void redo() throws Exception {
   command.execute();
   command.undo();
   command.redo();
   verify(container, times(2)).addCard(card);
 }
Пример #2
0
 @Override
 public void undo() throws Exception {
   assertThat(command.canUndo(), is(false));
   command.execute();
   assertThat(command.canUndo(), is(true));
   command.undo();
   verify(container).removeCard(card);
 }
Пример #3
0
 @Override
 protected void createCommand() {
   command = new CreateCardCommand();
   card = mock(Card.class);
   command.setModel(card);
   container = mock(CardContainer.class);
   command.setContainer(container);
   command.initialize();
 }
Пример #4
0
 @Test
 public void initialize() throws Exception {
   CreateCardCommand command = new CreateCardCommand();
   command.initialize();
   assertThat(command.canExecute(), is(false));
   Card card = mock(Card.class);
   CardContainer container = mock(CardContainer.class);
   command.setModel(card);
   command.setContainer(container);
   command.initialize();
   assertThat(command.canExecute(), is(true));
 }
Пример #5
0
 @Override
 public void execute() throws Exception {
   command.execute();
   verify(container).addCard(card);
 }