/*
 * Copyright 2015, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.spine3.testutil;

import com.google.protobuf.Any;
import com.google.protobuf.Timestamp;
import com.google.protobuf.util.TimeUtil;
import org.spine3.base.CommandContext;
import org.spine3.base.CommandRequest;
import org.spine3.base.UserId;
import org.spine3.protobuf.Messages;
import org.spine3.test.project.ProjectId;
import org.spine3.test.project.command.CreateProject;

import static org.spine3.testutil.ContextFactory.getCommandContext;

/**
 * The utility class which is used for creating CommandRequests for tests.
 *
 * @author Mikhail Mikhaylov
 */
@SuppressWarnings("UtilityClass")
public class CommandRequestFactory {

    private CommandRequestFactory() {
    }

    public static CommandRequest create(Timestamp when) {
        final UserId userId = UserId.getDefaultInstance();
        final Any command = Messages.toAny(CreateProject.newBuilder().setProjectId(
                AggregateIdFactory.createCommon()).build());

        final CommandRequest dummyCommandRequest = CommandRequest.newBuilder()
                .setContext(getCommandContext(userId, when))
                .setCommand(command)
                .build();
        return dummyCommandRequest;
    }

    public static CommandRequest create() {
        return create(TimeUtil.getCurrentTime());
    }

    public static CommandRequest createProject(UserId userId, ProjectId orderId) {

        CreateProject createOrder = CreateProject.newBuilder()
                .setProjectId(orderId)
                .build();

        CommandContext context = getCommandContext(userId);

        CommandRequest result = CommandRequest.newBuilder()
                .setCommand(Messages.toAny(createOrder))
                .setContext(context)
                .build();

        return result;
    }

}

@@ -1156,47 +1156,8 @@
 il;%0A
-import org.spine3.base.CommandContext;%0A
 impo
@@ -1263,50 +1263,8 @@
 es;%0A
-import org.spine3.test.project.ProjectId;%0A
 impo
@@ -2228,492 +2228,6 @@
   %7D%0A
-%0A    public static CommandRequest createProject(UserId userId, ProjectId orderId) %7B%0A%0A        CreateProject createOrder = CreateProject.newBuilder()%0A                .setProjectId(orderId)%0A                .build();%0A%0A        CommandContext context = getCommandContext(userId);%0A%0A        CommandRequest result = CommandRequest.newBuilder()%0A                .setCommand(Messages.toAny(createOrder))%0A                .setContext(context)%0A                .build();%0A%0A        return result;%0A    %7D%0A%0A
 %7D%0A

Remove "createProject" method from CommandRequestFactory.