title: Mockito Unit Test main function in a class
body: <p>I am fairly new to <code>Mockito</code>. I am not sure how to test the void function <code>emitcount()</code> or to actually test the class to 100%?</p>
  
  <pre><code>public class Class A {
  
      private static final String APP_NAME = "App name";
  
      public static void main(String[] args) throws Throwable {
  
          String root = "root"
          String domain = ".com"
  
          Injector injector = createInjector(
                  new ClassB(root, domain)
          );
  
          ClassC c=injector.getInstance(ClassC.class);
          c.start();
  
      }
  }
  </code></pre>
  
  <p>Is there a way Mockito helps to cover this code to 100%? </p>
  
  <p>My thoughts:</p>
  
  <pre><code>@RunWith(PowerMockRunner.class)
  public class testclass {
   @Test
      public void test() throws Throwable {
  
          ClassB b = new ClassB(root, domain));
          assertNotNull(b);
          Injector injector = Guice.createInjector(b);
  
          ClassC c= injector.getInstance(Class C.class);
           c.start()     
  
      }
  }
  </code></pre>
  
  <p>Questions</p>
  
  <p>1) Do I have to use <code>PowerMock</code> to test the code inside main function?</p>
  
  <p>2) Does <code>Mockito</code> provide something so that all the code is covered?</p>
  
  <p>3) Do I have to use <code>spy()</code>? The tricky part is creating an object 
     from injector </p>