[Demonstration 1]

[Buggy Method]
@Override
protected void onResume() {
    super.onResume();
    EventBus.getDefault().post(new AppListForegroundEvent());
}

[Buggy Hunk]
EventBus.getDefault().post(new AppListForegroundEvent());

[Patch]
EventBus.getDefault().post(new AppListForegroundEvent(true));

[Demonstration 2]

[Buggy Method]
public void bindGroup(Group group, int unread) {
    //group_name.setTextColor(ColorGenerator.DEFAULT.getColor(groupList.get(i).getName()));
    if (group.isPrivate())
        Picasso.with(activity).load(R.drawable.ic_lock_grey600_24dp).into(group_lock);
    else
        Picasso.with(activity).load(R.drawable.ic_lock_open_grey600_24dp).into(group_lock);
    group_name.setText(group.getName());
    group_unread.setText("" + unread);
    if (unread == 0) {
        group_unread.setVisibility(View.INVISIBLE);
    } else {
        group_unread.setVisibility(View.VISIBLE);
    }
    if (group.getDesc().equals(""))
        group_desc.setVisibility(View.GONE);
    else
        group_desc.setText("Description: " + group.getDesc());
    /*
             * Manage click events
             */
    final String gid = group.getGid();
    final String name = group.getName();
    final String groupBase64ID = group.getGroupBase64ID();
    title.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent groupStatusActivity = new Intent(activity, GroupDetailActivity.class);
            groupStatusActivity.putExtra("GroupID", gid);
            groupStatusActivity.putExtra("GroupName", name);
            activity.startActivity(groupStatusActivity);
            activity.overridePendingTransition(R.anim.activity_open_enter, R.anim.activity_open_exit);
        }
    });
    group_invite.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            int size = 200;
            Hashtable<EncodeHintType, ErrorCorrectionLevel> hintMap = new Hashtable<EncodeHintType, ErrorCorrectionLevel>();
            hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
            QRCodeWriter qrCodeWriter = new QRCodeWriter();
            try {
                BitMatrix bitMatrix = qrCodeWriter.encode(groupBase64ID, BarcodeFormat.QR_CODE, size, size, hintMap);
                Bitmap image = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
                if (image != null) {
                    for (int i = 0; i < size; i++) {
                        for (int j = 0; j < size; j++) {
                            image.setPixel(i, j, bitMatrix.get(i, j) ? Color.BLACK : Color.WHITE);
                        }
                    }
                    Intent intent = new Intent(activity, DisplayQRCode.class);
                    intent.putExtra("EXTRA_GROUP_NAME", name);
                    intent.putExtra("EXTRA_BUFFER", groupBase64ID);
                    intent.putExtra("EXTRA_QRCODE", image);
                    activity.startActivity(intent);
                }
            } catch (WriterException ignore) {
            }
            //}
        }
    });
}

[Buggy Hunk]
group_desc.setText("Description: "+group.getDesc());

[Patch]
group_desc.setText(activity.getString(R.string.description)+ " " + group.getDesc());

[Demonstration 3]

