### Question:
ZKExtOperations { public static <T> ListenableFuture<T> setOrCreate(ZKClient zkClient, String path, Supplier<T> dataSupplier, Codec<T> codec, int maxFailure) { return createOrSetWithRetry(false, zkClient, path, dataSupplier, codec, null, maxFailure); } private  ZKExtOperations(); static ListenableFuture<T> createOrSet(ZKClient zkClient, String path, Supplier<T> dataSupplier,
                                                    Codec<T> codec, int maxFailure); static ListenableFuture<T> createOrSet(ZKClient zkClient, String path, Supplier<T> dataSupplier,
                                                    Codec<T> codec, int maxFailure, List<ACL> acls); static ListenableFuture<T> setOrCreate(ZKClient zkClient, String path, Supplier<T> dataSupplier,
                                                    Codec<T> codec, int maxFailure); static ListenableFuture<V> updateOrCreate(ZKClient zkClient, String path,
                                                       Function<V, V> modifier, Codec<V> codec); static ListenableFuture<V> updateOrCreate(ZKClient zkClient, String path,
                                                       Function<V, V> modifier, Codec<V> codec,
                                                       @Nullable List<ACL> createAcl); static ListenableFuture<V> updateOrCreate(ZKClient zkClient, String path,
                                                       AsyncFunction<V, V> modifier, Codec<V> codec); static ListenableFuture<V> updateOrCreate(ZKClient zkClient, String path,
                                                       AsyncFunction<V, V> modifier, Codec<V> codec,
                                                       @Nullable List<ACL> createAcl);  }### Answer:
@Test public void testSetOrCreate() throws Exception { String path = "/parent/testSetOrCreate"; ZKClientService zkClient = ZKClientService.Builder.of(zkServer.getConnectionStr()).build(); zkClient.startAndWait(); Assert.assertEquals(1, ZKExtOperations.setOrCreate(zkClient, path, Suppliers.ofInstance(1), INT_CODEC, 0).get().intValue()); Assert.assertEquals(1, INT_CODEC.decode(zkClient.getData(path).get().getData()).intValue()); Assert.assertEquals(2, ZKExtOperations.setOrCreate(zkClient, path, Suppliers.ofInstance(2), INT_CODEC, 0).get().intValue()); Assert.assertEquals(2, INT_CODEC.decode(zkClient.getData(path).get().getData()).intValue()); zkClient.stopAndWait(); }