title: Automatic generation of unit tests for Java?
body: <p>Any tool for automatically generating unit tests for <strong>Java</strong> code?</p>
  
  <p><strong>UPDATE:</strong> 
  Primary intended use is to quickly generate unit tests for legacy code that is going to be refactored. No need to automatically keep the tests in sync with the code after automatic generation.</p>
  
  <hr>
  
  <p>Almost same question was asked here, but the answer was for .NET instead of Java (<a href="http://research.microsoft.com/en-us/projects/Pex/" rel="noreferrer">Pex</a> was the accepted answer):</p>
  
  <p><a href="https://stackoverflow.com/questions/689087/automatic-generation-of-unit-test-cases-for-net-and-java">Automatic generation of Unit test cases for .NET and Java</a></p>