// Path: qbit/core/src/main/java/io/advantageous/qbit/reactive/Callback.java
// public interface Callback<T> extends io.advantageous.reakt.CallbackHandler<T> {
// 
// 
//     /**
//      * Client View (client of the service)
//      * Called when there is an error
//      *
//      * @param error error
//      */
//     default void onError(final Throwable error) {
// 
//         LoggerFactory.getLogger(Callback.class)
//                 .error(error.getMessage(), error);
// 
//     }
// 
//     /**
//      * Performs this operation on the given argument.
//      *
//      * @param t the input argument
//      */
//     void accept(T t);
// 
// 
//     @Override
//     default void onResult(Result<T> result) {
//         if (result.failure()) {
//             onError(result.cause());
//         } else {
//             accept(result.get());
//         }
//     }
// 
// 
//     /**
//      * Called if there is a timeout.
//      * <p>
//      * This will be taken out in Reakt 3.0 (and QBit 2.0).
//      * Use reject instead.
//      */
//     default void onTimeout() {
//     }
// 
// 
//     /**
//      * Service View (service)
//      * Return an error message
//      * alias for reject.
//      * <p>
//      * This will be taken out in Reakt 3.0 (and QBit 2.0).
//      * Use reject instead.
//      *
//      * @param error error
//      */
//     @Deprecated
//     @SuppressWarnings("deprecated")
//     default void returnError(final String error) {
//         reject(error);
//     }
// 
// 
//     /**
//      * Service View (service)
//      * alias for reply
//      * <p>
//      * This will be taken out in Reakt 3.0 (and QBit 2.0).
//      * Use resolve or reply instead.
//      *
//      * @param thisReturn the value to return.
//      */
//     @Deprecated
//     @SuppressWarnings("deprecated")
//     default void returnThis(T thisReturn) {
//         resolve(thisReturn);
//     }
// 
// 
// }
// 
// Path: qbit/core/src/main/java/io/advantageous/qbit/reakt/Reakt.java
// public static <T> Callback<T> convertPromise(final Promise<T> promise) {
//     return convertPromiseToCallback(promise, CallbackBuilder.callbackBuilder());
// }
// 
// Path: qbit/core/src/main/java/io/advantageous/qbit/reakt/Reakt.java
// public static <T> io.advantageous.reakt.CallbackHandler<T> convertQBitCallback(final Callback<T> callback) {
//     return result -> {
// 
//         if (result.failure()) {
//             callback.onError(result.cause());
//         } else {
//             callback.accept(result.get());
//         }
//     };
// }


import io.advantageous.qbit.reactive.Callback;
import io.advantageous.qbit.reactive.Reactor;
import io.advantageous.qbit.reactive.ReactorBuilder;
import io.advantageous.reakt.Result;
import io.advantageous.reakt.promise.Promise;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicReference;
import static io.advantageous.qbit.reakt.Reakt.convertPromise;
import static io.advantageous.qbit.reakt.Reakt.convertQBitCallback;
import static io.advantageous.reakt.promise.Promises.promise;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static org.junit.Assert.*;
package io.advantageous.qbit.reakt;




public class ReaktTest {


    @Test
    public void testConvertPromiseSuccess() throws Exception {

        final AtomicReference<Employee> ref = new AtomicReference<>();
        final Promise<Employee> promise = promise();

        /* Set then callback in promise. */
        promise.then(ref::set);

        /* Convert promise to callback and then call the callback. */
// Path: qbit/core/src/main/java/io/advantageous/qbit/reactive/Callback.java
// public interface Callback<T> extends io.advantageous.reakt.CallbackHandler<T> {
// 
// 
//     /**
//      * Client View (client of the service)
//      * Called when there is an error
//      *
//      * @param error error
//      */
//     default void onError(final Throwable error) {
// 
//         LoggerFactory.getLogger(Callback.class)
//                 .error(error.getMessage(), error);
// 
//     }
// 
//     /**
//      * Performs this operation on the given argument.
//      *
//      * @param t the input argument
//      */
//     void accept(T t);
// 
// 
//     @Override
//     default void onResult(Result<T> result) {
//         if (result.failure()) {
//             onError(result.cause());
//         } else {
//             accept(result.get());
//         }
//     }
// 
// 
//     /**
//      * Called if there is a timeout.
//      * <p>
//      * This will be taken out in Reakt 3.0 (and QBit 2.0).
//      * Use reject instead.
//      */
//     default void onTimeout() {
//     }
// 
// 
//     /**
//      * Service View (service)
//      * Return an error message
//      * alias for reject.
//      * <p>
//      * This will be taken out in Reakt 3.0 (and QBit 2.0).
//      * Use reject instead.
//      *
//      * @param error error
//      */
//     @Deprecated
//     @SuppressWarnings("deprecated")
//     default void returnError(final String error) {
//         reject(error);
//     }
// 
// 
//     /**
//      * Service View (service)
//      * alias for reply
//      * <p>
//      * This will be taken out in Reakt 3.0 (and QBit 2.0).
//      * Use resolve or reply instead.
//      *
//      * @param thisReturn the value to return.
//      */
//     @Deprecated
//     @SuppressWarnings("deprecated")
//     default void returnThis(T thisReturn) {
//         resolve(thisReturn);
//     }
// 
// 
// }
// 
// Path: qbit/core/src/main/java/io/advantageous/qbit/reakt/Reakt.java
// public static <T> Callback<T> convertPromise(final Promise<T> promise) {
//     return convertPromiseToCallback(promise, CallbackBuilder.callbackBuilder());
// }
// 
// Path: qbit/core/src/main/java/io/advantageous/qbit/reakt/Reakt.java
// public static <T> io.advantageous.reakt.CallbackHandler<T> convertQBitCallback(final Callback<T> callback) {
//     return result -> {
// 
//         if (result.failure()) {
//             callback.onError(result.cause());
//         } else {
//             callback.accept(result.get());
//         }
//     };
// }


// Path: qbit/core/src/test/java/io/advantageous/qbit/reakt/ReaktTest.java
import io.advantageous.qbit.reactive.Callback;
import io.advantageous.qbit.reactive.Reactor;
import io.advantageous.qbit.reactive.ReactorBuilder;
import io.advantageous.reakt.Result;
import io.advantageous.reakt.promise.Promise;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicReference;
import static io.advantageous.qbit.reakt.Reakt.convertPromise;
import static io.advantageous.qbit.reakt.Reakt.convertQBitCallback;
import static io.advantageous.reakt.promise.Promises.promise;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static org.junit.Assert.*;

package io.advantageous.qbit.reakt;




public class ReaktTest {


    @Test
    public void testConvertPromiseSuccess() throws Exception {

        final AtomicReference<Employee> ref = new AtomicReference<>();
        final Promise<Employee> promise = promise();

        /* Set then callback in promise. */
        promise.then(ref::set);

        /* Convert promise to callback and then call the callback. */
        final io.advantageous.reakt.Callback<Employee> employeeCallback = convertQBitCallback(convertPromise(promise));