@Test
public void setsUpEnvironmentContextBeforeCallToRequestHandler() throws Exception {

    ContainerRequest containerRequest = mockContainerRequest();
    ContainerResponse containerResponse = mockContainerResponse();
    EnvironmentContext environmentContext = mock(EnvironmentContext.class);
    EnvironmentContext[] environmentContextThatRequestHandlerCalledWith = new EnvironmentContext[1];
    doAnswer(invocation -> {
        environmentContextThatRequestHandlerCalledWith[0] = EnvironmentContext.getCurrent();
        return null;
    }).when(requestHandler).handleRequest(containerRequest, containerResponse);
    everrestProcessor.process(containerRequest, containerResponse, environmentContext);
    assertNotNull(environmentContextThatRequestHandlerCalledWith[0]);
    assertSame(environmentContext, environmentContextThatRequestHandlerCalledWith[0]);
}