title: Mock result of a hashSet
body: <p>I am new to mocking help me to mock the result of check method
  The mock should return false if the element is already in the hashSet
  ps: i don’t want static testing</p>
  <pre><code>class A{
      HashSet&lt;String&gt; hash=new HashSet&lt;&gt;();
      public boolean check(String str){
          return hash.add(str);
      }
  }
  class ATest{
      //code to mock the check method
  }
  </code></pre>