@@ -0,0 +1,1976 @@
+package jetbrains.jetpad.base;%0A%0Aimport org.junit.Test;%0A%0Aimport java.util.ConcurrentModificationException;%0A%0Apublic class SimpleAsyncRegistrationsTest %7B%0A  private SimpleAsync%3CVoid%3E async = new SimpleAsync%3C%3E();%0A%0A  @Test%0A  public void removeSuccessRegistration() %7B%0A    Registration reg = async.handle(throwingHandler());%0A    reg.remove();%0A    async.success(null);%0A  %7D%0A%0A  @Test%0A  public void removeFailureRegistration() %7B%0A    Registration reg = async.handleFailure(throwingFailureHandler());%0A    reg.remove();%0A    async.failure(null);%0A  %7D%0A%0A  @Test%0A  public void removeCompositeRegistration1() %7B%0A    Registration reg = async.handle(throwingHandler(), throwingFailureHandler());%0A    reg.remove();%0A    async.success(null);%0A  %7D%0A%0A  @Test%0A  public void removeCompositeRegistration2() %7B%0A    Registration reg = async.handle(throwingHandler(), throwingFailureHandler());%0A    reg.remove();%0A    async.failure(null);%0A  %7D%0A%0A  @Test(expected = ConcurrentModificationException.class)%0A  public void removeRegistrationInSuccessHandler() %7B%0A    final Value%3CRegistration%3E regValue = new Value%3C%3E();%0A    Registration reg = async.handle(new Handler%3CVoid%3E() %7B%0A      @Override%0A      public void handle(Void item) %7B%0A        regValue.get().remove();%0A      %7D%0A    %7D);%0A    regValue.set(reg);%0A    async.success(null);%0A  %7D%0A%0A  @Test(expected = ConcurrentModificationException.class)%0A  public void removeRegistrationInFailureHandler() %7B%0A    final Value%3CRegistration%3E regValue = new Value%3C%3E();%0A    Registration reg = async.handleFailure(new Handler%3CThrowable%3E() %7B%0A      @Override%0A      public void handle(Throwable item) %7B%0A        regValue.get().remove();%0A      %7D%0A    %7D);%0A    regValue.set(reg);%0A    async.failure(null);%0A  %7D%0A%0A  private Handler%3CThrowable%3E throwingFailureHandler() %7B%0A    return throwingHandler();%0A  %7D%0A%0A  private %3CItemT%3E Handler%3CItemT%3E throwingHandler() %7B%0A    return new Handler%3CItemT%3E() %7B%0A      @Override%0A      public void handle(ItemT item) %7B%0A        throw new RuntimeException();%0A      %7D%0A    %7D;%0A  %7D%0A%7D%0A

add tests for implementation of new methods in SimpleAsync