title: Java testing if two void methods do the same
body: <p>I have a class of paired void methods: each method has an equivalent one that should perform the same operation but in a different way.
  For example:</p>
  
  <pre><code>public void example1_1(){
      Integer i = new Integer(1);
  }
  
  public void example1_2(){
      Integer i = Integer.valueOf(11);
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>public void example2_1(){
      String result = "hello";
      for (int i = 0; i &lt; 10; i++) {
          result += result;
      }
  }
  
  public void example2_2(){
      StringBuffer result = new StringBuffer("hello");
      for(int i = 0; i &lt; 10; i++) {
          result += result;
      }
  }
  </code></pre>
  
  <p>How can I test that the methods <b>actually</b> perform the same operations in pair?</p>