@@ -0,0 +1,1862 @@
+/*%0A * Copyright 2015 the original author or authors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage net.kuujo.copycat.collections;%0A%0Aimport net.jodah.concurrentunit.ConcurrentTestCase;%0Aimport net.kuujo.copycat.log.BufferedLog;%0Aimport net.kuujo.copycat.test.TestCluster;%0Aimport org.testng.annotations.Test;%0A%0A/**%0A * Asynchronous set tests.%0A *%0A * @author %3Ca href=%22http://github.com/kuujo%22%3EJordan Halterman%3C/a%3E%0A */%0A@Test%0Apublic class AsyncSetTest extends ConcurrentTestCase %7B%0A%0A  /**%0A   * Sets adding and removing an item in the set.%0A   */%0A  public void testSetAddRemove() throws Throwable %7B%0A    TestCluster%3CAsyncSet%3CString%3E%3E cluster = TestCluster.of((uri, config) -%3E AsyncSet.%3CString%3Ecreate(%22test%22, uri, config, new AsyncSetConfig().withLog(new BufferedLog())));%0A    expectResume();%0A    cluster.open().thenRun(this::resume);%0A    await(5000);%0A%0A    AsyncSet%3CString%3E set = cluster.activeResources().iterator().next();%0A    expectResume();%0A    set.add(%22foo%22).thenRun(() -%3E %7B%0A      set.contains(%22foo%22).thenAccept(addContains -%3E %7B%0A        threadAssertTrue(addContains);%0A        set.remove(%22foo%22).thenAccept(removed -%3E %7B%0A          threadAssertTrue(removed);%0A          set.contains(%22foo%22).thenAccept(removeContains -%3E %7B%0A            threadAssertFalse(removeContains);%0A            resume();%0A          %7D);%0A        %7D);%0A      %7D);%0A    %7D);%0A    await(5000);%0A  %7D%0A%0A%7D%0A

Add asynchronous set test.