-
-
Notifications
You must be signed in to change notification settings - Fork 200
Expand file tree
/
Copy pathIssue3607.java
More file actions
38 lines (30 loc) · 1.05 KB
/
Issue3607.java
File metadata and controls
38 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Jooby https://jooby.io
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
* Copyright 2014 Edgar Espina
*/
package io.jooby;
import static org.mockito.Mockito.*;
import org.junit.jupiter.api.Test;
import io.jooby.output.Output;
import io.jooby.output.OutputFactory;
import io.jooby.output.OutputOptions;
public class Issue3607 {
private static class TemplateEngineImpl implements TemplateEngine {
@Override
public Output render(Context ctx, ModelAndView<?> modelAndView) throws Exception {
// do nothing
return ctx.getOutputFactory().wrap(new byte[0]);
}
}
@Test
public void shouldNotGenerateEmptyFlashMap() throws Exception {
var ctx = mock(Context.class);
when(ctx.getOutputFactory()).thenReturn(OutputFactory.create(OutputOptions.small()));
var templateEngine = new TemplateEngineImpl();
templateEngine.encode(ctx, ModelAndView.map("index.html"));
verify(ctx, times(1)).flashOrNull();
verify(ctx, times(1)).sessionOrNull();
verify(ctx, times(1)).setDefaultResponseType(MediaType.html);
}
}