### Question:
CursorPropertyAccessor implements NodePropertyAccessor, AutoCloseable { @Override public Value getNodePropertyValue( long nodeId, int propertyKeyId ) throws EntityNotFoundException { read.singleNode( nodeId, nodeCursor ); if ( !nodeCursor.next() ) { throw new EntityNotFoundException( EntityType.NODE, nodeId ); } nodeCursor.properties( propertyCursor ); while ( propertyCursor.next() ) { if ( propertyCursor.propertyKey() == propertyKeyId ) { return propertyCursor.propertyValue(); } } return Values.NO_VALUE; } CursorPropertyAccessor( NodeCursor nodeCursor, PropertyCursor propertyCursor, Read read ); @Override void close(); @Override Value getNodePropertyValue( long nodeId, int propertyKeyId );  }### Answer:
@Test public void shouldLookupProperty() throws EntityNotFoundException { 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() ); Value readValue = accessor.getNodePropertyValue( nodeId, propertyKeyId ); assertEquals( value, readValue ); }
@Test public void shouldReturnNoValueOnMissingProperty() throws EntityNotFoundException { 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() ); Value readValue = accessor.getNodePropertyValue( nodeId, 0 ); assertEquals( NO_VALUE, readValue ); }
@Test public void shouldThrowOnEntityNotFound() { 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() ); try { accessor.getNodePropertyValue( nodeId + 1, propertyKeyId ); fail(); } catch ( EntityNotFoundException e ) { } }