title: Guava @VisibleForTesting : Help me with a complete example
body: <p>My intent is to do unit test of private methods and I understand on how to import the <code>@VisibleForTesting</code> and use it for a private method. I have done a quite a bit of search but unable to see a complete example that demonstrates this feature.</p>
  
  <p>For eg:</p>
  
  <pre><code>class MyClass {
      @VisibleForTesting 
      private double[] getWorkArray(double[] values,int length) {
                 :
                 :
          return &lt;some double array&gt; 
      }
  }
  </code></pre>
  
  <p>Now in JUnit, I must be able to do</p>
  
  <pre><code>@Test
  public void testProvateMethod() {
      MyClass object = new MyClass();
      assertNotNull(object.getWorkArray(...);
  }
  </code></pre>
  
  <p>But the difficult part is I am unable to comprehend/do the following
  a) Snippet of maven compiler plugin for including the relevant annotation processor
  b) Actually be able to test a private method. (since it throws error related to visibility of method)</p>
  
  <p>I am unable to do it in action while I write a test in JUnit (due to the private access error). For eg: <code>mvn clean test</code></p>
  
  <p>Please provide a complete example to really all steps involved in getting the JUnit test of private methods done.</p>