title: How to write unit test for a private void method in which other private method is being called?
body: <pre><code>private void ConvertString(ABC object) 
  {
      String head = "";
      String tail="string_tail";
      if(!tail.isEmpty()) 
      {
          String converter = new StringConvert();
          head = converter.convert(tail, TYPE1);
          setHeadToTail(head,object);
      }
  }
  
  private void setHeadToTail(String head, ABC object) 
  {
      List&lt;Mixture&gt; values=object.getValues();
      if (values!=null) 
      {
          for (Mixture Values1 : values) 
          {
              if (Values1 instanceof NumMixture) 
              {
                  ((NumMixture) Values1 ).setTail(head);
              }
          }
       }
  </code></pre>
  
  <p>}</p>
  
  <p>I want to write unit test for <code>ConvertString</code> method to check weather the value 'head' converted is equal to the value 'head' being passed in <code>setHeadToTail()</code>.
  Can anyone help in this?</p>
  
  <pre><code>@Test
  public void test_ConvertedValue() throws Exception {
  
      ABC obj1=methodToSetSomeValues();
      Method method=Project.class.getDeclaredMethod("ConvertString", ABC.class);
      method.setAccessible(true);
      method.invoke(new Project(), obj1);
      String expectedVal= "1234";
  
      ArgumentCaptor&lt;String&gt; argumentCaptor=ArgumentCaptor.forClass(String.class);
  
      verifyPrivate(new Project()).invoke("setHeadToTail", argumentCaptor.capture(), obj1);
      assertEquals(expectedVal,argumentCaptor.getValue());
  
  
  }
  </code></pre>
  
  <p>In this test case I want to check the value of 'head' converted is equal to parameter passed in <code>setHeadToTail()</code> i.e. head but this is not working.</p>