title: Junit Test Case for private method
body: <p>I have a below class. I am new in writing junit tests. I need to write the test case for this. 
  How can I write test method for <strong>startSchemaMaintenance</strong> method in the test class as it is calling a private method with no args?</p>
  
  <pre><code>public class SchemaMaintenance {
  
      //Loading statuses overview
      // NOT_STARTED = 0
      // START_LOADING = 1
      // IN_PROGRESS = 2
      // COMPLETED = 3
      // LOADING_ERROR = 4
      private static volatile Integer loading_status = 0;
  
      public void startSchemaMaintenance() throws Exception {
          if (checkLoadingStatus() == 1) {
              doSchemaMaintenance();
  
              loading_status = 3;
          }
      }
  
      private void doSchemaMaintenance(){
          //Do something....
      }
  
      private int checkLoadingStatus() throws Exception {
          if (loading_status==0 ||loading_status == 2) {
              synchronized (loading_status) {
                  if (loading_status==0) {
                      loading_status = 2;
                      return 1;
                  }else if(loading_status == 2) {
                      while(loading_status == 2);
  
                      if((loading_status == 4)){
  
                          throw new Exception("status = " + 4);
                      }
                  }else if(loading_status == 4) {
  
                      //log.error(generateErrorMessage());
                      throw new Exception("status = " + 4);
                  }
              }
          }else if((loading_status == 4)){
              //log.error(generateErrorMessage());
              throw new Exception("status = " + 4 );
          }
  
          return loading_status;
  
      }
  }
  </code></pre>