title: synchronization depending on a static field?
body: <p>I am using a utility class called XMLUnit that has a static property to ignore white spaces. I use it in a test, shown below:</p>
  
  <pre><code>    XMLUnit.setIgnoreWhitespace(true);
      DetailedDiff detailedDiff = new DetailedDiff(XMLUnit.compareXML(expected, actual));
  
      detailedDiff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
      List&lt;Difference&gt; allDifferences = detailedDiff.getAllDifferences();
  </code></pre>
  
  <p>But some tests don't ignore the whitespaces and I think our Jenkins runs them in parallel. What is the best way of making sure I don't impact the other tests? Could I synchronize on the XMLUnit class like below?</p>
  
  <pre><code>    synchronized (XMLUnit.class) {
          XMLUnit.setIgnoreWhitespace(true);
          DetailedDiff detailedDiff = new DetailedDiff(XMLUnit.compareXML(expected, actual));
  
          detailedDiff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
          List&lt;Difference&gt; allDifferences = detailedDiff.getAllDifferences();
          XMLUnit.setIgnoreWhitespace(false);
      }
  </code></pre>
  
  <p>Also, if I have multiple maven modules that are being build in parallel on jenkins, and they all use this class what will the behavior be? Will each module have it's own instance of XMLUnit.class?</p>