Search in sources :

Example 6 with Context

use of ninja.Context in project ninja by ninjaframework.

the class LambdasTest method anonymousClassReference.

@Test
public void anonymousClassReference() throws Exception {
    @SuppressWarnings("Convert2Lambda") ControllerMethod1<Context> lambda = new ControllerMethod1<Context>() {

        @Override
        public Result apply(Context a) {
            return Results.html().renderRaw("".getBytes(StandardCharsets.UTF_8));
        }
    };
    try {
        LambdaInfo lambdaInfo = Lambdas.reflect(lambda);
        fail();
    } catch (IllegalArgumentException e) {
    // expected
    }
}
Also used : ControllerMethod1(ninja.ControllerMethods.ControllerMethod1) Context(ninja.Context) LambdaInfo(ninja.utils.Lambdas.LambdaInfo) Test(org.junit.Test)

Aggregations

Context (ninja.Context)6 ResponseStreams (ninja.utils.ResponseStreams)4 Result (ninja.Result)3 Before (org.junit.Before)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 LambdaInfo (ninja.utils.Lambdas.LambdaInfo)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 StringWriter (java.io.StringWriter)1 SerializedLambda (java.lang.invoke.SerializedLambda)1 TreeMap (java.util.TreeMap)1 ControllerMethod1 (ninja.ControllerMethods.ControllerMethod1)1 Renderable (ninja.Renderable)1 InternalServerErrorException (ninja.exceptions.InternalServerErrorException)1 NinjaProperties (ninja.utils.NinjaProperties)1 FileItemIterator (org.apache.commons.fileupload.FileItemIterator)1 FileItemStream (org.apache.commons.fileupload.FileItemStream)1 FileUploadException (org.apache.commons.fileupload.FileUploadException)1