[Demonstration 1]

[Buggy Method]
public static BufferedImage getImage(String filePath, int width, int height) {
    BufferedImage image = getImage(filePath);
    if (width == -1) {
        width = (int) ((((float) image.getWidth()) / image.getHeight()) * height);
    } else if (height == -1) {
        height = (int) ((((float) image.getHeight()) / image.getWidth()) * width);
    }
    if ((width != image.getWidth()) || (height != image.getHeight())) {
        BufferedImage resizedImage = new BufferedImage(width, height, image.getType());
        Graphics2D graphics = resizedImage.createGraphics();
        graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        graphics.drawImage(image, 0, 0, width, height, 0, 0, image.getWidth(), image.getHeight(), null);
        graphics.dispose();
        return resizedImage;
    }
    return image;
}

[Buggy Hunk]
BufferedImage resizedImage = new BufferedImage(width, height, image.getType());

[Patch]
BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

[Demonstration 2]

[Buggy Method]
@Test
public void selectByValue() {
    Assert.assertNull(toggleGroupValue.getValue());
    TestUtil.runThenWaitForPaintPulse(() -> {
        toggleGroupValue.setValue("value2");
    });
    Assert.assertEquals(toggles.get(2), toggleGroupValue.getSelectedToggle());
    TestUtil.runThenWaitForPaintPulse(() -> {
        toggleGroupValue.setValue(null);
    });
    Assert.assertNull(toggleGroupValue.getSelectedToggle());
}

[Buggy Hunk]
Assert.assertEquals(toggles.get(2), toggleGroupValue.getSelectedToggle());

[Patch]
Assert.assertEquals(toggles.get(2).getText(), ((ToggleButton)toggleGroupValue.getSelectedToggle()).getText());

[Demonstration 3]

[Buggy Method]
public BufferedImage capturePartScreen(Robot r, int x, int y, int width, int height) {
    //r.mouseMove(x, y);
    BufferedImage fullScreenImage = r.createScreenCapture(new Rectangle(x, y, width, height));
    //ImageIcon icon = new ImageIcon(fullScreenImage);
    return fullScreenImage;
}

[Buggy Hunk]
public BufferedImage capturePartScreen(Robot r, int x, int y, int width, int height) {

[Patch]
public static BufferedImage capturePartScreen(Robot r, int x, int y, int width, int height) {