use of io.crnk.ui.internal.UIHttpRequestProcessor in project crnk-framework by crnk-project.
the class UIModuleTest method processorNotUsedForNonBrowsePath.
@Test
public void processorNotUsedForNonBrowsePath() throws IOException {
UIHttpRequestProcessor processor = new UIHttpRequestProcessor(new UIModuleConfig());
HttpRequestContext context = Mockito.mock(HttpRequestContext.class);
Mockito.when(context.getMethod()).thenReturn("POST");
Mockito.when(context.getPath()).thenReturn("somethingDifferent/index.html");
processor.process(context);
Mockito.verify(context, Mockito.times(0)).setResponse(Mockito.anyInt(), Mockito.any(byte[].class));
}
use of io.crnk.ui.internal.UIHttpRequestProcessor in project crnk-framework by crnk-project.
the class UIModuleTest method processorReturnsFile.
@Test
public void processorReturnsFile() throws IOException {
UIHttpRequestProcessor processor = new UIHttpRequestProcessor(new UIModuleConfig());
HttpRequestContext context = Mockito.mock(HttpRequestContext.class);
Mockito.when(context.getPath()).thenReturn("browse/index.html");
Mockito.when(context.getMethod()).thenReturn("GET");
processor.process(context);
Mockito.verify(context, Mockito.times(1)).setResponse(Mockito.eq(200), Mockito.any(byte[].class));
Mockito.verify(context, Mockito.times(1)).setContentType(Mockito.eq("text/html"));
}
use of io.crnk.ui.internal.UIHttpRequestProcessor in project crnk-framework by crnk-project.
the class UIModuleTest method processorNotUsedForPost.
@Test
public void processorNotUsedForPost() throws IOException {
UIHttpRequestProcessor processor = new UIHttpRequestProcessor(new UIModuleConfig());
HttpRequestContext context = Mockito.mock(HttpRequestContext.class);
Mockito.when(context.getMethod()).thenReturn("POST");
Mockito.when(context.getPath()).thenReturn("browse/index.html");
processor.process(context);
Mockito.verify(context, Mockito.times(0)).setResponse(Mockito.anyInt(), Mockito.any(byte[].class));
}
use of io.crnk.ui.internal.UIHttpRequestProcessor in project crnk-framework by crnk-project.
the class UIModuleTest method processorReturnsIndexHtmlForRootPage.
@Test
public void processorReturnsIndexHtmlForRootPage() throws IOException {
UIHttpRequestProcessor processor = new UIHttpRequestProcessor(new UIModuleConfig());
HttpRequestContext context = Mockito.mock(HttpRequestContext.class);
Mockito.when(context.getMethod()).thenReturn("GET");
Mockito.when(context.getPath()).thenReturn("browse/");
processor.process(context);
Mockito.verify(context, Mockito.times(1)).setResponse(Mockito.eq(200), Mockito.any(byte[].class));
}
Aggregations