// Path: lambda-local/src/test/java/com/zaoo/lambda/test/TestFunction1.java
// @LambdaLocal(value = "/testPath1")
// public class TestFunction1 implements RequestHandler<String, String> {
//     @Override
//     public String handleRequest(String input, Context context) {
//         return "hello " + input;
//     }
// }
// 
// Path: lambda-local/src/test/java/com/zaoo/lambda/test/TestFunction2.java
// @LambdaLocal(value = {"/testPath2.1", "/testPath2.2"},
//         handler = {"com.zaoo.lambda.test.TestFunction2::method1", "com.zaoo.lambda.test.TestFunction2::method2"},
//         deserializer = {LambdaProxyRequestDeserializer.class, LambdaProxyRequestDeserializer.class},
//         serializer = {LambdaProxyResponseSerializer.class, LambdaProxyResponseSerializer.class})
// public class TestFunction2 {
//     public String method1(String input) {
//         return "hello " + input;
//     }
// 
//     public String method2(String input, Context context) {
//         return "hi " + input;
//     }
// }


import com.zaoo.lambda.test.TestFunction1;
import com.zaoo.lambda.test.TestFunction2;
import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Test;
import org.reflections.ReflectionUtils;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
package com.zaoo.lambda;




public class LambdaLocalServletTest {
    private LambdaLocalServlet lambdaLocalServlet;

    @Before
    public void setUp() throws Exception {
        lambdaLocalServlet = new LambdaLocalServlet();
    }

    @Test
    public void invokeLambdaFunction_testFunction1() throws Exception {
        MockHttpServletRequest req = new MockHttpServletRequest();
        req.setContent("tempo".getBytes());
        MockHttpServletResponse resp = new MockHttpServletResponse();
        lambdaLocalServlet.invokeLambdaFunction(req,
                resp,
                new LambdaFunction("/testPath1",
                        TestFunction1.class,
                        null,
                        new StringDeserializer(),
                        new StringSerializer()));
        assertThat(resp.getContentAsString()).isEqualTo("hello tempo");
    }

    @Test
    public void invokeLambdaFunction_testFunction2_method1() throws Exception {
        MockHttpServletRequest req = new MockHttpServletRequest();
        req.setContent("tempo".getBytes());
        MockHttpServletResponse resp = new MockHttpServletResponse();
        lambdaLocalServlet.invokeLambdaFunction(req,
                resp,
                new LambdaFunction("/testPath2",
// Path: lambda-local/src/test/java/com/zaoo/lambda/test/TestFunction1.java
// @LambdaLocal(value = "/testPath1")
// public class TestFunction1 implements RequestHandler<String, String> {
//     @Override
//     public String handleRequest(String input, Context context) {
//         return "hello " + input;
//     }
// }
// 
// Path: lambda-local/src/test/java/com/zaoo/lambda/test/TestFunction2.java
// @LambdaLocal(value = {"/testPath2.1", "/testPath2.2"},
//         handler = {"com.zaoo.lambda.test.TestFunction2::method1", "com.zaoo.lambda.test.TestFunction2::method2"},
//         deserializer = {LambdaProxyRequestDeserializer.class, LambdaProxyRequestDeserializer.class},
//         serializer = {LambdaProxyResponseSerializer.class, LambdaProxyResponseSerializer.class})
// public class TestFunction2 {
//     public String method1(String input) {
//         return "hello " + input;
//     }
// 
//     public String method2(String input, Context context) {
//         return "hi " + input;
//     }
// }


// Path: lambda-local/src/test/java/com/zaoo/lambda/LambdaLocalServletTest.java
import com.zaoo.lambda.test.TestFunction1;
import com.zaoo.lambda.test.TestFunction2;
import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Test;
import org.reflections.ReflectionUtils;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;

package com.zaoo.lambda;




public class LambdaLocalServletTest {
    private LambdaLocalServlet lambdaLocalServlet;

    @Before
    public void setUp() throws Exception {
        lambdaLocalServlet = new LambdaLocalServlet();
    }

    @Test
    public void invokeLambdaFunction_testFunction1() throws Exception {
        MockHttpServletRequest req = new MockHttpServletRequest();
        req.setContent("tempo".getBytes());
        MockHttpServletResponse resp = new MockHttpServletResponse();
        lambdaLocalServlet.invokeLambdaFunction(req,
                resp,
                new LambdaFunction("/testPath1",
                        TestFunction1.class,
                        null,
                        new StringDeserializer(),
                        new StringSerializer()));
        assertThat(resp.getContentAsString()).isEqualTo("hello tempo");
    }

    @Test
    public void invokeLambdaFunction_testFunction2_method1() throws Exception {
        MockHttpServletRequest req = new MockHttpServletRequest();
        req.setContent("tempo".getBytes());
        MockHttpServletResponse resp = new MockHttpServletResponse();
        lambdaLocalServlet.invokeLambdaFunction(req,
                resp,
                new LambdaFunction("/testPath2",
                        TestFunction2.class,