protected void copyAndClose( InputStream inputStream, OutputStream outputStream ) throws IOException {
    IOUtils.copy( inputStream, outputStream );
    outputStream.flush();
    IOUtils.closeQuietly( outputStream );
  }
@Test
  public void testCopyAndClose() throws Exception {

    try ( MockedStatic<IOUtils> ioUtilsMockedStatic1 = mockStatic( IOUtils.class ) ) {
      int bytesCopied = 10;
      ioUtilsMockedStatic1.when( () -> IOUtils.copy( any( InputStream.class ), any( OutputStream.class ) ) ).thenReturn( bytesCopied );
      // Variables
      InputStream inputStream = Mockito.mock( InputStream.class );
      OutputStream outputStream = Mockito.mock( OutputStream.class );

      // EXECUTE
      servlet.copyAndClose( inputStream, outputStream );

      ioUtilsMockedStatic1.verify( () -> IOUtils.copy( eq( inputStream ), eq( outputStream ) ) );
      ioUtilsMockedStatic1.verify( () -> IOUtils.closeQuietly( eq( outputStream ) ) );
    }

  }