[Demonstration 1]

[Buggy Method]
@Test(expected = StorageFieldNameException.class)
public void testValidationWithInvalidNestedFieldName() throws Exception {
    DDMForm ddmForm = DDMFormTestUtil.createDDMForm();
    DDMFormField ddmFormField = DDMFormTestUtil.createLocalizableTextDDMFormField("name");
    DDMFormTestUtil.addNestedTextDDMFormFields(ddmFormField, "contact");
    DDMFormTestUtil.addDDMFormFields(ddmForm, ddmFormField);
    DDMFormValues ddmFormValues = DDMFormValuesTestUtil.createDDMFormValues(ddmForm);
    LocalizedValue localizedValue = new LocalizedValue(LocaleUtil.US);
    localizedValue.addString(LocaleUtil.US, StringUtil.randomString());
    DDMFormFieldValue ddmFormFieldValue = DDMFormValuesTestUtil.createDDMFormFieldValue("name", localizedValue);
    List<DDMFormFieldValue> nestedDDMFormFieldValues = ddmFormFieldValue.getNestedDDMFormFieldValues();
    nestedDDMFormFieldValues.add(DDMFormValuesTestUtil.createDDMFormFieldValue("invalid", localizedValue));
    ddmFormValues.addDDMFormFieldValue(ddmFormFieldValue);
    ddmFormValuesValidator.validate(ddmFormValues);
}

[Buggy Hunk]
LocalizedValue localizedValue = new LocalizedValue(LocaleUtil.US);

[Patch]
Value localizedValue = new LocalizedValue(LocaleUtil.US);

[Demonstration 2]

[Buggy Method]
public String buildFactory(String pack) {
    Map<String, String> classNames = new HashMap<String, String>();
    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("classNames", classNames);
    map.put("package", pack);
    for (Concept con : model.getConcepts()) {
        if (!pack.equals(con.getPackage())) {
            continue;
        }
        if (!con.isAbstrakt()) {
            classNames.put(con.getName(), con.getFullyQualifiedName());
        }
    }
    return SemanticXSDModelCompilerImpl.getTemplatedCode(metaFactoryTempl, map);
}

[Buggy Hunk]
if ( ! con.isAbstrakt() ) {

[Patch]
if ( ! con.isAbstrakt() && model.getTraitNames().contains( con.getFullyQualifiedName() ) ) {

[Demonstration 3]

[Buggy Method]
private static Notification randomNotification() {
    Map message = new HashMap<>();
    message.put("foo", "bar");
    message.put("body", "Save your money!");
    //    Map<String, String> message = Collections.map(Stream.of(
    //        new AbstractMap.SimpleEntry<>("body", "blah blah"),
    //        new AbstractMap.SimpleEntry<>("somethingElse", "blah blah"))
    //        .collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue())
    //        ));
    Calendar c = Calendar.getInstance();
    c.setTime(new Date());
    c.add(Calendar.DATE, 30);
    Date expiryDate = c.getTime();
    return new Notification("frys", "expiring_coupon", "frys", UUID.randomUUID(), message, new Date(), expiryDate);
}

[Buggy Hunk]
Map message = new HashMap<>();

[Patch]
Map<String,String> message = new HashMap<>();