// Path: jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/compiler/dummy/FakeJspCompiler.java
// public class FakeJspCompiler implements JspCompiler {
// 
//     private static StringBuffer fakedOutput = new StringBuffer(2000);
//     private static String lastCompiledPath;
//     private static String lastCompiledWebRoot;
//     private String webRoot;
// 
//     public void setWebRoot(String directory) {
//         this.webRoot = directory;
//     }
// 
//     protected String getWebRoot() {
//         return webRoot;
//     }
// 
//     public static void cleanOutput() {
//         fakedOutput.setLength(0);
//     }
// 
//     public static void appendOutput(String content) {
//         fakedOutput.append(content);
//     }
// 
//     public Jsp compile(String path, Map taglibs) {
//         lastCompiledWebRoot = getWebRoot();
//         lastCompiledPath = path;
//         return new Jsp() {
// 
//             public JspExecution request(String httpMethod, Map requestAttributes,
//                     Map sessionAttributes, Map requestParameters) {
//                 return new JspExecution() {
// 
//                     public String getRenderedResponse() {
//                         return fakedOutput.toString();
//                     }
//                 };
//             }
//         };
//     }
// 
//     public static String lastCompiledPath() {
//         return lastCompiledPath;
//     }
// 
//     public static String lastCompiledWebRoot() {
//         return lastCompiledWebRoot;
//     }
// 
//     public void setOutputDirectory(String directory) {
//     }
// }


import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import net.sf.jsptest.compiler.dummy.FakeJspCompiler;

/*
 * Copyright 2007 Lasse Koskela.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.sf.jsptest;


/**
 * @author Lasse Koskela
 */
public class TestJspTestCase extends TestCase {

    private String renderedOutput;
    private JspTestCase testcase;

    protected void setUp() throws Exception {
        super.setUp();
        renderedOutput = "there is a needle in this haystack";
        testcase = new JspTestCase() {

            protected String getWebRoot() {
                return "./websrc";
            }
        };
    }

    public void testCorrectWebRootIsPassedToJspCompiler() throws Exception {
        testcase.get("/index.jsp");

// Path: jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/compiler/dummy/FakeJspCompiler.java
// public class FakeJspCompiler implements JspCompiler {
// 
//     private static StringBuffer fakedOutput = new StringBuffer(2000);
//     private static String lastCompiledPath;
//     private static String lastCompiledWebRoot;
//     private String webRoot;
// 
//     public void setWebRoot(String directory) {
//         this.webRoot = directory;
//     }
// 
//     protected String getWebRoot() {
//         return webRoot;
//     }
// 
//     public static void cleanOutput() {
//         fakedOutput.setLength(0);
//     }
// 
//     public static void appendOutput(String content) {
//         fakedOutput.append(content);
//     }
// 
//     public Jsp compile(String path, Map taglibs) {
//         lastCompiledWebRoot = getWebRoot();
//         lastCompiledPath = path;
//         return new Jsp() {
// 
//             public JspExecution request(String httpMethod, Map requestAttributes,
//                     Map sessionAttributes, Map requestParameters) {
//                 return new JspExecution() {
// 
//                     public String getRenderedResponse() {
//                         return fakedOutput.toString();
//                     }
//                 };
//             }
//         };
//     }
// 
//     public static String lastCompiledPath() {
//         return lastCompiledPath;
//     }
// 
//     public static String lastCompiledWebRoot() {
//         return lastCompiledWebRoot;
//     }
// 
//     public void setOutputDirectory(String directory) {
//     }
// }


// Path: jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/TestJspTestCase.java
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import net.sf.jsptest.compiler.dummy.FakeJspCompiler;

/*
 * Copyright 2007 Lasse Koskela.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.sf.jsptest;


/**
 * @author Lasse Koskela
 */
public class TestJspTestCase extends TestCase {

    private String renderedOutput;
    private JspTestCase testcase;

    protected void setUp() throws Exception {
        super.setUp();
        renderedOutput = "there is a needle in this haystack";
        testcase = new JspTestCase() {

            protected String getWebRoot() {
                return "./websrc";
            }
        };
    }

    public void testCorrectWebRootIsPassedToJspCompiler() throws Exception {
        testcase.get("/index.jsp");

        assertEquals("./websrc", FakeJspCompiler.lastCompiledWebRoot());
