@@ -0,0 +1,2043 @@
+/*%0A * Copyright 2012-2014 Institut National des Sciences Appliqu%C3%A9es de Lyon (INSA-Lyon)%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 */%0A%0Apackage gololang.concurrent.async;%0A%0Aimport org.testng.annotations.Test;%0A%0Aimport java.util.HashSet;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.is;%0A%0Apublic class AssignedFutureTest %7B%0A%0A  @Test%0A  public void check_set_future() throws InterruptedException %7B%0A    Future future = AssignedFuture.setFuture(666);%0A    assertThat(future.isResolved(), is(true));%0A    assertThat(future.isFailed(), is(false));%0A    assertThat(future.get(), is((Object) 666));%0A    assertThat(future.blockingGet(), is((Object) 666));%0A    final HashSet%3CObject%3E set = new HashSet%3C%3E();%0A    future.onSet(new Functions.Observer() %7B%0A      @Override%0A      public void apply(Object value) %7B%0A        set.add(%22Ok%22);%0A      %7D%0A    %7D);%0A    assertThat(set.size(), is(1));%0A  %7D%0A%0A  @Test%0A  public void check_failed_future() throws InterruptedException %7B%0A    final RuntimeException omg = new RuntimeException(%22OMG%22);%0A    Future future = AssignedFuture.failedFuture(omg);%0A    assertThat(future.isResolved(), is(true));%0A    assertThat(future.isFailed(), is(true));%0A    assertThat(future.get(), is((Object) omg));%0A    assertThat(future.blockingGet(), is((Object) omg));%0A    final HashSet%3CObject%3E set = new HashSet%3C%3E();%0A    future.onFail(new Functions.Observer() %7B%0A      @Override%0A      public void apply(Object value) %7B%0A        set.add(%22Ok%22);%0A      %7D%0A    %7D);%0A    assertThat(set.size(), is(1));%0A  %7D%0A%7D%0A

Test coverage direct for set / failed futures