// Path: src/test/java/io/dazraf/vertx/TestUtils.java
// public class TestUtils {
//   public static final String RESULT_MSG = "result";
//   public static final int RESULT_INT = 42;
//   public static boolean RESULT_BOOL = true;
// }
// 
// Path: src/main/java/io/dazraf/vertx/futures/Futures.java
// static <T> Futures<T> when(Future<T> future) {
//   return FuturesImpl.when(future);
// }
// 
// Path: src/test/java/io/dazraf/vertx/futures/VertxMatcherAssert.java
// public static <T> void assertThat(TestContext context, T actual,
//                                   Matcher<? super T> matcher) {
//   assertThat(context, "", actual, matcher);
// }
// 
// Path: src/main/java/io/dazraf/vertx/futures/processors/IfProcessor.java
// public interface IfProcessor<T, R> extends FutureProcessor<T, R> {
// 
//   static <T, R> IfProcessor<T, R> ifSucceeded(FutureProcessor<T, R> processor) {
//     return future -> {
//       if (future.succeeded()) {
//         return processor.apply(future);
//       } else {
//         return failedFuture(future.cause());
//       }
//     };
//   }
// 
//   static <T> IfProcessor<T, T> ifFailed(FutureProcessor<T, T> processor) {
//     return future -> {
//       if (future.failed()) {
//         return processor.apply(future);
//       } else {
//         return succeededFuture(future.result());
//       }
//     };
//   }
// }
// 
// Path: src/main/java/io/dazraf/vertx/futures/processors/RunProcessor.java
// public interface RunProcessor<T> extends FutureProcessor<T, T> {
// 
//   Logger LOG = getLogger(RunProcessor.class);
// 
//   /**
//    * Observe the state of the chain. Any exceptions from the consumer will cause the chain to fail.
//    * @param consumer
//    * @param <T>
//    * @return
//    */
//   static <T> RunProcessor<T> runOnResponse(Handler<AsyncResult<T>> consumer) {
//     return future -> {
//       Future<T> result = Future.future();
//       try {
//         consumer.handle(future);
//         result.completer().handle(future);
//       } catch (Throwable error) {
//         LOG.error("consumer function failed", error);
//         result.fail(error);
//       }
//       return result;
//     };
//   }
// 
//   static <T> RunProcessor<T> run(Runnable runnable) {
//     return runOnResponse(success(runnable));
//   }
// 
//   static <T> RunProcessor<T> run(Consumer<T> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T1, T2> RunProcessor<Tuple2<T1, T2>> run(Consumer2<T1, T2> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T1, T2, T3> RunProcessor<Tuple3<T1, T2, T3>> run(Consumer3<T1, T2, T3> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T1, T2, T3, T4> RunProcessor<Tuple4<T1, T2, T3, T4>> run(Consumer4<T1, T2, T3, T4> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T1, T2, T3, T4, T5> RunProcessor<Tuple5<T1, T2, T3, T4, T5>> run(Consumer5<T1, T2, T3, T4, T5> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T> RunProcessor<T> runOnFail(Consumer<Throwable> consumer) {
//     return runOnResponse(failure(consumer));
//   }
// 
// }


import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.RunTestOnContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static io.dazraf.vertx.TestUtils.*;
import static io.dazraf.vertx.futures.Futures.when;
import static io.dazraf.vertx.futures.VertxMatcherAssert.assertThat;
import static io.dazraf.vertx.futures.processors.IfProcessor.*;
import static io.dazraf.vertx.futures.processors.RunProcessor.*;
import static io.vertx.core.Future.*;
import static org.hamcrest.CoreMatchers.is;
package io.dazraf.vertx.futures.processors;



@RunWith(VertxUnitRunner.class)
public class IfProcessorTest {
// Path: src/test/java/io/dazraf/vertx/TestUtils.java
// public class TestUtils {
//   public static final String RESULT_MSG = "result";
//   public static final int RESULT_INT = 42;
//   public static boolean RESULT_BOOL = true;
// }
// 
// Path: src/main/java/io/dazraf/vertx/futures/Futures.java
// static <T> Futures<T> when(Future<T> future) {
//   return FuturesImpl.when(future);
// }
// 
// Path: src/test/java/io/dazraf/vertx/futures/VertxMatcherAssert.java
// public static <T> void assertThat(TestContext context, T actual,
//                                   Matcher<? super T> matcher) {
//   assertThat(context, "", actual, matcher);
// }
// 
// Path: src/main/java/io/dazraf/vertx/futures/processors/IfProcessor.java
// public interface IfProcessor<T, R> extends FutureProcessor<T, R> {
// 
//   static <T, R> IfProcessor<T, R> ifSucceeded(FutureProcessor<T, R> processor) {
//     return future -> {
//       if (future.succeeded()) {
//         return processor.apply(future);
//       } else {
//         return failedFuture(future.cause());
//       }
//     };
//   }
// 
//   static <T> IfProcessor<T, T> ifFailed(FutureProcessor<T, T> processor) {
//     return future -> {
//       if (future.failed()) {
//         return processor.apply(future);
//       } else {
//         return succeededFuture(future.result());
//       }
//     };
//   }
// }
// 
// Path: src/main/java/io/dazraf/vertx/futures/processors/RunProcessor.java
// public interface RunProcessor<T> extends FutureProcessor<T, T> {
// 
//   Logger LOG = getLogger(RunProcessor.class);
// 
//   /**
//    * Observe the state of the chain. Any exceptions from the consumer will cause the chain to fail.
//    * @param consumer
//    * @param <T>
//    * @return
//    */
//   static <T> RunProcessor<T> runOnResponse(Handler<AsyncResult<T>> consumer) {
//     return future -> {
//       Future<T> result = Future.future();
//       try {
//         consumer.handle(future);
//         result.completer().handle(future);
//       } catch (Throwable error) {
//         LOG.error("consumer function failed", error);
//         result.fail(error);
//       }
//       return result;
//     };
//   }
// 
//   static <T> RunProcessor<T> run(Runnable runnable) {
//     return runOnResponse(success(runnable));
//   }
// 
//   static <T> RunProcessor<T> run(Consumer<T> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T1, T2> RunProcessor<Tuple2<T1, T2>> run(Consumer2<T1, T2> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T1, T2, T3> RunProcessor<Tuple3<T1, T2, T3>> run(Consumer3<T1, T2, T3> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T1, T2, T3, T4> RunProcessor<Tuple4<T1, T2, T3, T4>> run(Consumer4<T1, T2, T3, T4> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T1, T2, T3, T4, T5> RunProcessor<Tuple5<T1, T2, T3, T4, T5>> run(Consumer5<T1, T2, T3, T4, T5> consumer) {
//     return runOnResponse(success(consumer));
//   }
// 
//   static <T> RunProcessor<T> runOnFail(Consumer<Throwable> consumer) {
//     return runOnResponse(failure(consumer));
//   }
// 
// }


// Path: src/test/java/io/dazraf/vertx/futures/processors/IfProcessorTest.java
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.RunTestOnContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static io.dazraf.vertx.TestUtils.*;
import static io.dazraf.vertx.futures.Futures.when;
import static io.dazraf.vertx.futures.VertxMatcherAssert.assertThat;
import static io.dazraf.vertx.futures.processors.IfProcessor.*;
import static io.dazraf.vertx.futures.processors.RunProcessor.*;
import static io.vertx.core.Future.*;
import static org.hamcrest.CoreMatchers.is;

package io.dazraf.vertx.futures.processors;



@RunWith(VertxUnitRunner.class)
public class IfProcessorTest {
  @ClassRule