Search in sources :

Example 1 with FloatValue

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

the class FloatFieldValidatorShould method wrap_to_any.

@Test
public void wrap_to_any() {
    final Any any = validator.wrap(VALUE);
    final FloatValue msg = AnyPacker.unpack(any);
    assertEquals(VALUE, (Float) msg.getValue());
}
Also used : FloatValue(com.google.protobuf.FloatValue) Any(com.google.protobuf.Any) Test(org.junit.Test)

Example 2 with FloatValue

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

the class AggregateMessageDispatcherShould method dispatch_event.

@Test
public void dispatch_event() {
    final TestEventFactory factory = TestEventFactory.newInstance(getClass());
    final float messageValue = 2017.0729f;
    final FloatValue message = FloatValue.newBuilder().setValue(messageValue).build();
    final EventEnvelope eventEnvelope = EventEnvelope.of(factory.createEvent(message));
    final List<? extends Message> eventMessages = dispatchEvent(aggregate, eventEnvelope);
    assertTrue(aggregate.getState().getValue().contains(String.valueOf(messageValue)));
    assertEquals(1, eventMessages.size());
    assertTrue(eventMessages.get(0) instanceof StringValue);
}
Also used : EventEnvelope(io.spine.core.EventEnvelope) TestEventFactory(io.spine.server.command.TestEventFactory) FloatValue(com.google.protobuf.FloatValue) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Aggregations

FloatValue (com.google.protobuf.FloatValue)2 Test (org.junit.Test)2 Any (com.google.protobuf.Any)1 StringValue (com.google.protobuf.StringValue)1 EventEnvelope (io.spine.core.EventEnvelope)1 TestEventFactory (io.spine.server.command.TestEventFactory)1