[Demonstration 1]

[Buggy Method]
private boolean rerunHistoryEntryById(String id) {
    Optional<Snippet> snippet = state.snippets().stream().filter(s -> s.id().equals(id)).findFirst();
    return snippet.map(s -> {
        rerunSnippet(s);
        return true;
    }).orElse(false);
}

[Buggy Hunk]
Optional<Snippet> snippet = state.snippets().stream()

[Patch]
Optional<Snippet> snippet = state.snippets()

[Demonstration 2]

[Buggy Method]
public List<FolderObject> getFolderHistory() {
    if (wasFolderAdded) {
        open();
        //Maybe we don't want to sort by date?
        String sortOrder = FOLDER_DATE + " DESC";
        String[] COLUMNS = { FOLDER_STRING, FOLDER_DATE };
        Cursor c;
        c = db.query(TABLE_NAME_FOLDER, COLUMNS, null, null, null, null, sortOrder);
        //context = db.query(TABLE_NAME, COLUMNS, CLIP_STRING + " LIKE '%" + sqliteEscape(queryString) + "%'", null, null, null, sortOrder);
        foldersInMemory = new ArrayList<>();
        while (c.moveToNext()) {
            foldersInMemory.add(new FolderObject(c.getString(0), new Date(c.getLong(1))));
        }
        c.close();
        close();
        wasFolderAdded = false;
    }
    return foldersInMemory;
}

[Buggy Hunk]
String[] COLUMNS = {FOLDER_STRING, FOLDER_DATE};

[Patch]
String[] COLUMNS = {FOLDER_STRING, FOLDER_DATE, FOLDER_CONTENTS};

[Demonstration 3]

[Buggy Method]
@Post
public Representation create(Representation entity) {
    // Check if of type Student
    ResourceUtil.checkTokenPermissions(this, Student.class);
    // Get input parameters
    Form params = new Form(entity);
    Long userId = Long.parseLong(ResourceUtil.getParam(params, "user", true), 10);
    Long courseId = Long.parseLong(getAttribute(Constants.courseId), 10);
    Long groupId = Long.parseLong(getAttribute(Constants.groupId), 10);
    // Check if token coresponds to userid
    ResourceUtil.checkToken(this, userId);
    // Throws a ClassCastException if userId isnt of type Student
    Student s = ObjectifyService.ofy().load().type(Student.class).id(userId).now();
    Group g = ObjectifyService.ofy().load().type(Group.class).parent(Key.create(Course.class, courseId)).id(groupId).now();
    // check to see if group exists
    if (g == null) {
        throw new ResourceException(404, "Not found", "Group does not exist", null);
    }
    // Check to see if Student already has attendance record for course/group
    for (Ref<AttendanceRecord> ref : s.getGroups()) {
        AttendanceRecord ar = ref.get();
        if (ar != null) {
            Key<Group> parent = ar.getParent();
            if (parent != null && groupId.equals(parent.getId()) && parent.getParent() != null && courseId.equals(parent.getParent().getId())) {
                throw new ResourceException(409, "Conflict", "Student already signed up for group in course.", null);
            }
        }
    }
    // Create new AttendanceRecord and add to Students list of AttendanceRecords
    AttendanceRecord ar = new AttendanceRecord(courseId, groupId, userId);
    ObjectifyService.ofy().save().entity(ar).now();
    s.addGroup(ar);
    ObjectifyService.ofy().save().entity(s).now();
    // Return...
    return new StringRepresentation(ar.getId().toString());
}

[Buggy Hunk]
if (parent != null && groupId.equals(parent.getId()) && parent.getParent() != null && courseId.equals(parent.getParent().getId())) {

[Patch]
if (parent != null && parent.getParent() != null && courseId.equals(parent.getParent().getId())) {