title: Testing a method to return unique values from a result set of a db query
body: <p>Let's say there is a database table named "Students".</p>
  
  <pre><code>         Students Table
  |---------------|---------------|
  |     Name      |      Age      |
  |---------------|---------------|
  |     John      |       9       |
  |---------------|---------------|
  |     Jane      |       7       |
  |---------------|---------------|
  |     Dana      |       8       |
  |---------------|---------------|
  |     John      |       6       |
  |---------------|---------------|
  </code></pre>
  
  <p>I make a request to the database to return all names using:</p>
  
  <pre><code>SELECT Name FROM Students
  </code></pre>
  
  <p>So the result set would be:</p>
  
  <pre><code>ResultSet rs = {"John" "Jane" "Dana" "John"}
  </code></pre>
  
  <p>I then want to return all unique values so I write a method called <code>populateSet()</code> to populate a <code>HashSet setOfNames</code> with <code>rs</code>.</p>
  
  <p>After executing <code>populateSet(ResultSet rs)</code>, only unique names appear:</p>
  
  <pre><code>"John" "Jane" "Dana"
  </code></pre>
  
  <p>Here is the validation test:</p>
  
  <pre><code>public void testValidation() {
      // Skipping the test data / db connection / query part
      ResultSet rs = ResultSet received back from DB
      Set&lt;String&gt; expected = {"John", "Jane", "Dana"};
      Set&lt;String&gt; actual = WhateverClass.populateSet(rs);
      assertEquals(expected, actual);
  }
  </code></pre>
  
  <p>What are some of the possible unit tests that I could write?</p>
  
  <p>I know I should write a null, empty, and negative tests. What are some corner cases?</p>