#fixed code
                                @Test (expected = CommandException.class )
    public void getSegmentationPlanThrowsIOException() throws Exception {
        new Expectations() {
            @Mocked UploadPayloadFile uploadPayload; {
            new UploadPayloadFile(null);
            result = uploadPayload;
            uploadPayload.getSegmentationPlan(anyLong);
            result = new IOException();
        }};
        UploadInstructions instructions = new UploadInstructions((File)null);
        instructions.getSegmentationPlan();
    }
#vulnerable code 
                                @Test (expected = CommandException.class )
    public void getSegmentationPlanThrowsIOException() throws Exception {
        UploadPayloadFile uploadPayload = mock(UploadPayloadFile.class);
        whenNew(UploadPayloadFile.class).withArguments(null).thenReturn(uploadPayload);
        when(uploadPayload.getSegmentationPlan(anyLong())).thenThrow(new IOException());
        UploadInstructions instructions = new UploadInstructions((File)null);
        instructions.getSegmentationPlan();
    } 
                            #location 5 
                            #vulnerability type RESOURCE_LEAK