[Buggy Method]
@Test
@Ignore("[PAXWEB-929] should fix this")
public void testJsfResourceHandler() throws Exception {
    // prepare Bundle
    initWebListener();
    installAndStartBundle(mavenBundle().groupId("org.ops4j.pax.web.samples").artifactId("jsf-resourcehandler-myfaces").versionAsInProject().getURL());
    waitForWebListener();
    /*
         Workaround for Jenkins: it seems the test on Jenkins is to slow and is not done processing all resource-bundles.
         We Wait for a particualar image to be available.
          */
    new WaitCondition("webresources-extender done") {

        @Override
        protected boolean isFulfilled() throws Exception {
            try {
                String resp = testClient.testWebPath("http://127.0.0.1:8282/osgi-resourcehandler-myfaces/javax.faces.resource/images/iceland.jpg2.xhtml?type=osgi&ln=default&lv=2_0", 200);
                return resp != null;
            } catch (AssertionError e) {
                return false;
            }
        }
    }.waitForCondition();
    // start testing
    final String pageUrl = "http://127.0.0.1:8282/osgi-resourcehandler-myfaces/index.xhtml";
    final String imageUrl = "http://127.0.0.1:8282/osgi-resourcehandler-myfaces/javax.faces.resource/images/iceland.jpg.xhtml?type=osgi&ln=default&lv=2_0";
    BundleMatchers.isBundleActive("org.ops4j.pax.web.pax-web-resources-extender", bundleContext);
    BundleMatchers.isBundleActive("org.ops4j.pax.web.pax-web-resources-jsf", bundleContext);
    BundleMatchers.isBundleActive("jsf-resourcehandler-resourcebundle", bundleContext);
    BundleMatchers.isBundleActive("jsf-resourcehandler-myfaces", bundleContext);
    HttpTestClientFactory.createHttpComponentsTestClient().prepareResponseAssertion("Some Content shall be included from the jsf-application-bundle to test internal view-resources", resp -> StringUtils.contains(resp, "Hello Included Content")).prepareResponseAssertion("Standard header shall be loaded from resourcebundle to test external view-resources", resp -> StringUtils.contains(resp, "Standard Header")).prepareResponseAssertion("Images shall be loaded from resourcebundle to test external resources", resp -> StringUtils.contains(resp, "iceland.jpg")).prepareResponseAssertion("Customized footer shall be loaded from resourcebundle to test external view-resources", resp -> StringUtils.contains(resp, "Customized Footer")).prepareResponseAssertion("Image-URL must be created from OsgiResource", resp -> StringUtils.contains(resp, "/osgi-resourcehandler-myfaces/javax.faces.resource/images/iceland.jpg.xhtml?type=osgi&amp;ln=default&amp;lv=2_0")).prepareResponseAssertion("Flag-URL must be served from iceland-folder", resp -> StringUtils.contains(resp, "/osgi-resourcehandler-myfaces/javax.faces.resource/flag.png.xhtml?type=osgi&amp;loc=germany&amp;ln=layout")).executeTest(pageUrl);
    // Test German image
    HttpTestClientFactory.createHttpComponentsTestClient().// set header for german-locale in JSF
    addRequestHeader("Accept-Language", "de").withReturnCode(HttpStatus.SC_OK).prepareResponseAssertion("Flag-URL must be served from germany-folder", resp -> StringUtils.contains(resp, "/osgi-resourcehandler-myfaces/javax.faces.resource/flag.png.xhtml?type=osgi&amp;loc=germany&amp;ln=layout")).executeTest(pageUrl);
    // test resource serving for image
    HttpTestClientFactory.createHttpComponentsTestClient().executeTest(imageUrl);
    // Install override bundle
    String bundlePath = mavenBundle().groupId("org.ops4j.pax.web.samples").artifactId("jsf-resourcehandler-resourcebundle-override").versionAsInProject().getURL();
    Bundle installedResourceBundle = installAndStartBundle(bundlePath);
    BundleMatchers.isBundleActive(installedResourceBundle.getSymbolicName(), bundleContext);
    HttpTestClientFactory.createHttpComponentsTestClient().prepareResponseAssertion("Overriden footer shall be loaded from resourcebundle-override  to test external view-resources which are overriden", resp -> StringUtils.contains(resp, "Overriden Footer")).prepareResponseAssertion("Iceland-Picture shall be found in version 3.0 from resourcebunde-override", resp -> StringUtils.contains(resp, "javax.faces.resource/images/iceland.jpg.xhtml?type=osgi&amp;ln=default&amp;lv=2_0&amp;rv=3_0.jpg")).executeTest(pageUrl);
    // uninstall overriding bundle
    installedResourceBundle.stop();
    //to fast for tests, resource isn't fully gone yet
    Thread.sleep(1000);
    HttpTestClientFactory.createHttpComponentsTestClient().prepareResponseAssertion("Customized footer shall be loaded from resourcebundle", resp -> StringUtils.contains(resp, "Customized Footer")).executeTest(pageUrl);
    // Test If-Modified-Since
    ZonedDateTime now = ZonedDateTime.of(LocalDateTime.now(), ZoneId.of(ZoneId.SHORT_IDS.get("ECT")));
    // "Modified-Since should mark response with 304"
    HttpTestClientFactory.createHttpComponentsTestClient().withReturnCode(HttpStatus.SC_NOT_MODIFIED).addRequestHeader(HttpHeaders.IF_MODIFIED_SINCE, now.format(DateTimeFormatter.RFC_1123_DATE_TIME)).executeTest(imageUrl);
    // Test second faces-mapping which uses a prefix (faces/*)
    final String pageUrlWithPrefixMapping = "http://127.0.0.1:8282/osgi-resourcehandler-myfaces/faces/index.xhtml";
    final String imageUrlWithPrefixMapping = "http://127.0.0.1:8282/osgi-resourcehandler-myfaces/faces/javax.faces.resource/images/iceland.jpg?type=osgi&ln=default&lv=2_0";
    HttpTestClientFactory.createHttpComponentsTestClient().executeTest(imageUrlWithPrefixMapping);
    HttpTestClientFactory.createHttpComponentsTestClient().prepareResponseAssertion("Image-URL must be created from OsgiResource. This time the second servlet-mapping (faces/*) must be used.", resp -> StringUtils.contains(resp, "/osgi-resourcehandler-myfaces/faces/javax.faces.resource/images/iceland.jpg?type=osgi&amp;ln=default&amp;lv=2_0")).executeTest(pageUrlWithPrefixMapping);
}

[Buggy Hunk]
new WaitCondition("webresources-extender done") {

[Patch]
new WaitCondition("webresources-extender done", 30000) {