package com.wizzardo.http.framework;

import com.wizzardo.http.ServerTest;
import com.wizzardo.http.UrlHandler;
import com.wizzardo.http.framework.template.Renderer;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

/**
 * Created by wizzardo on 02.05.15.
 */
public class ControllerHandlerTest extends ServerTest {

    public static class HelloController extends Controller {

        public Renderer hello() {
            return renderString("hello!");
        }
    }

    @Test
    public void test() throws IOException {
        handler = new UrlHandler()
                .append("/hello", new ControllerHandler(HelloController.class, "hello"));

        Assert.assertEquals("hello!", makeRequest("/hello").get().asString());
    }
}

@@ -35,82 +35,8 @@
 k;%0A%0A
-import com.wizzardo.http.ServerTest;%0Aimport com.wizzardo.http.UrlHandler;%0A
 impo
@@ -85,16 +85,16 @@
 nderer;%0A
+
 import o
@@ -254,14 +254,22 @@
 nds 
-Server
+WebApplication
 Test
@@ -494,32 +494,28 @@
     
-handler = new UrlHandler
+server.getUrlMapping
 ()%0A 
@@ -551,30 +551,8 @@
 o%22, 
-new ControllerHandler(
 Hell
@@ -578,17 +578,16 @@
 %22hello%22)
-)
 ;%0A%0A     

fix test