@Test public void randomOnNullPath() { @SuppressWarnings("resource") Function<JsonNode, Integer> fn = new MessageHashCodeFunctionSupplier(() -> null, random).get(); assertThat(fn.apply(message), is(RANDOM_VALUE)); }
@Override public Function<JsonNode, Integer> get() { return Optional .ofNullable(partitionPathSupplier.get()) .map(path -> new PartitionNodeFunction(path).andThen(new JsonNodeHashCodeFunction(random))) .orElse(path -> random.nextInt()); }
MessageHashCodeFunctionSupplier implements Supplier<Function<JsonNode, Integer>>, AutoCloseable { @Override public Function<JsonNode, Integer> get() { return Optional .ofNullable(partitionPathSupplier.get()) .map(path -> new PartitionNodeFunction(path).andThen(new JsonNodeHashCodeFunction(random))) .orElse(path -> random.nextInt()); } }
MessageHashCodeFunctionSupplier implements Supplier<Function<JsonNode, Integer>>, AutoCloseable { @Override public Function<JsonNode, Integer> get() { return Optional .ofNullable(partitionPathSupplier.get()) .map(path -> new PartitionNodeFunction(path).andThen(new JsonNodeHashCodeFunction(random))) .orElse(path -> random.nextInt()); } MessageHashCodeFunctionSupplier(Supplier<Path> partitionPathSupplier); }
MessageHashCodeFunctionSupplier implements Supplier<Function<JsonNode, Integer>>, AutoCloseable { @Override public Function<JsonNode, Integer> get() { return Optional .ofNullable(partitionPathSupplier.get()) .map(path -> new PartitionNodeFunction(path).andThen(new JsonNodeHashCodeFunction(random))) .orElse(path -> random.nextInt()); } MessageHashCodeFunctionSupplier(Supplier<Path> partitionPathSupplier); @Override Function<JsonNode, Integer> get(); @Override void close(); }
MessageHashCodeFunctionSupplier implements Supplier<Function<JsonNode, Integer>>, AutoCloseable { @Override public Function<JsonNode, Integer> get() { return Optional .ofNullable(partitionPathSupplier.get()) .map(path -> new PartitionNodeFunction(path).andThen(new JsonNodeHashCodeFunction(random))) .orElse(path -> random.nextInt()); } MessageHashCodeFunctionSupplier(Supplier<Path> partitionPathSupplier); @Override Function<JsonNode, Integer> get(); @Override void close();  }