@@ -0,0 +1,3263 @@
+package net.kencochrane.raven.servlet;%0A%0Aimport mockit.Injectable;%0Aimport mockit.NonStrictExpectations;%0Aimport mockit.Tested;%0Aimport org.testng.annotations.AfterMethod;%0Aimport org.testng.annotations.Test;%0A%0Aimport javax.servlet.ServletRequest;%0Aimport javax.servlet.ServletRequestEvent;%0Aimport javax.servlet.http.HttpServletRequest;%0A%0Aimport static mockit.Deencapsulation.getField;%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.hamcrest.Matchers.nullValue;%0A%0Apublic class RavenServletRequestListenerTest %7B%0A    @Tested%0A    private RavenServletRequestListener ravenServletRequestListener = null;%0A    @Injectable%0A    private ServletRequestEvent mockServletRequestEvent = null;%0A%0A    @AfterMethod%0A    public void tearDown() throws Exception %7B%0A        // Reset the threadLocal value%0A        ((ThreadLocal) getField(RavenServletRequestListener.class, %22THREAD_REQUEST%22)).remove();%0A    %7D%0A%0A    @Test%0A    public void requestListenerEmptyByDefault() throws Exception %7B%0A        assertThat(RavenServletRequestListener.getServletRequest(), is(nullValue()));%0A    %7D%0A%0A    @Test%0A    public void requestListenerContainsTheCurrentRequest(@Injectable final HttpServletRequest mockHttpServletRequest)%0A            throws Exception %7B%0A        new NonStrictExpectations() %7B%7B%0A            mockServletRequestEvent.getServletRequest();%0A            result = mockHttpServletRequest;%0A        %7D%7D;%0A%0A        ravenServletRequestListener.requestInitialized(mockServletRequestEvent);%0A%0A        assertThat(RavenServletRequestListener.getServletRequest(), is(mockHttpServletRequest));%0A    %7D%0A%0A    @Test%0A    public void requestListenerDoesntWorkWithNonHttpRequests(@Injectable final ServletRequest mockServletRequest)%0A            throws Exception %7B%0A        new NonStrictExpectations() %7B%7B%0A            mockServletRequestEvent.getServletRequest();%0A            result = mockServletRequest;%0A        %7D%7D;%0A%0A        ravenServletRequestListener.requestInitialized(mockServletRequestEvent);%0A%0A        assertThat(RavenServletRequestListener.getServletRequest(), is(nullValue()));%0A    %7D%0A%0A    @Test%0A    public void requestListenerDestroyRemovesTheCurrentRequest(@Injectable final HttpServletRequest mockHttpServletRequest)%0A            throws Exception %7B%0A        new NonStrictExpectations() %7B%7B%0A            mockServletRequestEvent.getServletRequest();%0A            result = mockHttpServletRequest;%0A        %7D%7D;%0A        ravenServletRequestListener.requestInitialized(mockServletRequestEvent);%0A%0A        ravenServletRequestListener.requestDestroyed(mockServletRequestEvent);%0A%0A        assertThat(RavenServletRequestListener.getServletRequest(), is(nullValue()));%0A    %7D%0A%0A    @Test%0A    public void requestListenerSpecificToLocalThread(@Injectable final HttpServletRequest mockHttpServletRequest)%0A            throws Exception %7B%0A        new NonStrictExpectations() %7B%7B%0A            mockServletRequestEvent.getServletRequest();%0A            result = mockHttpServletRequest;%0A        %7D%7D;%0A%0A        new Thread()%7B%0A            @Override%0A            public void run() %7B%0A                ravenServletRequestListener.requestInitialized(mockServletRequestEvent);%0A            %7D%0A        %7D.start();%0A%0A        assertThat(RavenServletRequestListener.getServletRequest(), is(nullValue()));%0A    %7D%0A%7D

Add test coverage for the ServletRequestListener