@Test public void validatesPaths() { final int maxPathLengthBytes = 768; final int maxPathDepth = 32; final String fire = new String(Character.toChars(128293)); final String base = new String(Character.toChars(26594)); List<String> goodKeys = Arrays.asList( UnitTestHelpers.repeatedString("k", maxPathLengthBytes - 1), UnitTestHelpers.repeatedString(fire, maxPathLengthBytes / 4 - 1), UnitTestHelpers.repeatedString(base, maxPathLengthBytes / 3 - 1), UnitTestHelpers.repeatedString("key/", maxPathDepth - 1) + "key"); List<String> badKeys = Arrays.asList( UnitTestHelpers.repeatedString("k", maxPathLengthBytes), UnitTestHelpers.repeatedString(fire, maxPathLengthBytes / 4), UnitTestHelpers.repeatedString(base, maxPathLengthBytes / 3), UnitTestHelpers.repeatedString("key/", maxPathDepth) + "key"); for (String key : goodKeys) { Path path = new Path(key); MutableData data = dataFor(UnitTestHelpers.buildObjFromPath(path, "test_value")); assertEquals("test_value", UnitTestHelpers.applyPath(data.getValue(), path)); data = dataForPath("scalar_value", key); assertEquals("scalar_value", data.getValue()); } for (String key : badKeys) { Path path = new Path(key); try { dataFor(UnitTestHelpers.buildObjFromPath(path, "test_value")); fail("Invalid path did not throw exception."); } catch (DatabaseException e) { } try { dataForPath("scalar_value", key); fail("Invalid path did not throw exception."); } catch (DatabaseException e) { } } }
@Nullable public Object getValue() { return getNode().getValue(); }
MutableData { @Nullable public Object getValue() { return getNode().getValue(); } }
MutableData { @Nullable public Object getValue() { return getNode().getValue(); } MutableData(Node node); private  MutableData(SnapshotHolder holder, Path path); }
MutableData { @Nullable public Object getValue() { return getNode().getValue(); } MutableData(Node node); private  MutableData(SnapshotHolder holder, Path path); boolean hasChildren(); boolean hasChild(@NonNull String path); @NonNull MutableData child(@NonNull String path); long getChildrenCount(); @NonNull Iterable<MutableData> getChildren(); @Nullable String getKey(); @Nullable Object getValue(); @Nullable T getValue(@NonNull Class<T> valueType); @Nullable T getValue(@NonNull GenericTypeIndicator<T> t); void setValue(@Nullable Object value); void setPriority(@Nullable Object priority); @Nullable Object getPriority(); @SuppressWarnings("EqualsHashCode") @Override boolean equals(Object o); @Override String toString(); }
MutableData { @Nullable public Object getValue() { return getNode().getValue(); } MutableData(Node node); private  MutableData(SnapshotHolder holder, Path path); boolean hasChildren(); boolean hasChild(@NonNull String path); @NonNull MutableData child(@NonNull String path); long getChildrenCount(); @NonNull Iterable<MutableData> getChildren(); @Nullable String getKey(); @Nullable Object getValue(); @Nullable T getValue(@NonNull Class<T> valueType); @Nullable T getValue(@NonNull GenericTypeIndicator<T> t); void setValue(@Nullable Object value); void setPriority(@Nullable Object priority); @Nullable Object getPriority(); @SuppressWarnings("EqualsHashCode") @Override boolean equals(Object o); @Override String toString();  }