Package

Source Code of AppTest

import com.jetdrone.vertx.yoke.Yoke;
import com.jetdrone.vertx.yoke.Middleware;
import com.jetdrone.vertx.yoke.middleware.YokeRequest;
import com.jetdrone.vertx.yoke.test.Response;
import com.jetdrone.vertx.yoke.test.YokeTester;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.vertx.java.core.Handler;
import org.vertx.testtools.TestVerticle;

import static org.vertx.testtools.VertxAssert.*;

public class AppTest extends TestVerticle {

    @Test
    public void testApp() {
        final Yoke yoke = new Yoke(this);
        yoke.use(new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                request.response().end("OK");
            }
        });

        final YokeTester yokeAssert = new YokeTester(yoke);

        yokeAssert.request("GET", "/", new Handler<Response>() {
            @Override
            public void handle(Response response) {
                assertEquals("OK", response.body.toString());
                testComplete();
            }
        });
    }
}
TOP

Related Classes of AppTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.