Package com.samskivert.mustache.Mustache

Examples of com.samskivert.mustache.Mustache.Lambda


        interceptor.postHandle(request, response, handler, modelAndView);

        verify(modelAndView).addObject(eq(messageKey), captor.capture());

        // exercise the in-lined Lambda
        final Lambda lambda = captor.getValue();
        assertNotNull(lambda);

        final Template.Fragment frag = mock(Template.Fragment.class);
        final Writer out = mock(Writer.class);
        final String fragResult = "bar";
        final String fragResultWithArgs = "bar  [foo] [baz][burp]";

        when(frag.execute()).thenReturn(fragResult);
        when(localeResolver.resolveLocale(request)).thenReturn(Locale.CANADA_FRENCH);

        lambda.execute(frag, out);

        verify(messageSource, times(1)).getMessage(fragResult, new Object[]{}, Locale.CANADA_FRENCH);

        // exercise the optional args passing:
        when(frag.execute()).thenReturn(fragResultWithArgs);
        lambda.execute(frag, out);

        verify(messageSource, times(1)).getMessage(fragResult, new Object[]{"foo", "baz", "burp"}, Locale.CANADA_FRENCH);

        verifyNoMoreInteractions(messageSource);
View Full Code Here

TOP

Related Classes of com.samskivert.mustache.Mustache.Lambda

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.