Search in sources :

Example 1 with StubPropertyCursor

use of org.neo4j.internal.kernel.api.helpers.StubPropertyCursor in project neo4j by neo4j.

the class CursorPropertyAccessorTest method shouldLookupProperty.

@Test
void shouldLookupProperty() throws EntityNotFoundException {
    // given
    long nodeId = 10;
    Value value = Values.of("abc");
    int propertyKeyId = 0;
    StubNodeCursor nodeCursor = new StubNodeCursor().withNode(nodeId, new long[] {}, genericMap(999, Values.of(12345), propertyKeyId, value));
    CursorPropertyAccessor accessor = new CursorPropertyAccessor(nodeCursor, new StubPropertyCursor(), new StubRead());
    // when
    Value readValue = accessor.getNodePropertyValue(nodeId, propertyKeyId, NULL);
    // then
    assertEquals(value, readValue);
}
Also used : StubNodeCursor(org.neo4j.internal.kernel.api.helpers.StubNodeCursor) StubRead(org.neo4j.internal.kernel.api.helpers.StubRead) Value(org.neo4j.values.storable.Value) StubPropertyCursor(org.neo4j.internal.kernel.api.helpers.StubPropertyCursor) Test(org.junit.jupiter.api.Test)

Example 2 with StubPropertyCursor

use of org.neo4j.internal.kernel.api.helpers.StubPropertyCursor in project neo4j by neo4j.

the class CursorPropertyAccessorTest method shouldReturnNoValueOnMissingProperty.

@Test
void shouldReturnNoValueOnMissingProperty() throws EntityNotFoundException {
    // given
    long nodeId = 10;
    StubNodeCursor nodeCursor = new StubNodeCursor().withNode(nodeId, new long[] {}, genericMap(999, Values.of(12345)));
    CursorPropertyAccessor accessor = new CursorPropertyAccessor(nodeCursor, new StubPropertyCursor(), new StubRead());
    // when
    Value readValue = accessor.getNodePropertyValue(nodeId, 0, NULL);
    // then
    assertEquals(NO_VALUE, readValue);
}
Also used : StubNodeCursor(org.neo4j.internal.kernel.api.helpers.StubNodeCursor) StubRead(org.neo4j.internal.kernel.api.helpers.StubRead) Value(org.neo4j.values.storable.Value) StubPropertyCursor(org.neo4j.internal.kernel.api.helpers.StubPropertyCursor) Test(org.junit.jupiter.api.Test)

Example 3 with StubPropertyCursor

use of org.neo4j.internal.kernel.api.helpers.StubPropertyCursor in project neo4j by neo4j.

the class CursorPropertyAccessorTest method shouldThrowOnEntityNotFound.

@Test
void shouldThrowOnEntityNotFound() {
    // given
    long nodeId = 10;
    Value value = Values.of("abc");
    int propertyKeyId = 0;
    StubNodeCursor nodeCursor = new StubNodeCursor().withNode(nodeId, new long[] {}, genericMap(999, Values.of(12345), propertyKeyId, value));
    CursorPropertyAccessor accessor = new CursorPropertyAccessor(nodeCursor, new StubPropertyCursor(), new StubRead());
    // when
    assertThrows(EntityNotFoundException.class, () -> accessor.getNodePropertyValue(nodeId + 1, propertyKeyId, NULL));
}
Also used : StubNodeCursor(org.neo4j.internal.kernel.api.helpers.StubNodeCursor) StubRead(org.neo4j.internal.kernel.api.helpers.StubRead) Value(org.neo4j.values.storable.Value) StubPropertyCursor(org.neo4j.internal.kernel.api.helpers.StubPropertyCursor) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 StubNodeCursor (org.neo4j.internal.kernel.api.helpers.StubNodeCursor)3 StubPropertyCursor (org.neo4j.internal.kernel.api.helpers.StubPropertyCursor)3 StubRead (org.neo4j.internal.kernel.api.helpers.StubRead)3 Value (org.neo4j.values.storable.Value)3