title: Java - find methods used only in test (unused in source code)
body: <p>Unused methods have warning for unused and can be removed, e.g. in Eclipse</p>
  
  <blockquote>
    <p>The method myMethod() from the type MyClass is never used locally</p>
  </blockquote>
  
  <p>But sometimes you write code with its unit test and afterwards code isn't used (or removed) in production, but method is still used (only) for unit test</p>
  
  <p>How can we find such unused methods which aren't used in real code (only test code)</p>
  
  <ul>
  <li>My tests are under tests folder and code under src folder</li>
  </ul>
  
  <p>For example DAO method:</p>
  
  <pre><code>public interface TransactionDao {
  
     public boolean updateTrasaction(int id);
  }
  
  @Repository
  public class TransactionDaoImpl implements TransactionDao {
  
      @Autowired
      private JdbcTemplate jdbcTemplate;
      @Override
      public boolean updateTrasaction(int id) {
          return (jdbcTemplate.update(... )&gt;0);
      }
  }
  </code></pre>
  
  <p>used only in Test:</p>
  
  <pre><code>@Test   
  public void testUpdateTrasaction() {
      Assert.assertEquals(transactionDao.updateTrasaction(1234), true);
  }
  </code></pre>
  
  <p>I'm aware of <a href="https://stackoverflow.com/questions/162551/how-to-find-unused-dead-code-in-java-projects">static analysis tools and Halting Problem</a>, but still, is there solution for this specific requirement?</p>