Search in sources :

Example 41 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class AnyPackerShould method unpack_google_message_from_Any.

@Test
public void unpack_google_message_from_Any() {
    final Any any = Any.pack(googleMsg);
    final StringValue actual = AnyPacker.unpack(any);
    assertEquals(googleMsg, actual);
}
Also used : StringValue(com.google.protobuf.StringValue) Any(com.google.protobuf.Any) Test(org.junit.Test)

Example 42 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class WrappersShould method format.

@Test
public void format() {
    final StringValue str = Wrappers.format("%d %d %d", 1, 2, 3);
    assertEquals(str.getValue(), "1 2 3");
}
Also used : StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 43 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class EventPlayingEntityShould method return_builder_reflecting_current_state.

@Test
public void return_builder_reflecting_current_state() {
    final EventPlayingEntity entity = newEntity();
    final Message originalState = entity.builderFromState().build();
    final StringValue newState = newUuidValue();
    assertNotEquals(originalState, newState);
    TestTransaction.injectState(entity, newState, Version.getDefaultInstance());
    final Message modifiedState = entity.builderFromState().build();
    assertEquals(newState, modifiedState);
}
Also used : Message(com.google.protobuf.Message) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 44 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class CommandTestShould method stores_command_after_creation.

// This test verifies that Optionals
@SuppressWarnings("OptionalGetWithoutIsPresent")
// are initialized.
@Test
public void stores_command_after_creation() {
    final StringValue commandMessage = newUuidValue();
    final Command command = commandTest.createCommand(commandMessage);
    assertEquals(commandMessage, commandTest.commandMessage().get());
    assertEquals(command.getContext(), commandTest.commandContext().get());
    assertEquals(command, commandTest.command().get());
}
Also used : Command(io.spine.base.Command) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 45 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class CommandTestShould method create_command_with_custom_Timestamp.

@Test
public void create_command_with_custom_Timestamp() {
    final StringValue commandMessage = newUuidValue();
    final Timestamp timestamp = TimeTests.Past.minutesAgo(5);
    final Command command = commandTest.createCommand(commandMessage, timestamp);
    assertEquals(timestamp, command.getContext().getActorContext().getTimestamp());
}
Also used : Command(io.spine.base.Command) StringValue(com.google.protobuf.StringValue) Timestamp(com.google.protobuf.Timestamp) Test(org.junit.Test)

Aggregations

StringValue (com.google.protobuf.StringValue)75 Test (org.junit.Test)65 Timestamp (com.google.protobuf.Timestamp)8 Command (io.spine.base.Command)5 Command (io.spine.core.Command)5 Any (com.google.protobuf.Any)4 BoolValue (com.google.protobuf.BoolValue)4 Identifiers.idToString (io.spine.base.Identifiers.idToString)4 CommandContext (io.spine.core.CommandContext)4 Event (io.spine.core.Event)4 Wrapper.forString (io.spine.protobuf.Wrapper.forString)4 CommandBus (io.spine.server.commandbus.CommandBus)4 EventFactory (io.spine.server.event.EventFactory)4 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)4 Before (org.junit.Before)4 Optional (com.google.common.base.Optional)3 Message (com.google.protobuf.Message)3 Event (io.spine.base.Event)3 TestActorRequestFactory (io.spine.client.TestActorRequestFactory)3 CommandEnvelope (io.spine.core.CommandEnvelope)3