protected String copyRequestToDirectory( HttpServletRequest request, String directory ) throws KettleException {
    try {
      return copyRequestToDirectory( request.getInputStream(), directory );
    } catch ( IOException ioe ) {
      throw new KettleException( BaseMessages.getString( PKG, "RegisterPackageServlet.Exception.CopyRequest",  directory ), ioe );
    }
  }
@Test
  public void testCopyRequestToDirectory_Exception2() throws Exception {

    try ( MockedStatic<KettleVFS> kettleVFSMockedStatic = mockStatic( KettleVFS.class ) ) {
      expectedEx.expect( MockitoException.class );

      InputStream inputStream = Mockito.mock( InputStream.class );

      kettleVFSMockedStatic.when( () -> KettleVFS.getFileObject( anyString() ) ).thenThrow( IOException.class );

      servlet.copyRequestToDirectory( inputStream, "/tmp/path" );
    }
  }