[Demonstration 1]

[Buggy Method]
public static int shortInt(int value) {
    // Not % 1000 as we can end up with 0 (1000), result must be between 0 & 1000
    return Math.abs((value % 999) + 1);
}

[Buggy Hunk]
return Math.abs((value % 999) + 1);

[Patch]
return (Math.abs(value) % 999) + 1;

[Demonstration 2]

[Buggy Method]
@Override
protected void tearDown() throws Exception {
    Log.v(TAG, "tearDown");
    Log.v(TAG, "remove Projectname from SharedPreferences");
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.getInstrumentation().getContext());
    SharedPreferences.Editor edit = preferences.edit();
    edit.remove(Constants.PREF_PROJECTNAME_KEY);
    edit.commit();
    if (solo != null) {
        solo.finishOpenedActivities();
    }
    systemAnimations.enableAll();
    solo = null;
    Log.i(TAG, "tearDown end 1");
    unzipProjects();
    Log.i(TAG, "tearDown end 2");
    super.tearDown();
    Log.i(TAG, "tearDown end 3");
}

[Buggy Hunk]
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.getInstrumentation().getContext());

[Patch]
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.getInstrumentation().getTargetContext());

[Demonstration 3]

[Buggy Method]
public void notifyChanged(Notification notification) {
    super.notifyChanged(notification);
    if (notification.getFeature() instanceof EAttributeImpl) {
        if (notification.getNotifier() instanceof BoundsImpl) {
            reposition(((BoundsImpl) notification.getNotifier()).getX(), ((BoundsImpl) notification.getNotifier()).getY(), ((BoundsImpl) notification.getNotifier()).getWidth(), getTreeHeight());
            FigureCanvas canvas = (FigureCanvas) getViewer().getControl();
            canvas.getViewport().repaint();
        }
    }
}

[Buggy Hunk]
getTreeHeight());

[Patch]
TreeNodeUtils.getTreeHeight(inputRootTreeNode, LEAF_HEIGHT));