@@ -0,0 +1,3241 @@
+/*%0A * Copyright 2017, TeamDev Ltd. All rights reserved.%0A *%0A * Redistribution and use in source and/or binary forms, with or without%0A * modification, must retain the above copyright notice and the following%0A * disclaimer.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS%0A * %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT%0A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR%0A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT%0A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,%0A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT%0A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,%0A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY%0A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT%0A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE%0A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0A%0Apackage io.spine.examples.todolist.action;%0A%0Aimport com.google.protobuf.StringValue;%0Aimport io.spine.examples.todolist.UserIoTest;%0Aimport io.spine.examples.todolist.view.ActionListView;%0Aimport io.spine.examples.todolist.view.command.CommandView;%0Aimport io.spine.validate.StringValueVBuilder;%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.DisplayName;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport static io.spine.examples.todolist.action.CommandActionTest.ACommandAction.VALUE_AFTER_UPDATE;%0Aimport static java.util.Collections.emptySet;%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0Aimport static org.junit.jupiter.api.Assertions.assertThrows;%0A%0A/**%0A * @author Dmytro Grankin%0A */%0A@DisplayName(%22CommandAction should%22)%0Aclass CommandActionTest extends UserIoTest %7B%0A%0A    private final CommandView%3CStringValue, StringValueVBuilder%3E view = new ACommandView();%0A    private final ACommandAction action = new ACommandAction();%0A%0A    @Override%0A    @BeforeEach%0A    protected void setUp() %7B%0A        super.setUp();%0A        view.setUserCommunicator(getCommunicator());%0A    %7D%0A%0A    @Test%0A    @DisplayName(%22not allow null source%22)%0A    void notAllowNullSource() %7B%0A        assertThrows(NullPointerException.class, () -%3E action.execute(null));%0A    %7D%0A%0A    @Test%0A    @DisplayName(%22update state of a view%22)%0A    void updateViewState() %7B%0A        addAnswer(ActionListView.getBackShortcut()%0A                                .getValue());%0A        action.execute(view);%0A        assertEquals(VALUE_AFTER_UPDATE, view.getState()%0A                                             .build()%0A                                             .getValue());%0A    %7D%0A%0A    static class ACommandAction extends CommandAction%3CStringValue, StringValueVBuilder%3E %7B%0A%0A        static final String VALUE_AFTER_UPDATE = %22updated%22;%0A%0A        private ACommandAction() %7B%0A            super(%22name%22, new Shortcut(%22s%22));%0A        %7D%0A%0A        @Override%0A        protected void updateState(StringValueVBuilder state) %7B%0A            state.setValue(VALUE_AFTER_UPDATE);%0A        %7D%0A    %7D%0A%0A    private static class ACommandView extends CommandView%3CStringValue, StringValueVBuilder%3E %7B%0A%0A        private ACommandView() %7B%0A            super(true, emptySet());%0A        %7D%0A    %7D%0A%7D%0A

Write tests for `CommandAction`