[Demonstration 1]

[Buggy Method]
@Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] { {} });
}

[Buggy Hunk]
return Arrays.asList(new Object[][] { {} });

[Patch]
return TestScenario.from("default.conf.json");

[Demonstration 2]

[Buggy Method]
public static int getDifferentDay(String startDate, String endDate) {
    long different;
    try {
        different = new SimpleDateFormat(sLD).parse(endDate).getTime() - new SimpleDateFormat(sLD).parse(startDate).getTime();
        return (int) different / (1000 * 60 * 60 * 24);
    } catch (ParseException e) {
        e.printStackTrace();
        return 0;
    }
}

[Buggy Hunk]
return (int)different/(1000*60*60*24);

[Patch]
return (int)(different/(1000*60*60*24));

[Demonstration 3]

[Buggy Method]
private static void invokeMethod(Class<?> builderClass, Thing.Builder builder, String propertyName, SchemaOrgType value) throws JsonLdSyntaxException {
    String methodName = String.format("add%s", capFirst(shortNameOf(propertyName)));
    Method foundMethod = null;
    Object paramValue = null;
    if (value instanceof Text) {
        // Every schema.org property accepts Text value. There is an overloaded addXXX() method
        // that accepts a String parameter for each property in this library. Try to use this
        // method to set property with text value.
        try {
            foundMethod = builderClass.getMethod(methodName, String.class);
            paramValue = ((Text) value).getValue();
        } catch (NoSuchMethodException e) {
            foundMethod = null;
            paramValue = null;
        }
    } else {
        Method[] methods = builderClass.getMethods();
        for (Method m : methods) {
            if (m.getName().equals(methodName)) {
                foundMethod = m;
                Class<?> parameterType = m.getParameterTypes()[0];
                if (parameterType.isAssignableFrom(value.getClass())) {
                    paramValue = value;
                    break;
                } else if (value instanceof Number && Number.class.isAssignableFrom(parameterType)) {
                    // If the property value is a Number and parameter type of addXXX method is a sub-type
                    // of Number, try to call of() method to convert value into appropriate sub-type of
                    // Number, and invoke addXXX() metohd.
                    String strValue = ((Number) value).getValue();
                    try {
                        if (parameterType == Integer.class) {
                            Method method = parameterType.getMethod(OF_METHOD_NAME, int.class);
                            paramValue = method.invoke(null, java.lang.Integer.parseInt(strValue));
                        } else if (parameterType == Float.class) {
                            Method method = parameterType.getMethod(OF_METHOD_NAME, float.class);
                            paramValue = method.invoke(null, java.lang.Float.parseFloat(strValue));
                        } else {
                            Method method = parameterType.getMethod(OF_METHOD_NAME, String.class);
                            paramValue = method.invoke(null, ((Text) value).getValue());
                        }
                        break;
                    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
                        continue;
                    }
                }
            }
        }
    }
    if (foundMethod != null && paramValue != null) {
        try {
            foundMethod.invoke(builder, paramValue);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new JsonLdSyntaxException(String.format("Could not call method %s with parameter type %s on %s: check property name " + "and expected value type", methodName, paramValue.getClass().getName(), builderClass.getName()));
        }
    } else if (foundMethod == null) {
        // For unrecognized property name, use addProperty method to add property value.
        try {
            foundMethod = builderClass.getMethod(ADD_PROPERTY_METHOD_NAME, String.class, SchemaOrgType.class);
            foundMethod.invoke(builder, propertyName, value);
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            throw new JsonLdSyntaxException(String.format("Could not call method '%s' to add property '%s'", ADD_PROPERTY_METHOD_NAME, propertyName), e.getCause());
        }
    } else {
        throw new JsonLdSyntaxException(String.format("Could not call method '%s' on '%s': check property name and expected value type", methodName, builderClass.getName()));
    }
}

[Buggy Hunk]
paramValue = method.invoke(null, ((Text) value).getValue());

[Patch]
paramValue = method.invoke(null, ((Number) value).getValue());