[Demonstration 1]

[Buggy Method]
public SplitterBolt buildSplitter() {
    String datasetType = this.configs.getProperty(Keys.KAFKA_TOPIC);
    String outputField = this.configs.getProperty(Keys.SPLITTER_BOLT_OUTPUTFIELD);
    return new SplitterBolt(datasetType, outputField);
}

[Buggy Hunk]
String outputField = this.configs.getProperty(Keys.SPLITTER_BOLT_OUTPUTFIELD);

[Patch]
String outputField = Keys.SPLITTER_BOLT_OUTPUTFIELD;

[Demonstration 2]

[Buggy Method]
@Test(groups = { "regressiontest", "integritytest" })
public void testCollectorGetFileIDs() throws Exception {
    addDescription("Tests that the collector calls the GetFileClient");
    addStep("Define variables", "No errors");
    String pillarId = "TEST-PILLAR";
    ContributorQuery[] contributorQueries = ContributorQueryUtils.createFullContributorQuery(Arrays.asList(pillarId));
    String auditTrailInformation = "audit trail for this test";
    addStep("Setup a GetFileIDsClient for test purpose.", "Should be OK.");
    MockGetFileIDsClient getFileIDs = new MockGetFileIDsClient();
    IntegrityInformationCollector collector = new DelegatingIntegrityInformationCollector(getFileIDs, null);
    addStep("Call the getFileIDs on the collector.", "Should go directly to the GetFileIDsClient");
    collector.getFileIDs(collectionID, Arrays.asList(pillarId), auditTrailInformation, contributorQueries, null);
    Assert.assertEquals(getFileIDs.getCallsForGetFileIDs(), 1);
    addStep("Call the getFileIDs on the collector four times more.", "The GetFileIDsClient should have been called 5 times.");
    collector.getFileIDs(collectionID, Arrays.asList(pillarId), auditTrailInformation, contributorQueries, null);
    collector.getFileIDs(collectionID, Arrays.asList(pillarId), auditTrailInformation, contributorQueries, null);
    collector.getFileIDs(collectionID, Arrays.asList(pillarId), auditTrailInformation, contributorQueries, null);
    collector.getFileIDs(collectionID, Arrays.asList(pillarId), auditTrailInformation, contributorQueries, null);
    Assert.assertEquals(getFileIDs.getCallsForGetFileIDs(), 5);
}

[Buggy Hunk]
IntegrityInformationCollector collector = new DelegatingIntegrityInformationCollector(getFileIDs, null);

[Patch]
IntegrityInformationCollector collector = new DelegatingIntegrityInformationCollector(getFileIDs, null, null, null);

[Demonstration 3]

[Buggy Method]
public void generate() throws SQLException {
    int year = db.getYear() + (int) Math.floor(Math.random() * 100);
    int index = (int) Math.floor(Math.random() * db.getNationNames().size());
    String to = (String) db.getNationNames().toArray()[index];
    Event newEvent = null;
    int type = (int) Math.floor(Math.random() * 100);
    if (type > 95) {
        newEvent = new NaturalDisaster(year, to);
    } else if (type > 67) {
        newEvent = new Election(year, to);
    } else if (type > 33) {
        newEvent = new EconomicDownturn(year, to);
    } else {
        newEvent = new EconomicBoom(year, to);
    }
    addEvent(newEvent);
}

[Buggy Hunk]
newEvent = new Election(year, to);

[Patch]
newEvent = new NaturalDisaster(year, to);