Search in sources :

Example 1 with ValueUtils.asMapValue

use of org.neo4j.kernel.impl.util.ValueUtils.asMapValue in project neo4j by neo4j.

the class DiscardMessageTest method shouldThrowExceptionIfFailedToParseTransactionMetadataCorrectly.

@Test
void shouldThrowExceptionIfFailedToParseTransactionMetadataCorrectly() throws Throwable {
    // Given
    Map<String, Object> msgMetadata = map("n", "invalid value type");
    MapValue meta = ValueUtils.asMapValue(msgMetadata);
    // When & Then
    BoltIOException exception = assertThrows(BoltIOException.class, () -> new DiscardMessage(meta));
    assertThat(exception.getMessage()).startsWith("Expecting DISCARD size n to be a Long value, but got: String(\"invalid value type\")");
}
Also used : BoltIOException(org.neo4j.bolt.messaging.BoltIOException) ValueUtils.asMapValue(org.neo4j.kernel.impl.util.ValueUtils.asMapValue) MapValue(org.neo4j.values.virtual.MapValue) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 BoltIOException (org.neo4j.bolt.messaging.BoltIOException)1 ValueUtils.asMapValue (org.neo4j.kernel.impl.util.ValueUtils.asMapValue)1 MapValue (org.neo4j.values.virtual.MapValue)1