[Demonstration 1]

[Buggy Method]
public List<Assignment> findAll() throws AssignmentAccessException {
    List<Assignment> assignments = assignmentRepository.findAll();
    if (assignments == null) {
        throw new AssignmentAccessException(AssignmentAccessException.NO_OBJECTS_FOUND_TEXT_ID, new String[] {});
    }
    return filterByLoginUser(assignments);
}

[Buggy Hunk]
public List<Assignment> findAll() throws AssignmentAccessException {

[Patch]
public List<Assignment> findAll() throws AssignmentAccessException, UserAccessException {

[Demonstration 2]

[Buggy Method]
private void chooseTimeOnCourseDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Hur många timmar vill du lägga på kursen per vecka?");
    // Set an EditText view to get user input
    final EditText input = new EditText(this);
    input.setText("0");
    input.setInputType(InputType.TYPE_CLASS_NUMBER);
    builder.setView(input);
    builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int whichButton) {
            String value = input.getText().toString();
            Log.d("course", "add " + value + " minutes to " + courseCode);
            //add value
            long add = coursesDBAdapter.insertTimeOnCourse(courseCode, Integer.parseInt(value));
            Toast toast;
            if (add > 0) {
                int mins = coursesDBAdapter.getTimeOnCourse(courseCode);
                timeOnCourseLabel.setText("Timmar per vecka: " + mins);
                toast = Toast.makeText(getBaseContext(), "Ditt mål är att lägga " + mins + " minuter på " + courseName + " i veckan.", Toast.LENGTH_LONG);
            } else {
                toast = Toast.makeText(getBaseContext(), "Det gick inte att lägga till.", Toast.LENGTH_SHORT);
            }
            toast.show();
        }
    });
    builder.setNegativeButton("Avbryt", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
        }
    });
    AlertDialog alertDialog = builder.create();
    alertDialog.show();
    Button okButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
    okButton.setTextColor(Color.parseColor(Colors.primaryDarkColor));
    Button cancelButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
    cancelButton.setTextColor(Color.parseColor(Colors.primaryDarkColor));
}

[Buggy Hunk]
long add = coursesDBAdapter.insertTimeOnCourse(courseCode, Integer.parseInt(value));

[Patch]
long add = coursesDBAdapter.insertTimeOnCourse(courseCode, Integer.parseInt(value)*60);

[Demonstration 3]

[Buggy Method]
private List<Assignment> filterByLoginUser(List<Assignment> assignments) {
    //TODO: Remove that check for the current User later once security is enabled for assignment service.
    // 		A user should always be logged in!
    User currentUser = userService.getCurrentUser();
    if (currentUser != null) {
        for (int i = 0; i < assignments.size(); i++) {
            if (checkValidAssignmentOwner(assignments.get(i)) == false) {
                assignments.remove(i);
                i = i - 1;
            }
        }
    }
    return assignments;
}

[Buggy Hunk]
private List<Assignment> filterByLoginUser(List<Assignment> assignments) {

[Patch]
private List<Assignment> filterByLoginUser(List<Assignment> assignments) throws UserAccessException {