auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testHasClone() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NoCloneCheck.class); final String[] expected = { "10: " + getCheckMessage(MSG_KEY), "27: " + getCheckMessage(MSG_KEY), "35: " + getCheckMessage(MSG_KEY), "39: " + getCheckMessage(MSG_KEY), "52: " + getCheckMessage(MSG_KEY), "60: " + getCheckMessage(MSG_KEY), "98: " + getCheckMessage(MSG_KEY), }; <START> verify(checkConfig, getPath("InputNoCloneClones.java"), expected); <END> }</code><technical_language>NoCloneClones sounds a weird. name InputNoClone</technical_language>

Target:
public void testHasClone() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NoCloneCheck.class); final String[] expected = { "10: " + getCheckMessage(MSG_KEY), "27: " + getCheckMessage(MSG_KEY), "35: " + getCheckMessage(MSG_KEY), "39: " + getCheckMessage(MSG_KEY), "52: " + getCheckMessage(MSG_KEY), "60: " + getCheckMessage(MSG_KEY), "98: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, getPath("InputNoClone.java"), expected); }
Source:
<code>@Override public void save(D d, String path) { ObjectOutputStream outStream = null; try { outStream = new ObjectOutputStream(new FileOutputStream(path)); outStream.writeObject(d); } catch (IOException e) { if (log != null) <START> log.error("Error opening file", e); <END> } finally { try { if (outStream != null) outStream.close(); } catch (IOException e) { if (log != null) log.error("Error closing file", e); } } }</code><technical_language>please add dot end of this message, other similar messages lack dots end</technical_language>

Target:
@Override public void save(D d, String path) { try (FileOutputStream fos = new FileOutputStream(path)){ try (ObjectOutputStream outStream = new ObjectOutputStream(fos)){ outStream.writeObject(d); } } catch (IOException e) { if (log != null) log.error("Error opening file.", e); } }
Source:
<code>private List<Parameter> getFilterParameters() { String typeName = dictionary.getJsonAliasFor(type); List<String> attributeNames = dictionary.getAttributes(type); List<Parameter> params = new ArrayList<>(); params.add(new QueryParameter() .type("string") .name("filter[" + typeName + "]") .description("Filters the collection of " + typeName + " using a 'disjoint' RSQL expression")); if (lineage.isEmpty()) { params.add(new QueryParameter() .type("string") .name("filter") .description("Filters the collection of " + typeName + " using a 'joined' RSQL expression")); } <START> if (supportLegacyDialect) { <END> for (Operator op : filterOperators) { attributeNames.forEach((name) -> { Class<?> attributeClass = dictionary.getType(type, name); if (attributeClass.isPrimitive() || String.class.isAssignableFrom(attributeClass)) { params.add(new QueryParameter() .type("string") .name("filter[" + typeName + "." + name + "][" + op.getNotation() + "]") .description("Filters the collection of " + typeName + " by the attribute " + name + " " + "using the operator " + op.getNotation())); } }); } } return params; }</code><technical_language>new Elide, I right in thinking supports dialect.. for users want legacy dialect, RSQL examples displayed</technical_language>

Target:
private List<Parameter> getFilterParameters() { String typeName = dictionary.getJsonAliasFor(type); List<String> attributeNames = dictionary.getAttributes(type); List<Parameter> params = new ArrayList<>(); if (supportRSQLDialect) { params.add(new QueryParameter() .type("string") .name("filter[" + typeName + "]") .description("Filters the collection of " + typeName + " using a 'disjoint' RSQL expression")); if (lineage.isEmpty()) { params.add(new QueryParameter() .type("string") .name("filter") .description("Filters the collection of " + typeName + " using a 'joined' RSQL expression")); } } if (supportLegacyDialect) { for (Operator op : filterOperators) { attributeNames.forEach((name) -> { Class<?> attributeClass = dictionary.getType(type, name); if (attributeClass.isPrimitive() || String.class.isAssignableFrom(attributeClass)) { params.add(new QueryParameter() .type("string") .name("filter[" + typeName + "." + name + "][" + op.getNotation() + "]") .description("Filters the collection of " + typeName + " by the attribute " + name + " " + "using the operator " + op.getNotation())); } }); } } return params; }
Source:
<code>public static boolean isNotNullishIgnoreSpace(String value) { <START> return (value != null && !value.trim().isEmpty()); <END> }</code><technical_language>Unnecessary parens return value</technical_language>

Target:
public static boolean isNotNullishIgnoreSpace(String value) { return value != null && !value.trim().isEmpty(); }
Source:
<code>while ((line = br.readLine()) != null) { if (!pythonProcess.isAlive()) { break; } <START> if (line.equals("Python Ready")) { <END> handlePythonReadinessChange(true); LOG.info("Python Ready"); } else { LOG.error("> " + line); } }</code><technical_language>This misleading listening for errors this reading stderr. this separated this method</technical_language>

Target:
while ((line = br.readLine()) != null) { if (!pythonProcess.isAlive()) { break; } LOG.error("> " + line); }
Source:
<code>private static DetailAST skipVariableAssign(final DetailAST currentAST) { DetailAST result = currentAST; <START> if (currentAST.getType() == TokenTypes.ASSIGN) { <END> result = currentAST.getFirstChild().getNextSibling(); } return result; }</code><technical_language>ASSIGN expressions requires a variable store value. children IDENT for sure</technical_language>

Target:
private static DetailAST skipVariableAssign(final DetailAST currentAST) { DetailAST result = currentAST; while (result.getType() == TokenTypes.LPAREN) { result = result.getNextSibling(); } if (result.getType() == TokenTypes.ASSIGN) { result = result.getFirstChild().getNextSibling(); } return result; }
Source:
<code>public static boolean isPresent(String klass) { try { Class.forName(klass); return true; <START> } catch (ReflectiveOperationException e) { <END> return false; } }</code><technical_language>named satisfy "log throw neither, express decision omit handling" rule</technical_language>

Target:
public static boolean isPresent(String klass) { try { Class.forName(klass); return true; } catch (ReflectiveOperationException ignored) { return false; } }
Source:
<code>public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student with given email in given course.", HttpStatus.SC_NOT_FOUND); } InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId), student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS); boolean hasSection = false; try { hasSection = logic.hasIndicatedSections(courseId); } catch (EntityDoesNotExistException e) { return new JsonResult("No course with given id.", HttpStatus.SC_NOT_FOUND); } StudentProfileAttributes studentProfile = null; <START> if (!"".equals(student.googleId)) { <END> studentProfile = logic.getStudentProfile(student.googleId); } student.googleId = null; student.key = null; if (studentProfile != null) { studentProfile.googleId = null; studentProfile.modifiedDate = null; } StudentInfo output = new StudentInfo(student, studentProfile, hasSection); return new JsonResult(output); }</code><technical_language>change this condition student.isRegistered()</technical_language>

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student with given email in given course.", HttpStatus.SC_NOT_FOUND); } InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId), student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS); boolean hasSection = false; try { hasSection = logic.hasIndicatedSections(courseId); } catch (EntityDoesNotExistException e) { return new JsonResult("No course with given id.", HttpStatus.SC_NOT_FOUND); } StudentProfileAttributes studentProfile = null; if (student.isRegistered()) { studentProfile = logic.getStudentProfile(student.googleId); } student.googleId = null; student.key = null; if (studentProfile != null) { studentProfile.googleId = null; studentProfile.modifiedDate = null; } StudentInfo output = new StudentInfo(student, studentProfile, hasSection); return new JsonResult(output); }
Source:
<code>public List<String> getQueries() { Attribute queryAttr = this.getAttribute(Associations.RELATED); return queryAttr == null <START> ? new ArrayList<>() <END> : queryAttr.getValues().stream().map(String.class::cast).collect(Collectors.toList()); }</code><technical_language>Is a reason Collections.emptyList()</technical_language>

Target:
public List<String> getQueries() { Attribute queryAttr = this.getAttribute(WorkspaceConstants.WORKSPACE_QUERIES); return queryAttr == null ? new ArrayList<>() : queryAttr .getValues() .stream() .filter(String.class::isInstance) .map(String.class::cast) .collect(Collectors.toList()); }
Source:
<code>private void reloadUrl(String url, @Nullable String pdfFilePath) { if (mPdfAndroidJavascriptBridge != null) { <START> mPdfAndroidJavascriptBridge.cleanUp(); <END> mWebView.removeJavascriptInterface("PdfAndroidJavascriptBridge"); } if (pdfFilePath != null && isPdfRenderingSupported() && TextUtils.equals(PDF_LOADER_URL, url)) { mPdfAndroidJavascriptBridge = new PdfAndroidJavascriptBridge(getContext(), pdfFilePath); mWebView.addJavascriptInterface(mPdfAndroidJavascriptBridge, "PdfAndroidJavascriptBridge"); mWebView.setInitialScale(1); } mWebView.reloadUrl(url); }</code><technical_language>this finalize() instead</technical_language>

Target:
private void reloadUrl(String url, @Nullable String pdfFilePath) { if (mPdfAndroidJavascriptBridge != null) { mPdfAndroidJavascriptBridge.cleanUp(); mWebView.removeJavascriptInterface("PdfAndroidJavascriptBridge"); } if (pdfFilePath != null && isPdfRenderingSupported() && TextUtils.equals(PDF_LOADER_URL, url)) { mPdfAndroidJavascriptBridge = new PdfAndroidJavascriptBridge(pdfFilePath, this::offerExternalApp); mWebView.addJavascriptInterface(mPdfAndroidJavascriptBridge, "PdfAndroidJavascriptBridge"); mWebView.setInitialScale(1); } mWebView.reloadUrl(url); }
Source:
<code>private static void checkFlaskCorsCall(SubscriptionContext ctx) { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); Symbol calleeSymbol = callExpression.calleeSymbol(); if (!isSymbol(calleeSymbol, "flask_cors.CORS")) { return; } if (callExpression.arguments().size() == 1) { ctx.addIssue(callExpression, MESSAGE); return; } getArgument(callExpression.arguments(), ORIGINS).ifPresent(argument -> { if (originsToReport(argument)) { ctx.addIssue(callExpression, MESSAGE); } }); getArgument(callExpression.arguments(), "resources").ifPresent(argument -> { <START> if (isString(argument, API_STAR)) { <END> ctx.addIssue(callExpression, MESSAGE); } else { getSingleValueInDictionary(argument, API_STAR).ifPresent(value -> getSingleValueInDictionary(value, ORIGINS).ifPresent(origins -> { if (originsToReport(origins)) { ctx.addIssue(callExpression, MESSAGE); } }) ); } }); }</code><technical_language>Is route /api/*? /foo/*</technical_language>

Target:
private static void checkFlaskCorsCall(SubscriptionContext ctx) { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); Symbol calleeSymbol = callExpression.calleeSymbol(); if (!isSymbol(calleeSymbol, "flask_cors.CORS")) { return; } if (callExpression.arguments().size() == 1) { ctx.addIssue(callExpression, MESSAGE); return; } Optional<Expression> originsArgument = getArgument(callExpression.arguments(), ORIGINS); originsArgument.ifPresent(argument -> { if (originsToReport(argument)) { ctx.addIssue(callExpression, MESSAGE); } }); Optional<Expression> resourcesArgumentOpt = getArgument(callExpression.arguments(), "resources"); if (!resourcesArgumentOpt.isPresent()) { return; } Expression resourcesArgument = resourcesArgumentOpt.get(); if (resourcesArgument.is(STRING_LITERAL) && !originsArgument.isPresent()) { ctx.addIssue(callExpression, MESSAGE); } else if (resourcesArgument.is(DICTIONARY_LITERAL)) { List<DictionaryLiteralElement> elements = ((DictionaryLiteral) resourcesArgument).elements(); for (DictionaryLiteralElement element : elements) { if (!element.is(KEY_VALUE_PAIR)) { continue; } Optional<Expression> originsValue = getValueInDictionary(((KeyValuePair) element).value(), ORIGINS); if (originsValue.isPresent() && originsToReport(originsValue.get())) { ctx.addIssue(callExpression, MESSAGE); return; } } } }
Source:
<code>public void deleteFromRealm(int location) { realm.checkIfValid(); <START> if (!isTablePresent()) { <END> throw new IndexOutOfBoundsException("No results to be deleted."); } TableOrView table = getTable(); table.remove(location); }</code><technical_language>Remove this. caught table.remove()</technical_language>

Target:
public void deleteFromRealm(int location) { realm.checkIfValid(); TableOrView table = getTable(); table.remove(location); }
Source:
<code>public static boolean keepsOrdering(TargetMapping mapping) { int prevTarget = -1; for (int i = 0; i < mapping.getSourceCount(); i++) { int target = mapping.getTargetOpt(i); <START> if (target != -1 && target < prevTarget) { <END> return false; } if (target != -1) { prevTarget = target; } } return true; }</code><technical_language>combine if clause together</technical_language>

Target:
public static boolean keepsOrdering(TargetMapping mapping) { int prevTarget = -1; for (int i = 0; i < mapping.getSourceCount(); i++) { int target = mapping.getTargetOpt(i); if (target != -1) { if (target < prevTarget) { return false; } prevTarget = target; } } return true; }
Source:
<code>public void updateStatusLeaderAtStartupTest(){ spy.updateStatus(State.LEADER); verify(spy).updateStatus(State.LEADER); verify(spy, never()).updateOnRunningConsumer(State.LEADER); verify(spy, never()).askAndProcessSnapshotOnDemand(any(SnapshotInfos.class)); <START> verify(spy, times(1)).enableConsumeAndStartLoop(State.LEADER); <END> verify(spy, times(1)).setLastProcessedKey(); verify(spy, times(1)).assignAndStartConsume(); }</code><technical_language>eq(State.LEADER) instead of direct</technical_language>

Target:
public void updateStatusLeaderAtStartupTest(){ spy.updateStatus(State.LEADER); verify(spy).updateStatus(State.LEADER); verify(spy, never()).updateOnRunningConsumer(any(State.class)); verify(spy, never()).askAndProcessSnapshotOnDemand(any(SnapshotInfos.class)); verify(spy, times(1)).enableConsumeAndStartLoop(eq(State.LEADER)); verify(spy, times(1)).setLastProcessedKey(); verify(spy, times(1)).assignAndStartConsume(); }
Source:
<code>public HttpRequestIntent httpRequestIntent() { final String contentType; if (givenContentType != null) { contentType = givenContentType; } else if (body.getName().toLowerCase().endsWith(".jpeg") || body.getName().toLowerCase().endsWith(".jpg")) { contentType = "image/jpeg"; } else if (body.getName().toLowerCase().endsWith(".gif")) { contentType = "image/gif"; } else if (body.getName().toLowerCase().endsWith(".png")) { contentType = "image/png"; } else { contentType = "unknown"; <START> new IllegalStateException("cannot determine content type for " + body.getName()); <END> } final UrlQueryBuilder builder = UrlQueryBuilder.of(); if (!isEmpty(sku)) { builder.add("sku", sku); } if (!isEmpty(filename)) { builder.add("filename", filename); } if (null != variant) { builder.add("variant", "" + variant); } if (null != staged) { builder.add("staged", "" + staged); } final String path = String.format("/products/%s/images%s", productId, builder.toStringWithOptionalQuestionMark()); return HttpRequestIntent.of(HttpMethod.POST, path, body, contentType); }</code><technical_language>throw exception</technical_language>

Target:
public HttpRequestIntent httpRequestIntent() { final String contentType; if (givenContentType != null) { if (!ACCEPTABLE_IMAGE_FORMATS_MAP.values().contains(givenContentType)) { throw new IllegalStateException("Content Type " + givenContentType + " is not accepted."); } else { contentType = givenContentType; } } else { String extension = ""; int i = body.getName().lastIndexOf('.'); if (i > 0) { extension = body.getName().substring(i); } contentType = ACCEPTABLE_IMAGE_FORMATS_MAP.get(extension); if (contentType == null) { throw new IllegalStateException("cannot determine content type for " + body.getName()); } } final UrlQueryBuilder builder = UrlQueryBuilder.of(); if (!isEmpty(sku)) { builder.add("sku", sku); } if (!isEmpty(filename)) { builder.add("filename", filename); } if (null != variant) { builder.add("variant", "" + variant); } if (null != staged) { builder.add("staged", "" + staged); } final String path = String.format("/products/%s/images%s", productId, builder.toStringWithOptionalQuestionMark()); return HttpRequestIntent.of(HttpMethod.POST, path, body, contentType); }
Source:
<code>private String getRangerUserSyncRoleName(ApiClient client, String clusterName) throws ApiException { RolesResourceApi rolesResourceApi = clouderaManagerApiFactory.getRolesResourceApi(client); List<ApiRole> apiRoleList = rolesResourceApi.readRoles(clusterName, RANGER_SERVICE_NAME, null, null) .getItems() .stream() <START> .filter(apiRole -> apiRole.getType().equals(RANGER_USER_SYNC_ROLE_TYPE)) <END> .collect(Collectors.toList()); return Iterables.getOnlyElement(apiRoleList).getName(); }</code><technical_language>reversed: RANGER_USER_SYNC_ROLE_TYPE.equals(apiRole.getType())</technical_language>

Target:
private String getRangerUserSyncRoleName(ApiClient client, String clusterName) throws ApiException { RolesResourceApi rolesResourceApi = clouderaManagerApiFactory.getRolesResourceApi(client); List<ApiRole> apiRoleList = rolesResourceApi.readRoles(clusterName, RANGER_SERVICE_NAME, null, null) .getItems() .stream() .filter(apiRole -> RANGER_USER_SYNC_ROLE_TYPE.equals(apiRole.getType())) .collect(Collectors.toList()); return Iterables.getOnlyElement(apiRoleList).getName(); }
Source:
<code>private boolean canCoerceForStruct(HiveType fromHiveType, HiveType toHiveType) { if (!fromHiveType.getCategory().equals(Category.STRUCT) || !toHiveType.getCategory().equals(Category.STRUCT)) { return false; } List<String> fromFieldNames = getAllStructFieldNames(fromHiveType); List<String> toFieldNames = getAllStructFieldNames(toHiveType); List<HiveType> fromFieldTypes = getAllStructFieldTypeInfos(fromHiveType); List<HiveType> toFieldTypes = getAllStructFieldTypeInfos(toHiveType); <START> for (int i = 0; i < Math.min(fromFieldTypes.size(), toFieldTypes.size()); i++) { <END> if (!fromFieldNames.get(i).equals(toFieldNames.get(i)) || (!fromFieldTypes.get(i).equals(toFieldTypes.get(i)) && !canCoerce(fromFieldTypes.get(i), toFieldTypes.get(i)))) { return false; } } return true; }</code><technical_language>In general, statically import Math.min</technical_language>

Target:
private boolean canCoerceForStruct(HiveType fromHiveType, HiveType toHiveType) { if (!fromHiveType.getCategory().equals(Category.STRUCT) || !toHiveType.getCategory().equals(Category.STRUCT)) { return false; } List<String> fromFieldNames = ((StructTypeInfo) fromHiveType.getTypeInfo()).getAllStructFieldNames(); List<String> toFieldNames = ((StructTypeInfo) toHiveType.getTypeInfo()).getAllStructFieldNames(); List<HiveType> fromFieldTypes = extractStructFieldTypes(fromHiveType); List<HiveType> toFieldTypes = extractStructFieldTypes(toHiveType); for (int i = 0; i < min(fromFieldTypes.size(), toFieldTypes.size()); i++) { if (!fromFieldNames.get(i).equals(toFieldNames.get(i))) { return false; } if (!fromFieldTypes.get(i).equals(toFieldTypes.get(i)) && !canCoerce(fromFieldTypes.get(i), toFieldTypes.get(i))) { return false; } } return true; }
Source:
<code>public String toString() { String string = null; switch (this) { case GET: string = "GET"; break; case POST: string = "POST"; break; case PUT: string = "PUT"; break; case DELETE: string = "DELETE"; break; <START> default: <END> break; } return string; }</code><technical_language>assume call super.toString() throw IllegalStateException happen</technical_language>

Target:
public String toString() { String string; switch (this) { case GET: string = "GET"; break; case POST: string = "POST"; break; case PUT: string = "PUT"; break; case DELETE: string = "DELETE"; break; default: throw new IllegalArgumentException("Invalid http method: <" + this+ ">"); } return string; }
Source:
<code>private List<Integer> generateBlockIdNotInLocalStore() { final List<Integer> blockIdsInLocalStore = operationRouter.getCurrentLocalBlockIds(); final List<Integer> blockIdList = new ArrayList<>(); final int minBlockId = MIN_BLOCK_ID; <START> final int maxBlockId = MIN_BLOCK_ID + NUM_TOTAL_BLOCKS; <END> for (int blockId = minBlockId; blockId < maxBlockId; blockId++) { if (blockIdList.contains(blockId) || blockIdsInLocalStore.contains(blockId)) { continue; } blockIdList.add(blockId); } return blockIdList; }</code><technical_language>maxBlockId = MIN_BLOCK_ID + NUM_TOTAL_BLOCKS -1</technical_language>

Target:
private List<Integer> generateBlockIdNotInLocalStore() { final List<Integer> blockIdsInLocalStore = operationRouter.getCurrentLocalBlockIds(); final List<Integer> blockIdList = new ArrayList<>(); final int minBlockId = MIN_BLOCK_ID; final int maxBlockId = MIN_BLOCK_ID + NUM_TOTAL_BLOCKS - 1; for (int blockId = minBlockId; blockId <= maxBlockId; blockId++) { if (blockIdsInLocalStore.contains(blockId)) { continue; } blockIdList.add(blockId); } return blockIdList; }
Source:
<code>public TableScanNode tableScan(List<Symbol> symbols, Map<Symbol, ColumnHandle> assignments) { Expression originalConstraint = null; <START> return new TableScanNode(idAllocator.getNextId(), <END> new TableHandle( new ConnectorId("testConnector"), new TestingTableHandle()), symbols, assignments, Optional.empty(), TupleDomain.all(), originalConstraint); }</code><technical_language>undo</technical_language>

Target:
public TableScanNode tableScan(List<Symbol> symbols, Map<Symbol, ColumnHandle> assignments) { TableHandle tableHandle = new TableHandle(new ConnectorId("testConnector"), new TestingTableHandle()); return tableScan(tableHandle, symbols, assignments); }
Source:
<code>public void evaluate_shouldReturnAllInSpecifiedCareSetting() throws Exception { cohortDefinition.setOnlyCurrentlyActive(true); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); <START> System.out.println("Care Setting" + cohort.getMemberIds()); <END> }</code><technical_language>a this? <LINK_0></technical_language>

Target:
public void evaluate_shouldReturnAllInSpecifiedCareSetting() throws Exception { CareSetting careSetting = Context.getService(OrderService.class).getCareSetting(1); cohortDefinition.setCareSetting(careSetting); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); Assert.assertTrue(cohort.contains(2)); Assert.assertTrue(cohort.contains(7)); Assert.assertTrue(cohort.contains(8)); Assert.assertTrue(cohort.contains(21)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(5, cohort.size()); }
Source:
<code>private ZipFile(final SeekableByteChannel channel, final String archiveName, final String encoding, final boolean useUnicodeExtraFields, final boolean closeOnError, final boolean ignoreLocalFileHeader) throws IOException { isSplitZipArchive = (channel instanceof ZipSplitReadOnlySeekableByteChannel); this.archiveName = archiveName; this.encoding = encoding; this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding); this.useUnicodeExtraFields = useUnicodeExtraFields; archive = channel; boolean success = false; try { final Map<ZipArchiveEntry, NameAndComment> entriesWithoutUTF8Flag = populateFromCentralDirectory(); if (!ignoreLocalFileHeader) { resolveLocalFileHeaderData(entriesWithoutUTF8Flag); } fillNameMap(); success = true; <START> } catch (IOException e) { <END> throw new IOException("Error on ZipFile " + archiveName + e.getMessage(), e); } finally { closed = !success; if (!success && closeOnError) { IOUtils.closeQuietly(archive); } } }</code><technical_language>archiveName include path</technical_language>

Target:
private ZipFile(final SeekableByteChannel channel, final String archiveName, final String encoding, final boolean useUnicodeExtraFields, final boolean closeOnError, final boolean ignoreLocalFileHeader) throws IOException { isSplitZipArchive = (channel instanceof ZipSplitReadOnlySeekableByteChannel); this.archiveName = archiveName; this.encoding = encoding; this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding); this.useUnicodeExtraFields = useUnicodeExtraFields; archive = channel; boolean success = false; try { final Map<ZipArchiveEntry, NameAndComment> entriesWithoutUTF8Flag = populateFromCentralDirectory(); if (!ignoreLocalFileHeader) { resolveLocalFileHeaderData(entriesWithoutUTF8Flag); } fillNameMap(); success = true; } catch (IOException e) { throw new IOException("Error on ZipFile " + archiveName, e); } finally { closed = !success; if (!success && closeOnError) { IOUtils.closeQuietly(archive); } } }
Source:
<code>public void updateReviewItem(ChangeInfo task) { <START> fReviewList.put(task.getChange_id(), task); END> }</code><technical_language>key create fReviewList</technical_language>

Target:
public void updateReviewItem(ChangeInfo task) { fReviewList.put(task.getId(), task); }
Source:
<code>public Response stopMigrate(Action action) { <START> validateParameters(action, "bricks"); <END> GlusterVolumeRemoveBricksParameters params = toParameters(action); return performAction(VdcActionType.StopRemoveGlusterVolumeBricks, params, action, false); }</code><technical_language>validating ^ id name is provided</technical_language>

Target:
public Response stopMigrate(Action action) { validateParameters(action, "bricks"); validateBrickNames(action); GlusterVolumeRemoveBricksParameters params = toParameters(action); return performAction(VdcActionType.StopRemoveGlusterVolumeBricks, params, action, false); }
Source:
<code>private void checkNoExternalDependencyExposed(DetailAST methodDefToken) { final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); <START> if (modifiersToken != null && <END> (modifiersToken.branchContains(TokenTypes.LITERAL_PUBLIC) || modifiersToken.branchContains(TokenTypes.LITERAL_PROTECTED))) { checkReturnType(methodDefToken.findFirstToken(TokenTypes.TYPE)); checkParametersType(methodDefToken.findFirstToken(TokenTypes.PARAMETERS)); } }</code><technical_language>Returning method early if a condition is met reading code a lot easier. java if (modifiersToken == null) { return; } if (!modifiersToken.branchContains(TokenTypes.LITERAL_PUBLIC) && !modifiersToken.branchContains(TokenTypes.LITERAL_PROTECTED)) { return; } checkReturnType(methodDefToken.findFirstToken(TokenTypes.TYPE)); checkParametersType(methodDefToken.findFirstToken(TokenTypes.PARAMETERS));</technical_language>

Target:
private void checkNoExternalDependencyExposed(DetailAST methodDefToken) { final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); if (!accessModifier.equals(AccessModifier.PUBLIC) && !accessModifier.equals(AccessModifier.PROTECTED)) { return; } final DetailAST typeToken = methodDefToken.findFirstToken(TokenTypes.TYPE); if (typeToken != null) { getInvalidReturnTypes(typeToken).forEach( (token, returnTypeName) -> log(token, String.format(EXTERNAL_DEPENDENCY_ERROR, returnTypeName))); } final DetailAST parametersToken = methodDefToken.findFirstToken(TokenTypes.PARAMETERS); if (parametersToken != null) { getInvalidParameterTypes(parametersToken).forEach( (token, returnTypeName) -> log(token, String.format(EXTERNAL_DEPENDENCY_ERROR, returnTypeName))); } }
Source:
<code>private String createIniFile(String commaSeparatedFilePaths, String commaSeparatedParentAccessions) { String iniPath = ""; Map<String, String> iniFileMap = new TreeMap<>(); Workflow wf = metadata.getWorkflow(Integer.getInteger(workflowAccession)); Set<WorkflowAttribute> wps = wf.getWorkflowAttributes(); <START> Map<String,String> defaults = wf.getParameterDefaults(); <END> wps.forEach((att) -> { String val=defaults.get(att.getTag()); if (val == null) { LOGGER.debug("Excluding null workflow ini property [" + att.getTag() + "]"); } else { iniFileMap.put(att.getTag(), val); } }); Map<String, String> iniParameters = modifyIniFile(commaSeparatedFilePaths, commaSeparatedParentAccessions); for (String param : iniParameters.keySet()) { iniFileMap.put(param, iniParameters.get(param)); } PrintWriter writer = null; File file = null; try { file = File.createTempFile("" + random.nextInt(), ".ini"); writer = new PrintWriter(new FileWriter(file), true); for (String key : iniFileMap.keySet()) { StringBuilder sb = new StringBuilder(); sb.append(key).append("=").append(iniFileMap.get(key)); writer.println(sb.toString()); } } catch (IOException ex) { LOGGER.error("BasicDecider.createIniFile IOException",ex); } finally { if (writer != null) { writer.close(); } } if (file != null) { iniPath = file.getAbsolutePath(); } return iniPath; }</code><technical_language>Mike pointed out this is wrong thing</technical_language>

Target:
private String createIniFile(String commaSeparatedFilePaths, String commaSeparatedParentAccessions) { String iniPath = ""; Workflow wf = metadata.getWorkflow(Integer.parseInt(workflowAccession)); Map<String, String> iniFileMap = new TreeMap<>(wf.getParameterDefaults()); iniFileMap.putAll(modifyIniFile(commaSeparatedFilePaths, commaSeparatedParentAccessions)); PrintWriter writer = null; File file = null; try { file = File.createTempFile("" + random.nextInt(), ".ini"); writer = new PrintWriter(new FileWriter(file), true); for (String key : iniFileMap.keySet()) { StringBuilder sb = new StringBuilder(); sb.append(key).append("=").append(iniFileMap.get(key)); writer.println(sb.toString()); } } catch (IOException ex) { LOGGER.error("BasicDecider.createIniFile IOException",ex); } finally { if (writer != null) { writer.close(); } } if (file != null) { iniPath = file.getAbsolutePath(); } return iniPath; }
Source:
<code>protected void doInit() { super.doInit(); if (!this.evaluationContextSet) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } <START> Assert.state(this.closeStreamAfterSend ? this.isSingleUse : true, <END> "Single use connection needed with closeStreamAfterSend"); }</code><technical_language>!this.closeStreamAfterSend || this.isSingleUse</technical_language>

Target:
protected void doInit() { super.doInit(); if (!this.evaluationContextSet) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } Assert.state(!this.closeStreamAfterSend || this.isSingleUse, "Single use connection needed with closeStreamAfterSend"); }
Source:
<code>protected void doRun() throws Exception { checkEnteringPhase(1); <START> Preconditions.checkState(readOnlyRebindCount.get()==Integer.MIN_VALUE, "Partial rebind in read-only mode not supported"); <END> Preconditions.checkNotNull(objectsToRebindInitial, "Objects to rebind must be set"); LOG.debug("Partial rebind Rebinding ("+mode+") from "+rebindManager.getPersister().getBackingStoreDescription()+"..."); Builder mementoRawBuilder = BrooklynMementoRawData.builder(); objectsToRebindFinal = MutableSet.of(); while (objectsToRebindInitial.hasNext()) { BrooklynObject bo = objectsToRebindInitial.next(); objectsToRebindFinal.add(bo); if (bo instanceof Entity) { objectsToRebindFinal.addAll( ((EntityInternal)bo).getPolicies() ); objectsToRebindFinal.addAll( ((EntityInternal)bo).getEnrichers() ); objectsToRebindFinal.addAll( ((EntityInternal)bo).feeds().getFeeds() ); } } for (BrooklynObject bo: objectsToRebindFinal) { Memento m = ((BrooklynObjectInternal)bo).getRebindSupport().getMemento(); BrooklynMementoPersister p = rebindManager.getPersister(); String mr = ((BrooklynMementoPersisterToObjectStore)p).getMementoSerializer().toString(m); mementoRawBuilder.put(BrooklynObjectType.of(bo), bo.getId(), mr); } mementoRawData = mementoRawBuilder.build(); preprocessManifestFiles(); phase++; instantiateLocationsAndEntities(); instantiateMementos(); instantiateAdjuncts(instantiator); reconstructEverything(); associateAdjunctsWithEntities(); manageTheObjects(); finishingUp(); }</code><technical_language>This a strange check if state is read-only mode. I guess variable name</technical_language>

Target:
protected void doRun() throws Exception { Preconditions.checkState(rebindManager.getRebindMode()==ManagementNodeState.MASTER, "Partial rebind only supported in master mode, not "+rebindManager.getRebindMode()); Preconditions.checkState(readOnlyRebindCount.get()==Integer.MIN_VALUE, "Rebind count should be MIN when running in master mode"); Preconditions.checkNotNull(objectsToRebindInitial, "Objects to rebind must be set"); LOG.debug("Partial rebind Rebinding ("+mode+") from "+rebindManager.getPersister().getBackingStoreDescription()+"..."); super.doRun(); }
Source:
<code>public void removeNotificationListener(ObjectName name, NotificationListener listener) { if(!isRunningInJmc() && !isRunningInJConsole() && !isRunningInJVisualVm()) { <START> throw new UnsupportedOperationException("removeNotificationListener not supported for Jolokia"); <END> } }</code><technical_language>suggestion throw new UnsupportedOperationException("removeNotificationListener supported Jolokia");</technical_language>

Target:
public void removeNotificationListener(ObjectName name, NotificationListener listener) { if(!isRunningInJmc() && !isRunningInJConsole() && !isRunningInJVisualVm()) { throw new UnsupportedOperationException("removeNotificationListener not supported by Jolokia"); } }
Source:
<code>public ModelAndView displayMrrtReportTemplate(HttpServletRequest request, @RequestParam String templateId) { final ModelAndView modelAndView = new ModelAndView(MRRT_REPORT_TEMPLATE_FORM_VIEW); try { MrrtReportTemplate mrrtReportTemplate = mrrtReportTemplateService.getMrrtReportTemplateByUuid(templateId); String templateBody = mrrtReportTemplateService.getMrrtReportTemplateHtmlBody(mrrtReportTemplate); modelAndView.addObject("templateBody", templateBody); modelAndView.addObject("template", mrrtReportTemplate); } catch (IOException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Error occured while dispaying template => " + exception.getMessage()); return new ModelAndView("/module/radiology/radiologyDashboardForm"); } <START> catch (IllegalArgumentException exception) { <END> request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Error occured while displaying template => " + exception.getMessage()); return new ModelAndView("/module/radiology/radiologyDashboardForm"); } return modelAndView; }</code><technical_language>@ivange94 I dont catch that. need this mrrtReportTemplate = mrrtReportTemplateService.getMrrtReportTemplateByUuid(templateId); add this try block java mrrtReportTemplate = mrrtReportTemplateService.getMrrtReportTemplateByUuid(templateId); if (mrrtReportTemplate == null) { throw new IllegalArgumentException("MrrtReportTemplate found. templateId '" + templateId + "' unknown."); } mask actual problem</technical_language>

Target:
public ModelAndView displayMrrtReportTemplate(HttpServletRequest request, @RequestParam String templateId) { final ModelAndView modelAndView = new ModelAndView(MRRT_REPORT_TEMPLATE_FORM_VIEW); MrrtReportTemplate mrrtReportTemplate = mrrtReportTemplateService.getMrrtReportTemplateByUuid(templateId); if (mrrtReportTemplate == null) { throw new IllegalArgumentException("MrrtReportTemplate not found. templateId '" + templateId + "' unknown."); } try { String templateBody = mrrtReportTemplateService.getMrrtReportTemplateHtmlBody(mrrtReportTemplate); modelAndView.addObject("templateBody", templateBody); modelAndView.addObject("template", mrrtReportTemplate); } catch (IOException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Error occured while dispaying template => " + exception.getMessage()); return new ModelAndView("/module/radiology/radiologyDashboardForm"); } return modelAndView; }
Source:
<code>public void clearForce(MonitoringBaseElement element) throws DeploymentException { String request = <START> MessageFormat.format(FORECE_VALUE, <END> this.id++, "*", element.getQualifiedString(), "false"); try { sendREQ(element.getResourceString(), request); } catch (IOException e) { throw new DeploymentException(MessageFormat.format(Messages.DeploymentExecutor_ClearForceFailed, element.getQualifiedString()), e); } }</code><technical_language>typo</technical_language>

Target:
public void clearForce(MonitoringBaseElement element) throws DeploymentException { String request = MessageFormat.format(FORCE_VALUE, this.id++, "*", element.getQualifiedString(), "false"); try { sendREQ(element.getResourceString(), request); } catch (IOException e) { throw new DeploymentException(MessageFormat.format(Messages.DeploymentExecutor_ClearForceFailed, element.getQualifiedString()), e); } }
Source:
<code>public void setConfigData(ConfigData config) { this.cageWidth = config.getCageWidth(); this.cageHeight = config.getCageHeight(); this.zoneVisits = new HashMap<Zone, Integer>(config.getZones().size()); <START> for (Zone z : config.getZones()) zoneVisits.put(z, 0); <END> }</code><technical_language>Please { ... } - this increases code readability</technical_language>

Target:
public void setConfigData(ConfigData config) { this.cageWidth = config.getCageWidth(); this.cageHeight = config.getCageHeight(); this.zoneVisits = new HashMap<Zone, Integer>(config.getZones().size()); for (Zone z : config.getZones()) { zoneVisits.put(z, 0); } }
Source:
<code><START> private List<CascadingTypeParameter> getCascadingTypeParameters(TypeVariable<?>[] typeParameters, AnnotatedType annotatedType) { <END> List<CascadingTypeParameter> cascadingTypeParameters = new ArrayList<>(); if ( annotatedType instanceof AnnotatedArrayType ) { AnnotatedArrayType annotatedArrayType = (AnnotatedArrayType) annotatedType; Type validatedType = annotatedArrayType.getAnnotatedGenericComponentType().getType(); List<CascadingTypeParameter> nestedCascadingTypeParameters; if ( validatedType instanceof ParameterizedType ) { nestedCascadingTypeParameters = getCascadingTypeParameters( ReflectionHelper.getClassFromType( validatedType ).getTypeParameters(), annotatedArrayType.getAnnotatedGenericComponentType() ); } else { nestedCascadingTypeParameters = Collections.emptyList(); } boolean isCascading = annotatedArrayType.isAnnotationPresent( Valid.class ); CascadingTypeParameter cascadingTypeParameter = new CascadingTypeParameter( validatedType, ArrayElement.INSTANCE, isCascading, nestedCascadingTypeParameters ); if ( isCascading || !nestedCascadingTypeParameters.isEmpty() ) { cascadingTypeParameters.add( cascadingTypeParameter ); } } else if ( annotatedType instanceof AnnotatedParameterizedType ) { AnnotatedParameterizedType annotatedParameterizedType = (AnnotatedParameterizedType) annotatedType; AnnotatedType[] annotatedTypeArguments = annotatedParameterizedType.getAnnotatedActualTypeArguments(); int i = 0; for ( AnnotatedType annotatedTypeArgument : annotatedTypeArguments ) { Type validatedType = annotatedTypeArgument.getType(); List<CascadingTypeParameter> nestedCascadingTypeParameters; if ( validatedType instanceof ParameterizedType ) { nestedCascadingTypeParameters = getCascadingTypeParameters( ReflectionHelper.getClassFromType( validatedType ).getTypeParameters(), annotatedTypeArgument ); } else { nestedCascadingTypeParameters = Collections.emptyList(); } boolean isCascading = annotatedTypeArgument.isAnnotationPresent( Valid.class ); if ( isCascading || !nestedCascadingTypeParameters.isEmpty() ) { CascadingTypeParameter cascadingTypeParameter = new CascadingTypeParameter( annotatedType.getType(), typeParameters[i], isCascading, nestedCascadingTypeParameters ); cascadingTypeParameters.add( cascadingTypeParameter ); } i++; } } return cascadingTypeParameters; }</code><technical_language>method long. cases handles good candidates for extracting methods</technical_language>

Target:
private List<CascadingTypeParameter> getCascadingTypeParameters(TypeVariable<?>[] typeParameters, AnnotatedType annotatedType) { List<CascadingTypeParameter> cascadingTypeParameters = new ArrayList<>(); if ( annotatedType instanceof AnnotatedArrayType ) { addCascadingTypeParametersForArrayType( cascadingTypeParameters, (AnnotatedArrayType) annotatedType ); } else if ( annotatedType instanceof AnnotatedParameterizedType ) { addCascadingTypeParametersForParameterizedType( cascadingTypeParameters, (AnnotatedParameterizedType) annotatedType, typeParameters ); } return cascadingTypeParameters; }
Source:
<code>private void drawCurvedUnderline(LineInfo line, LineStringCursor cursor, double startOrdinate, boolean drawingHalo) { LineComponent component = line.getComponents().get(0); LineMetrics metrics = computeLineMetricsIfNeeded(component); double endOrdinate = cursor.getCurrentOrdinate(); GlyphVector glyphVector = line.getComponents().get(0).getGlyphVector(); double advance = glyphVector.getGlyphMetrics(0).getAdvance() * 0.5f; LineString labelLineString = cursor.getSubLineString(startOrdinate - advance, endOrdinate - advance); LiteShape underlineLineString = computeCurvedUnderline(labelLineString, metrics); if (drawingHalo) { <START> graphics.draw(underlineLineString); <END> } else { Stroke oldStroke = graphics.getStroke(); try { graphics.setStroke(new BasicStroke(metrics.getUnderlineThickness() * 2)); graphics.draw(underlineLineString); } finally { graphics.setStroke(oldStroke); } } }</code><technical_language>guarantees (here in other equivalent method for straight line) current stroke is right color thickness</technical_language>

Target:
private void drawCurvedUnderline(LineInfo line, LineStringCursor cursor, double startOrdinate, boolean drawingHalo) { LineComponent component = line.getComponents().get(0); LineMetrics metrics = computeLineMetricsIfNeeded(component); double endOrdinate = cursor.getCurrentOrdinate(); GlyphVector glyphVector = line.getComponents().get(0).getGlyphVector(); double advance = glyphVector.getGlyphMetrics(0).getAdvance() * 0.5f; LineString labelLineString = cursor.getSubLineString(startOrdinate - advance, endOrdinate - advance); LiteShape underlineLineString = computeCurvedUnderline(labelLineString, metrics); if (drawingHalo) { graphics.draw(underlineLineString); } else { Stroke oldStroke = graphics.getStroke(); try { graphics.setStroke(new BasicStroke(metrics.getUnderlineThickness())); graphics.draw(underlineLineString); } finally { graphics.setStroke(oldStroke); } } }
Source:
<code>public void testValidate() { IntegerRangeValidator validator = new IntegerRangeValidator(); <START> when(integerRange.min()).thenReturn(1); <END> when(integerRange.max()).thenReturn(15); validator.initialize(integerRange); assertTrue(validator.isValid("12", null)); }</code><technical_language>create method integerRange(int min, int max) create range pollute test unnecessary code</technical_language>

Target:
public void testValidate() { IntegerRangeValidator validator = new IntegerRangeValidator(); int min = integer(DEFAULT_MIN, 0); int max = integer(0, DEFAULT_MAX); integerRange(min, max); validator.initialize(integerRange); assertTrue(validator.isValid(integer(min, max) + "", null)); }
Source:
<code>public void testCaptcha() { PageTitle title = new PageTitle(null, "Test_page_for_app_testing/Captcha", TEST_WIKI_SITE); String wikitext = "== Section 2 ==\n\nEditing by inserting an external link https://" + System.currentTimeMillis(); service.edit(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new Edit.Callback() { @Override public void success(@NonNull EditingResult result) { <START> validateCaptcha(result); <END> } @Override public void failure(@NonNull Throwable caught) { throw new RuntimeException(caught); } }); }</code><technical_language>latch</technical_language>

Target:
public void testCaptcha() { PageTitle title = new PageTitle(null, "Test_page_for_app_testing/Captcha", TEST_WIKI_SITE); String wikitext = "== Section 2 ==\n\nEditing by inserting an external link https://" + System.currentTimeMillis(); final TestLatch latch = new TestLatch(); client.request(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new EditClient.Callback() { @Override public void success(@NonNull Call<Edit> call, @NonNull EditingResult result) { validateCaptcha(result); latch.countDown(); } @Override public void failure(@NonNull Call<Edit> call, @NonNull Throwable caught) { throw new RuntimeException(caught); } }); latch.await(); }
Source:
<code>public String toString() { StringBuilder r = new StringBuilder(); r.append(getClass().getSimpleName()); r.append('['); for (int i = 0; i < commands.size(); i++) { ReceiveCommand cmd = commands.get(i); if (i != 0) { <START> r.append(", "); END> } r.append(cmd); r.append(" ("); r.append(cmd.getResult()); r.append(')'); } r.append(']'); return r.toString(); }</code><technical_language>A batch large command toString is long due 2 SHA-1s a ref name. more sense format LFs: r.append(getClass().getSimpleName()).append('['); if (commands.isEmpty()) return r.append(']').toString(); for (ReceiveCommand cmd : commands) { r.append(" "); // $NON-NLS-1$ r.append(cmd); r.append(" (").append(cmd.getResult()).append(")\n"); } return r.append(']').toString();</technical_language>

Target:
public String toString() { StringBuilder r = new StringBuilder(); r.append(getClass().getSimpleName()).append('['); if (commands.isEmpty()) return r.append(']').toString(); r.append('\n'); for (ReceiveCommand cmd : commands) { r.append(" "); r.append(cmd); r.append(" (").append(cmd.getResult()).append(")\n"); } return r.append(']').toString(); }
Source:
<code>public void githubProfileScraperUserTest() { GithubProfileScraper githubScraper = new GithubProfileScraper(); String url = "<LINK_1>"; BufferedReader br = null; githubScraper.termsList = new ArrayList<String>(); githubScraper.termsList.add("all"); try { ClientConnection connection = new ClientConnection(url); br = githubScraper.getHtml(connection); String profile = "djmgit"; String userName = "djmgit"; String fullName = "Deepjyoti Mondal"; String specialLink = "<LINK_0>"; String userId = "16368427"; Post fetchedProfile = githubScraper.scrapeGithub(profile, br); assertEquals(fetchedProfile.getString("user_name"), userName); assertEquals(fetchedProfile.getString("full_name"), fullName); assertEquals(fetchedProfile.getString("special_link"), specialLink); assertEquals(fetchedProfile.getString("user_id"), userId); <START> } catch (IOException e) { <END> DAO.log("GithubProfileScraperTest.githubProfileScraperUserTest() failed to connect to network. url:" + url); } }</code><technical_language>test pass in case of IOException. Is this desirable</technical_language>

Target:
public void githubProfileScraperUserTest() { GithubProfileScraper githubScraper = new GithubProfileScraper(); String url = "<LINK_1>"; BufferedReader br = null; githubScraper.termsList = new ArrayList<String>(); githubScraper.termsList.add("all"); String profile = "djmgit"; String userName = "djmgit"; String fullName = "Deepjyoti Mondal"; String specialLink = "<LINK_0>"; String userId = "16368427"; try { ClientConnection connection = new ClientConnection(url); br = githubScraper.getHtml(connection); } catch (IOException e) { DAO.log("GithubProfileScraperTest.githubProfileScraperUserTest() failed to connect to network. url:" + url); } Post fetchedProfile = githubScraper.scrapeGithub(profile, br); assertEquals(fetchedProfile.getString("user_name"), userName); assertEquals(fetchedProfile.getString("full_name"), fullName); assertEquals(fetchedProfile.getString("special_link"), specialLink); assertEquals(fetchedProfile.getString("user_id"), userId); }