title: Mock private methods of the class under test in jmockit
body: <p>I want to test process method of the <code>ProcessServiceImpl</code> class, with mocking private methods: <code>readContent</code> and <code>isValidFile</code> and <code>userService</code> class.</p>
  
  <pre><code>@Named("processServiceImpl")
  public class ProcessServiceImpl {
  
      @Inject
      private UserService userService;
  
      public User process(Long userId, File inputFile) throws InvalidFileException {
          User user = userService.load(userId);
          String fileContent = readContent(inputFile);
          if (isValidFile(fileContent)) {
              User updatedUser = userService.updateUser(user, fileContent);
              return updatedUser;
          } else {
              throw new InvalidFileException();
          }
      }
  
      private String readContent(File inputFile) {
          //implementation
      }
  
      private boolean isValidFile(String fileContent) {
          //implementation
      }
  }
  </code></pre>
  
  <p>I mocked up <code>UserService</code> and injected it successfully. but i can't mock the private methods of the class under the test. Based on <a href="https://stackoverflow.com/questions/24427685/mocking-private-method-of-class-under-test-using-jmockit">this</a> and <a href="https://stackoverflow.com/questions/17218726/mock-a-private-method-of-the-class-under-test-in-jmockit">this</a> links i tried to mock them with <code>NonStrictExpectations</code> but it has not any <code>invoke</code> method!! Is there another way to do this? (I'm using jmockit-1.8)</p>
  
  <pre><code>new NonStrictExpectations(processServiceImpl) {{
      invoke(processServiceImpl, "readContent"); 
      result = "";
  }};
  </code></pre>