/*
 * Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
 */
package detailedtopics.configuration.threadpools;

import org.junit.Test;
import play.Play;
import play.test.FakeApplication;
import javaguide.testhelpers.MockJavaAction;
import play.libs.F.Promise;

import play.mvc.*;
import play.mvc.Http.*;
import static javaguide.testhelpers.MockJavaAction.*;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static play.test.Helpers.*;

public class ThreadPoolsJava {

    @Test
    public void usingAppClassLoader() throws Exception {
        running(fakeApplication(), new Runnable() {
            public void run() {
                String myClassName = "java.lang.String";
                try {
                    //#using-app-classloader
                    Class myClass = Play.application().classloader().loadClass(myClassName);
                    //#using-app-classloader
                    assertThat(myClass, notNullValue());
                } catch (ClassNotFoundException e) {
                    throw new RuntimeException(e);
                }
            }
        });
    }

    @Test
    public void context1() {
        assertThat(header("Content-Type", call(new Controller1(), fakeRequest())), containsString("text/html"));
    }

    public static class Controller1 extends MockJavaAction {
        //#context-content-type
        public static Result index() {
            // Access the context's response
            response().setContentType("text/html");
            return ok("<h1>Hello World!</h1>");
        }
        //#context-content-type
    }

}

@@ -25,9 +25,9 @@
 -201
-3
+4
  Typ
@@ -197,178 +197,8 @@
 on;%0A
-import javaguide.testhelpers.MockJavaAction;%0Aimport play.libs.F.Promise;%0A%0Aimport play.mvc.*;%0Aimport play.mvc.Http.*;%0Aimport static javaguide.testhelpers.MockJavaAction.*;
 %0Aimp
@@ -968,491 +968,6 @@
  %7D%0A%0A
-    @Test%0A    public void context1() %7B%0A        assertThat(header(%22Content-Type%22, call(new Controller1(), fakeRequest())), containsString(%22text/html%22));%0A    %7D%0A%0A    public static class Controller1 extends MockJavaAction %7B%0A        //#context-content-type%0A        public static Result index() %7B%0A            // Access the context's response%0A            response().setContentType(%22text/html%22);%0A            return ok(%22%3Ch1%3EHello World!%3C/h1%3E%22);%0A        %7D%0A        //#context-content-type%0A    %7D%0A%0A
 %7D%0A

Remove duplicate documentation test