Search in sources :

Example 1 with UInt32Value

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

the class TypeConverterShould method map_uint32_to_int.

@Test
public void map_uint32_to_int() {
    final int value = 42;
    final UInt32Value wrapped = UInt32Value.newBuilder().setValue(value).build();
    final Any packed = AnyPacker.pack(wrapped);
    final int mapped = TypeConverter.toObject(packed, Integer.class);
    assertEquals(value, mapped);
}
Also used : UInt32Value(com.google.protobuf.UInt32Value) Any(com.google.protobuf.Any) Test(org.junit.Test)

Example 2 with UInt32Value

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

the class AggregateMessageDispatcherShould method dispatch_command.

@Test
public void dispatch_command() {
    final TestActorRequestFactory factory = TestActorRequestFactory.newInstance(getClass());
    final int messageValue = 2017_07_28;
    final UInt32Value message = UInt32Value.newBuilder().setValue(messageValue).build();
    final CommandEnvelope commandEnvelope = CommandEnvelope.of(factory.createCommand(message));
    final List<? extends Message> eventMessages = dispatchCommand(aggregate, commandEnvelope);
    assertTrue(aggregate.getState().getValue().contains(String.valueOf(messageValue)));
    assertEquals(1, eventMessages.size());
    assertTrue(eventMessages.get(0) instanceof StringValue);
}
Also used : TestActorRequestFactory(io.spine.client.TestActorRequestFactory) UInt32Value(com.google.protobuf.UInt32Value) CommandEnvelope(io.spine.core.CommandEnvelope) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Aggregations

UInt32Value (com.google.protobuf.UInt32Value)2 Test (org.junit.Test)2 Any (com.google.protobuf.Any)1 StringValue (com.google.protobuf.StringValue)1 TestActorRequestFactory (io.spine.client.TestActorRequestFactory)1 CommandEnvelope (io.spine.core.CommandEnvelope)1