+ void verifyChangeEvents() {
+ Collection<DataTreeCandidate> changes = new ArrayList<>(changes());
+ Iterator<DataTreeCandidate> iter = changes.iterator();
+ while (iter.hasNext()) {
+ DataTreeCandidate dataTreeModification = iter.next();
+ for (Function<DataTreeCandidate, Boolean> matcher: matchers) {
+ if (matcher.apply(dataTreeModification)) {
+ iter.remove();
+ break;
+ }
+ }
+ }
+
+ if (!changes.isEmpty()) {
+ DataTreeCandidate mod = changes.iterator().next();
+ fail(String.format("Received unexpected notification: type: %s, path: %s, before: %s, after: %s",
+ mod.getRootNode().getModificationType(), mod.getRootPath(),
+ mod.getRootNode().getDataBefore(), mod.getRootNode().getDataAfter()));
+ }
+ }
+
+ void verifyNoChangeEvent() {
+ try {
+ Object unexpected = internalListener.future.get(500, TimeUnit.MILLISECONDS);
+ fail("Got unexpected Data tree change notifications: " + unexpected);
+ } catch (TimeoutException e) {
+ // Expected
+ } catch (InterruptedException | ExecutionException e) {
+ throw new AssertionError("Data tree change notifications failed", e);
+ }
+ }