PathMapper implements Mapper { @Override public Object keyForSource(RowProxy source) { try { return source.get(dbPath); } catch (IllegalArgumentException e) { throw new LmRuntimeException("Source does not contain key path: " + dbPath); } } PathMapper(String dbPath); @Override Expression expressionForKey(Object key); @Override Object keyForSource(RowProxy source); @Override Object keyForTarget(DataObject target); @Override String toString();  }
@Test public void testKeyForSource() { assertEquals("ABC", mapper.keyForSource(new TestRowProxy(Index.forLabels("a", "abc"), "A", "ABC"))); }
@Test public void testKeyForSource_NullKey() { assertEquals(null, mapper.keyForSource(new TestRowProxy(Index.forLabels("a", "abc"), "A", null))); }
@Test public void testKeyForSource_MissingKey() { assertThrows(LmRuntimeException.class, () -> mapper.keyForSource(new TestRowProxy(Index.forLabels("a"), "A"))); }