title: Why public static AtomicBoolean variable is false during the test in Maven sometimes?
body: <p>Why public static AtomicBoolean variable is false during the test in Maven sometimes?</p>
  
  <p>Maybe, rude concurrency mistakes?</p>
  
  <p>But works fine in Intellij.</p>
  
  <pre><code>public class MaintenanceFilterTest {
  @Rule
  public ExpectedException expectedException = ExpectedException.none();
  private MaintenanceFilter target;
  
  @Before
  public void setUp() throws Exception {
      target = new MaintenanceFilter();
      MaintenanceFilter.isMaintenanceStarted.set(false);
  }
  
  @Test
  public void doFilterException() throws Exception {
      MaintenanceFilter.isMaintenanceStarted.set(true);
      expectedException.expect(MaintenanceException.class);
      expectedException.expectMessage
          ("Redeployment of application or restart of server is in progress.");
  
      target.doFilter(null, null, null);
  }
  
  public static class MaintenanceFilter implements Filter {
      public static final AtomicBoolean isMaintenanceStarted = new AtomicBoolean();
  
      @Override
      public void doFilter(
          ServletRequest input, 
          ServletResponse output, 
          FilterChain chain
      ) throws IOException,
              ServletException {
          if (isMaintenanceStarted.get()) {
              throw new MaintenanceException
                  ("Redeployment of application or restart of server is in progress.");
          }
      }//..
   }
  }
  </code></pre>