Source:
<code>private boolean uploadBundle(String moduleSource, String moduleId, File bundleFile, String startBundle, String bundleSymbolicName) throws IOException, InterruptedException { String uri = String.format("http://%s:%d/admin/api/bundles/upload/", HOST, PORT); HttpPost httpPost = new HttpPost(uri); MultipartEntityBuilder entity = MultipartEntityBuilder.create(); Charset chars = Charset.forName("UTF-8"); entity.setCharset(chars); entity.addTextBody("moduleSource", moduleSource, ContentType.MULTIPART_FORM_DATA); if (moduleSource.equals("Repository")) { entity.addTextBody("moduleId", moduleId, ContentType.MULTIPART_FORM_DATA); } <START> else if (moduleSource.equals("File")) { <END> if (bundleFile == null) { fail("Bundle file was null."); } entity.addBinaryBody("bundleFile", bundleFile); } else { fail("Wrong module source."); } entity.addTextBody("startBundle", startBundle, ContentType.MULTIPART_FORM_DATA); httpPost.setEntity(entity.build()); int bundlesCountBeforeUpload = bundleContext.getBundles().length; HttpResponse response = getHttpClient().execute(httpPost); EntityUtils.consume(response.getEntity()); int bundlesCountAfterUpload = bundleContext.getBundles().length; if (response.getStatusLine().getStatusCode() != HttpStatus.ORDINAL_200_OK) { fail("Wrong response code."); } Bundle uploadedBundle = getBundleFromBundlesArray(bundleSymbolicName); if(uploadedBundle == null) { fail("Couldn't find uploaded bundle in current bundles."); } return (bundlesCountAfterUpload == bundlesCountBeforeUpload + 1) && (uploadedBundle.getState() == Bundle.ACTIVE); }</code><technical_language>convention in MOTECH is put else ifs elses in line bracket of previous block, blank space, eg. } else if { (apply in tests)</technical_language>

Target:
private void uploadBundle(String moduleSource, String moduleId, File bundleFile, String startBundle, String bundleSymbolicName) throws IOException, InterruptedException { String uri = String.format("http://%s:%d/admin/api/bundles/upload/", HOST, PORT); HttpPost httpPost = new HttpPost(uri); MultipartEntityBuilder entity = MultipartEntityBuilder.create(); Charset chars = Charset.forName("UTF-8"); entity.setCharset(chars); entity.addTextBody("moduleSource", moduleSource, ContentType.MULTIPART_FORM_DATA); if (moduleSource.equals("Repository")) { entity.addTextBody("moduleId", moduleId, ContentType.MULTIPART_FORM_DATA); } else if (moduleSource.equals("File")) { assertNotNull(bundleFile); entity.addBinaryBody("bundleFile", bundleFile); } else { fail("Wrong module source."); } entity.addTextBody("startBundle", startBundle, ContentType.MULTIPART_FORM_DATA); httpPost.setEntity(entity.build()); int bundlesCountBeforeUpload = bundleContext.getBundles().length; HttpResponse response = getHttpClient().execute(httpPost); EntityUtils.consume(response.getEntity()); int bundlesCountAfterUpload = bundleContext.getBundles().length; assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.ORDINAL_200_OK); Bundle uploadedBundle = getBundleFromBundlesArray(bundleSymbolicName); assertNotNull(uploadedBundle); assertEquals(bundlesCountAfterUpload, bundlesCountBeforeUpload + 1); assertEquals(uploadedBundle.getState(), Bundle.ACTIVE); }