title: Spring Security @WithMockUser does not work with cucumber Tests
body: <p>I am using cucumber tests to test my spring boot app with spring security enabled .Things work fine except when I run my test suite with cucumber tests some tests using spring security eg.</p>
  
  <pre><code>    @WithMockUser(username = "BROWSER", roles =
     {"BROWSER","ADMIN"})
  </code></pre>
  
  <p>fail .These tests do work if I do run them in seclusion as simple junit tests but fail when run with cucumber test steps.
  The issue looks like the spring security test mock behaviour isnt getting applied when I run the same with cucumber tests.</p>
  
  <p>My cucumber test run class is as below </p>
  
  <pre><code>@RunWith(Cucumber.class)
  @CucumberOptions(features = "src/test/resources", monochrome = true, format =
  {"pretty", "html:src/main/resources/static/cucumber"})
  public class CucumberTests
  {
  
  }
  </code></pre>
  
  <p>Also I noticed the same works when run via Maven with  <code>&lt;reuseForks&gt;false&lt;/reuseForks&gt;</code> .Also maven triggered test case run also fails if this option is not checked .</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>AbstractIntegrationTest class all tests extend</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = Services.class,loader = SpringApplicationContextLoader.class)
  //@IntegrationTest
  @WebIntegrationTest(randomPort = true)
  public abstract class AbstractIntegrationTest {
  </code></pre>
  
  <p>Another use case which does not work is using theses annotation is cucumber feature conditions like below </p>
  
  <pre><code>@When("^I apply a GET on (.*)$")
      @WithMockUser(username = "BROWSER", roles = { "BROWSER", "ADMIN" })
      public void i_search_with_rsql(String query) throws Throwable {
      result = mvc.perform(get(uri, query));
      }
  </code></pre>
  
  <p>any help or workaround on this.</p>