use of io.spine.test.TestActorRequestFactory in project core-java by SpineEventEngine.
the class CommandServiceShould method return_error_if_command_is_unsupported.
@Test
public void return_error_if_command_is_unsupported() {
final TestActorRequestFactory factory = TestActorRequestFactory.newInstance(getClass());
final Command unsupportedCmd = factory.createCommand(StringValue.getDefaultInstance());
service.post(unsupportedCmd, responseObserver);
final Throwable exception = responseObserver.getThrowable().getCause();
assertEquals(UnsupportedCommandException.class, exception.getClass());
}
use of io.spine.test.TestActorRequestFactory in project core-java by SpineEventEngine.
the class FailureBusShould method invalidProjectNameFailure.
private static Failure invalidProjectNameFailure() {
final ProjectId projectId = ProjectId.newBuilder().setId(newUuid()).build();
final ProjectFailures.InvalidProjectName invalidProjectName = ProjectFailures.InvalidProjectName.newBuilder().setProjectId(projectId).build();
final StringChange nameChange = StringChange.newBuilder().setNewValue("Too short").build();
final UpdateProjectName updateProjectName = UpdateProjectName.newBuilder().setId(projectId).setNameUpdate(nameChange).build();
final TenantId generatedTenantId = TenantId.newBuilder().setValue(newUuid()).build();
final TestActorRequestFactory factory = TestActorRequestFactory.newInstance(FailureBusShould.class, generatedTenantId);
final Command command = factory.createCommand(updateProjectName);
return Failures.createFailure(invalidProjectName, command);
}
use of io.spine.test.TestActorRequestFactory in project core-java by SpineEventEngine.
the class EventsShould method setUp.
@Before
public void setUp() {
final TestActorRequestFactory requestFactory = TestActorRequestFactory.newInstance(getClass());
final Command cmd = requestFactory.command().create(Time.getCurrentTime());
final StringValue producerId = Wrapper.forString(getClass().getSimpleName());
EventFactory eventFactory = EventFactory.newBuilder().setCommandId(Commands.generateId()).setProducerId(producerId).setCommandContext(cmd.getContext()).build();
event = eventFactory.createEvent(Time.getCurrentTime(), Tests.<Version>nullRef());
context = event.getContext();
}
use of io.spine.test.TestActorRequestFactory in project core-java by SpineEventEngine.
the class FailureThrowableShould method setUp.
@Before
public void setUp() {
final TestActorRequestFactory requestFactory = TestActorRequestFactory.newInstance(FailureThrowable.class);
this.command = requestFactory.command().create(newUuidValue());
}
Aggregations