@Test
public void flattenPreservesWrapper() {

    KeySpace keySpace = new KeySpace(
            new KeySpaceDirectory("a", KeyType.STRING, PathA::new)
                    .addSubdirectory(new KeySpaceDirectory("b", KeyType.STRING, PathB::new)));
    final FDBDatabase database = FDBDatabaseFactory.instance().getDatabase();
    List<KeySpacePath> path = keySpace.path("a", "foo").add("b", "bar").flatten();
    assertThat("a should be pathA", path.get(0), instanceOf(PathA.class));
    assertThat("b should be pathB", path.get(1), instanceOf(PathB.class));
}