// Path: src/test/java/com/sulaco/fuse/ActorAwareTest.java
// @Ignore
// public class ActorAwareTest {
// 
//     ActorSystem system = ActorSystem.create("test");
// 
//     @Mock protected ApplicationContext mockAppCtx;
// 
//     @Mock protected AutowireCapableBeanFactory mockAutowireFactory;
// 
//     @Mock protected WireProtocol mockProto;
// 
//     @Mock protected Timer mockMeter;
// 
//     protected void setup() {
//         when(mockAppCtx.getAutowireCapableBeanFactory()).thenReturn(mockAutowireFactory);
//     }
// 
//     protected <T extends FuseEndpointActor> TestActorRef<T> mockEndpoint(Class<T> clazz) {
//         Props props = Props.create(clazz);
//         TestActorRef<T> testActorRef = TestActorRef.create(system, props);
//         testActorRef.underlyingActor().setProto(mockProto);
//         testActorRef.underlyingActor().autowire(mockAppCtx);
// 
//         return testActorRef;
//     }
// 
// }
// 
// Path: src/main/java/com/sulaco/fuse/akka/actor/RouteFinderActor.java
// public class RouteFinderActor extends FuseEndpointActor {
// 
//     @Autowired protected RoutesConfig routes;
//     
//     @Override
//     protected void onRequest(final FuseRequestMessage message) {
//         
//         String uri = message.getRequest().getUri();
//         
//         Optional<Route> route = routes.getFuseRoute(uri);
// 
//         if (route.isPresent()) {
//             Route rte = route.get();
// 
//             // add route to the message
//             ((FuseRequestMessageImpl) message).setRoute(rte);
// 
//             // pass message to handling actor
//             rte.getHandler()
//                .getActor()
//                .ifPresent(
//                    handler -> {
//                        HttpMethod requested = message.getRequest().getMethod();
//                        HttpMethod supported = rte.getHandler().getHttpMethod();
// 
//                        if (supported.compareTo(requested) == 0) {
//                            handler.tell(message, getSelf());
//                        }
//                        else {
//                            info(requested +" not supported by " + uri.toString());
//                            unhandled(message);
//                        }
//                    }
//                );
//         }
//         else {
//             unhandled(message);
//         }
//     }
// 
//     public void setRoutes(RoutesConfig routes) {
//         this.routes = routes;
//     }
//     
// }


import akka.testkit.TestActorRef;
import com.sulaco.fuse.ActorAwareTest;
import com.sulaco.fuse.akka.actor.RouteFinderActor;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.HttpRequest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnit44Runner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
package com.sulaco.fuse.netty;




@RunWith(MockitoJUnit44Runner.class)
public class FuseChannelHandlerTest extends ActorAwareTest {

    FuseChannelHandler instance;

// Path: src/test/java/com/sulaco/fuse/ActorAwareTest.java
// @Ignore
// public class ActorAwareTest {
// 
//     ActorSystem system = ActorSystem.create("test");
// 
//     @Mock protected ApplicationContext mockAppCtx;
// 
//     @Mock protected AutowireCapableBeanFactory mockAutowireFactory;
// 
//     @Mock protected WireProtocol mockProto;
// 
//     @Mock protected Timer mockMeter;
// 
//     protected void setup() {
//         when(mockAppCtx.getAutowireCapableBeanFactory()).thenReturn(mockAutowireFactory);
//     }
// 
//     protected <T extends FuseEndpointActor> TestActorRef<T> mockEndpoint(Class<T> clazz) {
//         Props props = Props.create(clazz);
//         TestActorRef<T> testActorRef = TestActorRef.create(system, props);
//         testActorRef.underlyingActor().setProto(mockProto);
//         testActorRef.underlyingActor().autowire(mockAppCtx);
// 
//         return testActorRef;
//     }
// 
// }
// 
// Path: src/main/java/com/sulaco/fuse/akka/actor/RouteFinderActor.java
// public class RouteFinderActor extends FuseEndpointActor {
// 
//     @Autowired protected RoutesConfig routes;
//     
//     @Override
//     protected void onRequest(final FuseRequestMessage message) {
//         
//         String uri = message.getRequest().getUri();
//         
//         Optional<Route> route = routes.getFuseRoute(uri);
// 
//         if (route.isPresent()) {
//             Route rte = route.get();
// 
//             // add route to the message
//             ((FuseRequestMessageImpl) message).setRoute(rte);
// 
//             // pass message to handling actor
//             rte.getHandler()
//                .getActor()
//                .ifPresent(
//                    handler -> {
//                        HttpMethod requested = message.getRequest().getMethod();
//                        HttpMethod supported = rte.getHandler().getHttpMethod();
// 
//                        if (supported.compareTo(requested) == 0) {
//                            handler.tell(message, getSelf());
//                        }
//                        else {
//                            info(requested +" not supported by " + uri.toString());
//                            unhandled(message);
//                        }
//                    }
//                );
//         }
//         else {
//             unhandled(message);
//         }
//     }
// 
//     public void setRoutes(RoutesConfig routes) {
//         this.routes = routes;
//     }
//     
// }


// Path: src/test/java/com/sulaco/fuse/netty/FuseChannelHandlerTest.java
import akka.testkit.TestActorRef;
import com.sulaco.fuse.ActorAwareTest;
import com.sulaco.fuse.akka.actor.RouteFinderActor;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.HttpRequest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnit44Runner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

package com.sulaco.fuse.netty;




@RunWith(MockitoJUnit44Runner.class)
public class FuseChannelHandlerTest extends ActorAwareTest {

    FuseChannelHandler instance;

    TestActorRef<RouteFinderActor> mockRouter;