title: JUnit to test for StringBuffers
body: <p><strong>Assignment:</strong> Write a JUnit test assuming you have two StringBuffer references named sbOne and sbTwo and you only want it to pass if the two references point to the same StringBuffer object.</p>
  
  <p>I want to make sure this actually a good way to approach this assignment. I wrote the assumed method for practice:</p>
  
  <pre><code>package StringBufferJUni;
  
  public class StringBufferUni {
  
      public static void main(String[] args){
  
      }
  
      public boolean StringBuff(StringBuffer sbOne, StringBuffer sbTwo){
          sbTwo = sbOne;
          if(sbTwo==sbOne){
              return true;
          }
  
          else{
              return false;
          }
      }
  }
  </code></pre>
  
  <p>And this is my JUnit test:</p>
  
  <pre><code>package StringBufferJUni;
  
  import static org.junit.Assert.*;
  
  import org.junit.Test;
  
  public class JUnitStringBuffer {
  
      @Test
      public void test() {
          StringBuffer sbOne = new StringBuffer("hello");
          StringBuffer sbTwo = new StringBuffer("hello");
          StringBufferUni stBuffer = new StringBufferUni();
          boolean hel = stBuffer.StringBuff(sbOne, sbTwo);
          assertEquals(true, hel);
      }
  
  }
  </code></pre>
  
  <p>Is this actually passing due to the references pointing to the same object?</p>