Search in sources :

Example 21 with Message

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

the class ValidateShould method verify_that_message_is_not_in_default_state.

@Test
public void verify_that_message_is_not_in_default_state() {
    final Message msg = Wrapper.forString("check_if_message_is_not_in_default_state");
    assertTrue(isNotDefault(msg));
    assertFalse(isNotDefault(StringValue.getDefaultInstance()));
}
Also used : Message(com.google.protobuf.Message) Test(org.junit.Test)

Example 22 with Message

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

the class ValidateShould method verify_that_message_is_in_default_state.

@Test
public void verify_that_message_is_in_default_state() {
    final Message nonDefault = newUuidValue();
    assertTrue(isDefault(StringValue.getDefaultInstance()));
    assertFalse(isDefault(nonDefault));
}
Also used : Message(com.google.protobuf.Message) Test(org.junit.Test)

Example 23 with Message

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

the class MessageValidatorShould method minDecimalNumberTest.

/*
     * Utility methods.
     */
private void minDecimalNumberTest(double value, boolean inclusive, boolean isValid) {
    final Message msg = inclusive ? DecimalMinIncNumberFieldValue.newBuilder().setValue(value).build() : DecimalMinNotIncNumberFieldValue.newBuilder().setValue(value).build();
    validate(msg);
    assertIsValid(isValid);
}
Also used : EnclosedMessageFieldValueWithCustomInvalidMessage(io.spine.test.validate.msg.EnclosedMessageFieldValueWithCustomInvalidMessage) EnclosedMessageFieldValueWithoutAnnotationFieldValueWithCustomInvalidMessage(io.spine.test.validate.msg.EnclosedMessageFieldValueWithoutAnnotationFieldValueWithCustomInvalidMessage) Message(com.google.protobuf.Message)

Example 24 with Message

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

the class MessageValidatorShould method digitsCountTest.

private void digitsCountTest(double value, boolean isValid) {
    final Message msg = DigitsCountNumberFieldValue.newBuilder().setValue(value).build();
    validate(msg);
    assertIsValid(isValid);
}
Also used : EnclosedMessageFieldValueWithCustomInvalidMessage(io.spine.test.validate.msg.EnclosedMessageFieldValueWithCustomInvalidMessage) EnclosedMessageFieldValueWithoutAnnotationFieldValueWithCustomInvalidMessage(io.spine.test.validate.msg.EnclosedMessageFieldValueWithoutAnnotationFieldValueWithCustomInvalidMessage) Message(com.google.protobuf.Message)

Example 25 with Message

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

the class RecordBasedRepositoryShould method assertMatches.

private static <E extends AbstractVersionableEntity<?, ?>> void assertMatches(E entity, FieldMask fieldMask) {
    final Message state = entity.getState();
    Tests.assertMatchesMask(state, fieldMask);
}
Also used : Message(com.google.protobuf.Message)

Aggregations

Message (com.google.protobuf.Message)266 Test (org.junit.Test)84 Any (com.google.protobuf.Any)30 ByteString (com.google.protobuf.ByteString)17 IOException (java.io.IOException)16 ArrayList (java.util.ArrayList)15 Command (io.spine.core.Command)14 DynamicMessage (com.google.protobuf.DynamicMessage)13 FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)10 EntityRecord (io.spine.server.entity.EntityRecord)10 Test (org.junit.jupiter.api.Test)9 HeronTuples (com.twitter.heron.proto.system.HeronTuples)8 Event (io.spine.core.Event)8 InvocationTargetException (java.lang.reflect.InvocationTargetException)8 Method (java.lang.reflect.Method)8 Event (io.spine.base.Event)7 MockHttpInputMessage (org.springframework.http.MockHttpInputMessage)7 MockHttpOutputMessage (org.springframework.http.MockHttpOutputMessage)7 Descriptor (com.google.protobuf.Descriptors.Descriptor)6 Builder (com.google.protobuf.Message.Builder)5