auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (!courseData.getCourse().getCoursewareAccess().hasAccess()) { <START> return; <END> } inflater.inflate(R.menu.course_dashboard_menu, menu); if (environment.getConfig().isCourseSharingEnabled()) { menu.findItem(R.id.menu_item_share).setVisible(true); } else { menu.findItem(R.id.menu_item_share).setVisible(false); } handleDownloadProgressMenuItem(menu); }</code><technical_language>Instead of returning based access, setHasOptionsMenu() dependent like: setHasOptionsMenu(courseData.getCourse().getCoursewareAccess().hasAccess())</technical_language>

Target:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.course_dashboard_menu, menu); if (environment.getConfig().isCourseSharingEnabled()) { menu.findItem(R.id.menu_item_share).setVisible(true); } else { menu.findItem(R.id.menu_item_share).setVisible(false); } handleDownloadProgressMenuItem(menu); }
Source:
<code>private static DetailAST findFirstChildNodeOfType( final DetailAST node, final int type ) { DetailAST result = node.findFirstToken(type); if (result == null) { <START> final DetailAST dot = node.findFirstToken(TokenTypes.DOT); <END> if (dot != null) { result = DiamondOperatorCheck .findFirstChildNodeOfType(dot, type); } } return result; }</code><technical_language>@dskalenko post this tree? nicely visualize in Checkstyle GUI: <LINK_0></technical_language>

Target:
private static DetailAST findFirstChildNodeOfType( final DetailAST node, final int type ) { DetailAST result = node.findFirstToken(type); if (result == null) { final DetailAST child = node.getFirstChild(); if (child != null) { result = DiamondOperatorCheck .findFirstChildNodeOfType(child, type); } } return result; }
Source:
<code>protected Supplier<String> internalGetAttribute(String attr) { Widget widget = getWidget(); switch(attr){ case "style": return () -> swtStyles != null ? swtStyles : ""; case "class": return () -> Objects.toString(getCSSClass(widget), ""); <START> case "swt-lines-visible": <END> if (widget instanceof Table) { return () -> String.valueOf(((Table) widget).getLinesVisible()); } if (widget instanceof Tree) { return () -> String.valueOf(((Tree) widget).getLinesVisible()); } case "swt-data-class": return () -> { Object data = widget.getData(); if (data == null) { return ""; } StringBuilder sb = new StringBuilder(); for (Class<?> clazz = data.getClass(); clazz != Object.class; sb.append(' ')) { sb.append(clazz.getName()); clazz = clazz.getSuperclass(); } return sb.toString(); }; default: Object o = widget.getData(attr.toLowerCase()); if (o != null) { return () -> o.toString(); } } return null; }</code><technical_language>i agree</technical_language>

Target:
protected Supplier<String> internalGetAttribute(String attr) { Widget widget = getWidget(); switch(attr){ case "style": return () -> swtStyles != null ? swtStyles : ""; case "class": return () -> Objects.toString(getCSSClass(widget), ""); case "swt-data-class": return () -> { Object data = widget.getData(); if (data == null) { return ""; } StringBuilder sb = new StringBuilder(); for (Class<?> clazz = data.getClass(); clazz != Object.class; sb.append(' ')) { sb.append(clazz.getName()); clazz = clazz.getSuperclass(); } return sb.toString(); }; default: Object o = widget.getData(attr.toLowerCase()); if (o != null) { return () -> o.toString(); } } return null; }
Source:
<code>public void shutdown() { isShutdown = true; <START> getTableRegistry().shutdown(); <END> garbageCollector.stop(); runtimeExecutor.shutdownNow(); if (layout != null) { try { layout.cancel(true); } catch (Exception e) { log.error("Runtime shutting down. Exception in terminating fetchLayout: {}", e); } } stop(true); if (parameters.shutdownNettyEventLoop) { nettyEventLoop.shutdownGracefully(); } }</code><technical_language>getTableRegistry() is lazily evaluated, if runtime CorfuStore, taleRegistry created, shutting down, calling this create a new tableRegistry is trival (tableRegistry constructor do io register itself). I this needs care of</technical_language>

Target:
public void shutdown() { isShutdown = true; TableRegistry tableRegistryObj = tableRegistry.get(); if (tableRegistryObj != null) { tableRegistryObj.shutdown(); } garbageCollector.stop(); runtimeExecutor.shutdownNow(); if (layout != null) { try { layout.cancel(true); } catch (Exception e) { log.error("Runtime shutting down. Exception in terminating fetchLayout: {}", e); } } stop(true); if (parameters.shutdownNettyEventLoop) { nettyEventLoop.shutdownGracefully(); } }
Source:
<code>public void commit(Xid xid, boolean onePhase) throws XAException { if (LOG.isTraceEnabled()) { <START> LOG.trace("DummyXAResource.commit(xid=" + xid + ", onePhase=" + onePhase + ")"); <END> } counter.incrementAndGet(); }</code><technical_language>info</technical_language>

Target:
public void commit(Xid xid, boolean onePhase) throws XAException { LOG.info("DummyXAResource.commit(xid=" + xid + ", onePhase=" + onePhase + ")"); counter.incrementAndGet(); }
Source:
<code>public void testBindString() { final String drl = "import org.drools.compiler.oopath.*;\n" + <START> "global java.util.List list\n" + <END> "\n" + "rule R when\n" + " Adult( $name: /name )\n" + "then\n" + " list.add( $name );\n" + "end\n"; testScenarioBindString(drl, "Bob", "Alice"); }</code><technical_language>Do want DRL (or multi-line Strings in general) indented this way? I strongly it, thinking setting common practice</technical_language>

Target:
public void testBindString() { final String drl = "import org.drools.compiler.oopath.model.*;\n" + "global java.util.List list\n" + "\n" + "rule R when\n" + " Adult( $name: /name )\n" + "then\n" + " list.add( $name );\n" + "end\n"; testScenarioBindString(drl, "Bob", "Alice"); }
Source:
<code><START> public String getMessage() { <END> return message; }</code><technical_language>of accessors final</technical_language>

Target:
public final String getMessage() { return message; }
Source:
<code>public static ResultSet executeQuery(Connection conn, QueryBuilder queryBuilder, String url, Configuration config) throws SQLException { <START> SQLContext sqlContext = new SQLContext(SparkUtil.getSparkContext()); <END> boolean forceRowKeyOrder = conn.unwrap(PhoenixConnection.class).getQueryServices().getProps() .getBoolean(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, false); if (forceRowKeyOrder && (queryBuilder.getOrderByClause()==null || queryBuilder.getOrderByClause().isEmpty())) { queryBuilder.setOrderByClause(Joiner.on(", ").join(queryBuilder.getRequiredColumns())); } Dataset phoenixDataSet = new PhoenixRDD(SparkUtil.getSparkContext(), queryBuilder.getFullTableName(), JavaConverters.collectionAsScalaIterableConverter(queryBuilder.getRequiredColumns()).asScala() .toSeq(), Option.apply((String) null), Option.apply(url), config, false, null).toDataFrame(sqlContext); phoenixDataSet.registerTempTable(queryBuilder.getFullTableName()); Dataset<Row> dataset = sqlContext.sql(queryBuilder.build()); SparkPlan plan = dataset.queryExecution().executedPlan(); Log.debug("Spark plan : "+plan.toString()); List<Row> rows = dataset.collectAsList(); ResultSet rs = new SparkResultSet(rows, dataset.columns()); return rs; }</code><technical_language>SQLContext is [deprecated](<LINK_0> Quoting: _Deprecated. SparkSession.builder instead. 2.0.0._</technical_language>

Target:
public static ResultSet executeQuery(Connection conn, QueryBuilder queryBuilder, String url, Configuration config) throws SQLException { SQLContext sqlContext = SparkUtil.getSqlContext(); boolean forceRowKeyOrder = conn.unwrap(PhoenixConnection.class).getQueryServices().getProps() .getBoolean(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, false); String prevOrderBy = queryBuilder.getOrderByClause(); if (forceRowKeyOrder && (queryBuilder.getOrderByClause()==null || queryBuilder.getOrderByClause().isEmpty())) { queryBuilder.setOrderByClause(Joiner.on(", ").join(queryBuilder.getRequiredColumns())); } Dataset phoenixDataSet = new PhoenixRDD(SparkUtil.getSparkContext(), queryBuilder.getFullTableName(), JavaConverters.collectionAsScalaIterableConverter(queryBuilder.getRequiredColumns()).asScala() .toSeq(), Option.apply((String) null), Option.apply(url), config, false, null).toDataFrame(sqlContext); phoenixDataSet.registerTempTable(queryBuilder.getFullTableName()); Dataset<Row> dataset = sqlContext.sql(queryBuilder.build()); SparkPlan plan = dataset.queryExecution().executedPlan(); Log.debug("Spark plan : "+plan.toString()); List<Row> rows = dataset.collectAsList(); queryBuilder.setOrderByClause(prevOrderBy); ResultSet rs = new SparkResultSet(rows, dataset.columns()); return rs; }
Source:
<code>public void saveRadiologyReport_shouldSaveRadiologyReportInDatabaseAndReturnIt() throws Exception { RadiologyReport existingRadiologyReport = radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID); existingRadiologyReport.setRadiologyReportStatus(RadiologyReportStatus.CLAIMED); existingRadiologyReport.setText("test - text"); RadiologyReport updatedReport = radiologyService.saveRadiologyReport(existingRadiologyReport); assertNotNull(updatedReport); <START> assertThat(updatedReport.getId(), is(EXISTING_RADIOLOGY_REPORT_ID)); <END> }</code><technical_language>assert changed. text</technical_language>

Target:
public void saveRadiologyReport_shouldSaveRadiologyReportInDatabaseAndReturnIt() throws Exception { RadiologyReport existingRadiologyReport = radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID); existingRadiologyReport.setReportStatus(RadiologyReportStatus.CLAIMED); existingRadiologyReport.setReportBody("test - text"); assertNotNull(radiologyService.saveRadiologyReport(existingRadiologyReport)); assertThat(radiologyService.saveRadiologyReport(existingRadiologyReport).getId(), is(EXISTING_RADIOLOGY_REPORT_ID)); assertThat(radiologyService.saveRadiologyReport(existingRadiologyReport).getReportBody(), is("test - text")); }
Source:
<code>public void addService(String basePath, Object service) { services.put(basePath, service); metadata.addMicroserviceMetadata(service, basePath); if (log.isDebugEnabled()) { <START> log.debug("Added microservice: " + service); <END> } }</code><technical_language>need check log.isDebugEnabled() here. SLF4J internally checks that. lets parameterized log message log.debug("Added microservice {}.", service); refer: <LINK_0></technical_language>

Target:
public void addService(String basePath, Object service) { services.put(basePath, service); metadata.addMicroserviceMetadata(service, basePath); log.debug("Added microservice: {}.", service); }
Source:
<code><START> public void usingUserWithViewRolesWithOauth() throws Exception { <END> final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); TestPropertyValues.of( "spring.cloud.dataflow.client.server-uri=" + "http://localhost:" + localDataflowResource.getDataflowPort(), "spring.cloud.dataflow.client.authentication.client-id=myclient", "spring.cloud.dataflow.client.authentication.client-secret=mysecret", "spring.cloud.dataflow.client.authentication.token-uri=" + "http://localhost:" + oAuth2ServerResource.getOauth2ServerPort() + "/oauth/token", "spring.cloud.dataflow.client.authentication.scope=dataflow.view").applyTo(context); context.register(TestApplication2.class); context.refresh(); final DataFlowOperations dataFlowOperations = context.getBean(DataFlowOperations.class); final AboutResource about = dataFlowOperations.aboutOperation().get(); assertNotNull(about); assertEquals("myclient", about.getSecurityInfo().getUsername()); assertEquals(1, about.getSecurityInfo().getRoles().size()); context.close(); }</code><technical_language>throws Exception is needed</technical_language>

Target:
public void usingUserWithViewRolesWithOauth() { context = new AnnotationConfigApplicationContext(); TestPropertyValues.of( "spring.cloud.dataflow.client.server-uri=" + "http://localhost:" + localDataflowResource.getDataflowPort(), "spring.cloud.dataflow.client.authentication.client-id=myclient", "spring.cloud.dataflow.client.authentication.client-secret=mysecret", "spring.cloud.dataflow.client.authentication.token-uri=" + "http://localhost:" + oAuth2ServerResource.getOauth2ServerPort() + "/oauth/token", "spring.cloud.dataflow.client.authentication.scope=dataflow.view").applyTo(context); context.register(TestApplication2.class); context.refresh(); final DataFlowOperations dataFlowOperations = context.getBean(DataFlowOperations.class); final AboutResource about = dataFlowOperations.aboutOperation().get(); assertNotNull(about); assertEquals("myclient", about.getSecurityInfo().getUsername()); assertEquals(1, about.getSecurityInfo().getRoles().size()); }
Source:
<code>public void setWordWrap(boolean newWordWrapStatus) { <START> if (!isWordWrapSupported() || newWordWrapStatus == fIsWordWrapActivated) <END> return; fIsWordWrapActivated = newWordWrapStatus; ISourceViewer viewer= getSourceViewer(); if (viewer != null && !isBlockSelectionModeEnabled()) { StyledText styledText= viewer.getTextWidget(); if (styledText != null) { styledText.setWordWrap(newWordWrapStatus); } } if (fVerticalRuler != null) { fVerticalRuler.update(); } }</code><technical_language>please exchange sides avoid calling client code if needed</technical_language>

Target:
public void setWordWrap(boolean newWordWrapStatus) { if (newWordWrapStatus == fIsWordWrapEnabled || !isWordWrapSupported()) return; fIsWordWrapEnabled = newWordWrapStatus; ISourceViewer viewer= getSourceViewer(); if (viewer != null && !isBlockSelectionModeEnabled()) { StyledText styledText= viewer.getTextWidget(); if (styledText != null) { styledText.setWordWrap(newWordWrapStatus); } } }
Source:
<code>public void launchJob(AnalysisJob analysisJob) { final String datastoreName = analysisJob.getDatastore().getName(); final Datastore datastore = _dataCleanerConfiguration.getDatastoreCatalog().getDatastore(datastoreName); if (datastore == null) { throw new IllegalStateException("Datastore referred by the job (" + datastoreName + ") has not been found in the specified DataCleanerConfiguration"); } else { JavaSparkContext sc = null; try { DataContext dataContext = datastore.openConnection().getDataContext(); if (dataContext instanceof CsvDataContext) { CsvDataContext csvDataContext = (CsvDataContext) dataContext; String datastoreFilePath = csvDataContext.getResource().getQualifiedPath(); <START> SparkConf conf = new SparkConf().setAppName("DataCleaner-spark").setMaster("yarn-client"); <END> sc = new JavaSparkContext(conf); JavaRDD<String> instructionsRDD = sc.textFile(datastoreFilePath); long lineCount = instructionsRDD.count(); logger.info("Line count: " + lineCount); } } finally { if (sc != null) { sc.stop(); } } } }</code><technical_language>I recommended set master this. externally launcher</technical_language>

Target:
public void launchJob(AnalysisJob analysisJob) { final String datastoreName = analysisJob.getDatastore().getName(); final Datastore datastore = _dataCleanerConfiguration.getDatastoreCatalog().getDatastore(datastoreName); if (datastore == null) { throw new IllegalStateException("Datastore referred by the job (" + datastoreName + ") has not been found in the specified DataCleanerConfiguration"); } else { JavaSparkContext sc = null; try { DataContext dataContext = datastore.openConnection().getDataContext(); if (dataContext instanceof CsvDataContext) { CsvDataContext csvDataContext = (CsvDataContext) dataContext; String datastoreFilePath = csvDataContext.getResource().getQualifiedPath(); SparkConf conf = new SparkConf().setAppName("DataCleaner-spark"); sc = new JavaSparkContext(conf); JavaRDD<String> instructionsRDD = sc.textFile(datastoreFilePath); long lineCount = instructionsRDD.count(); logger.info("Line count: " + lineCount); } } finally { if (sc != null) { sc.stop(); } } } }
Source:
<code>public NodeValue getAccValue() { double median; if ( count == 0 ) return noValuesToMedian ; if ( super.errorCount != 0 ) return null ; int indexsize = collection.size(); double[] arrDouble = new double[indexsize]; for(int i=0; i<indexsize; i++){ arrDouble[i] = collection.get(i).getDouble(); } Arrays.sort(arrDouble); if(indexsize%2!=0) { median = arrDouble[(indexsize/2)]; }else { <START> median = ((arrDouble[(indexsize/2)]+arrDouble[((indexsize/2)-1)])/2); <END> } return (NodeValue.makeDecimal((median))); }</code><technical_language>Extra ()</technical_language>

Target:
public NodeValue getAccValue() { double median; if ( count == 0 ) return noValuesToMedian ; if ( super.errorCount != 0 ) return null ; int indexsize = collection.size(); double[] arrDouble = new double[indexsize]; for(int i=0; i<indexsize; i++){ arrDouble[i] = collection.get(i).getDouble(); } Arrays.sort(arrDouble); if(indexsize%2!=0) { median = arrDouble[(indexsize/2)]; }else { median = ((arrDouble[(indexsize/2)]+arrDouble[((indexsize/2)-1)])/2); } return NodeValue.makeDecimal(median); }
Source:
<code>private void populateDefaultsForAllOrders(Order order) { Provider orderer = order.getOrderer(); if (orderer == null) { order.setOrderer(getProvider()); } User creator = Utils.getUserFromProvider(orderer); order.setEncounter(createEncounter(order.getPatient(), creator, new Date())); <START> order.setCreator(creator); <END> }</code><technical_language>I this is unrelated. in another PR</technical_language>

Target:
private void populateDefaultsForAllOrders(Order order) { Provider orderer = order.getOrderer(); if (orderer == null) { order.setOrderer(getProvider()); } User creator = Utils.getUserFromProvider(orderer); order.setEncounter(createEncounter(order.getPatient(), creator, new Date())); }
Source:
<code>@Override public String getMessage() { <START> return String.format("Trip Ids %s & %s (route %s) are duplicates (%s)", duplicateTripId, affectedEntityId, routeId, tripKey); <END> }</code><technical_language>sense human-readable name of pattern here, trip key</technical_language>

Target:
@Override public String getMessage() { return String.format("Trip Ids %s & %s (route %s) are duplicates (pattern: %s, calendar: %s, from %s to %s)", duplicateTripId, affectedEntityId, routeId, patternName, serviceId, firstDeparture, lastArrival); }
Source:
<code>void takePictureInternal(final ReadableMap options) { if (!mIsRecording.get() && isPictureCaptureInProgress.compareAndSet(false, true)) { try{ if (options.hasKey("orientation") && options.getInt("orientation") != Constants.ORIENTATION_AUTO) { mOrientation = options.getInt("orientation"); int rotation = orientationEnumToRotation(mOrientation); mCameraParameters.setRotation(calcCameraRotation(rotation)); try{ mCamera.setParameters(mCameraParameters); } catch(RuntimeException e ) { Log.e("CAMERA_1::", "setParameters failed", e); } } mCamera.takePicture(null, null, null, new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { if (options.hasKey("pauseAfterCapture") && !options.getBoolean("pauseAfterCapture")) { camera.startPreview(); mIsPreviewActive = true; if (mIsScanning) { camera.setPreviewCallback(Camera1.this); } } else { camera.stopPreview(); mIsPreviewActive = false; camera.setPreviewCallback(null); } isPictureCaptureInProgress.set(false); mOrientation = Constants.ORIENTATION_AUTO; <START> mCallback.onPictureTaken(data, displayOrientationToOrientationEnum(mDeviceOrientation), 0); <END> if(mustUpdateSurface){ updateSurface(); } } }); } catch(Exception e){ isPictureCaptureInProgress.set(false); throw e; } } else{ throw new IllegalStateException("Camera capture failed. Camera is already capturing."); } }</code><technical_language>Camera1 implementation orientation value? hard-coded 0? I Camera1 getCameraOrientation get currently selected camera orientation</technical_language>

Target:
void takePictureInternal(final ReadableMap options) { if (!mIsRecording.get() && isPictureCaptureInProgress.compareAndSet(false, true)) { try{ if (options.hasKey("orientation") && options.getInt("orientation") != Constants.ORIENTATION_AUTO) { mOrientation = options.getInt("orientation"); int rotation = orientationEnumToRotation(mOrientation); mCameraParameters.setRotation(calcCameraRotation(rotation)); try{ mCamera.setParameters(mCameraParameters); } catch(RuntimeException e ) { Log.e("CAMERA_1::", "setParameters failed", e); } } mCamera.takePicture(null, null, null, new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { if (options.hasKey("pauseAfterCapture") && !options.getBoolean("pauseAfterCapture")) { camera.startPreview(); mIsPreviewActive = true; if (mIsScanning) { camera.setPreviewCallback(Camera1.this); } } else { camera.stopPreview(); mIsPreviewActive = false; camera.setPreviewCallback(null); } isPictureCaptureInProgress.set(false); mOrientation = Constants.ORIENTATION_AUTO; mCallback.onPictureTaken(data, displayOrientationToOrientationEnum(mDeviceOrientation), getCameraOrientation()); if(mustUpdateSurface){ updateSurface(); } } }); } catch(Exception e){ isPictureCaptureInProgress.set(false); throw e; } } else{ throw new IllegalStateException("Camera capture failed. Camera is already capturing."); } }
Source:
<code><START> public static int writeUnsignedInt(byte[] bytes, int offset, int i) { <END> int localOffset = offset; while ((i & ~0x7F) != 0) { bytes[localOffset++] = (byte) ((i & 0x7f) | 0x80); i >>>= 7; } bytes[localOffset] = (byte) i; return localOffset + 1; }</code><technical_language>+1: I surprised this I if returning size better, WDYT</technical_language>

Target:
public static int writeUnsignedInt(byte[] bytes, int offset, int i) { int localOffset = offset; while ((i & ~0x7F) != 0) { bytes[localOffset++] = (byte) ((i & 0x7f) | 0x80); i >>>= 7; } bytes[localOffset++] = (byte) i; return localOffset - offset; }
Source:
<code>public Transport getTransport(Set<SocketAddress> failedServers, byte[] cacheName) { SocketAddress server; synchronized (lock) { <START> FailoverRequestBalancingStrategy balancer = balancers.get(cacheName); <END> if (balancer == null) balancer = addBalancer(cacheName); server = balancer.nextServer(failedServers); } return borrowTransportFromPool(server); }</code><technical_language>I this code duplicated 3 times... create a getOrCreateIfAbsentBalancer(byte[] cacheName) remove duplication</technical_language>

Target:
public Transport getTransport(Set<SocketAddress> failedServers, byte[] cacheName) { SocketAddress server; synchronized (lock) { server = getNextServer(failedServers, cacheName); } return borrowTransportFromPool(server); }
Source:
<code>private View createCheckableAction(CarMenuItem item) { <START> Context context = getContext(); <END> ViewGroup checkableAction = (ViewGroup) LayoutInflater.from(context) .inflate(R.layout.checkable_action_item, this, false); Switch switchWidget = checkableAction.findViewById(R.id.switch_widget); switchWidget.setEnabled(item.isEnabled()); switchWidget.setChecked(item.isChecked()); switchWidget.setScaleX(mSwitchScale); switchWidget.setScaleY(mSwitchScale); checkableAction.setOnClickListener(b -> { if (!item.isEnabled()) { return; } switchWidget.toggle(); item.setChecked(switchWidget.isChecked()); CarMenuItem.OnClickListener itemOnClickListener = item.getOnClickListener(); if (itemOnClickListener != null) { itemOnClickListener.onClick(item); } }); CharSequence title = item.getTitle(); if (!(title == null || TextUtils.isEmpty(title))) { Button button = new Button(context, null, 0, item.getStyleResId()); button.setText(title); button.setBackgroundResource(0); checkableAction.addView(button); } return checkableAction; }</code><technical_language>Inline this call once</technical_language>

Target:
private View createCheckableAction(CarMenuItem item) { Context context = getContext(); ViewGroup checkableAction = (ViewGroup) LayoutInflater.from(context) .inflate(R.layout.checkable_action_item, this, false); Switch switchWidget = checkableAction.findViewById(R.id.switch_widget); switchWidget.setEnabled(item.isEnabled()); switchWidget.setChecked(item.isChecked()); if (item.isEnabled()) { checkableAction.setOnClickListener(v -> { switchWidget.toggle(); item.setChecked(switchWidget.isChecked()); CarMenuItem.OnClickListener itemOnClickListener = item.getOnClickListener(); if (itemOnClickListener != null) { itemOnClickListener.onClick(item); } }); } else { checkableAction.setClickable(false); } CharSequence title = item.getTitle(); if (!TextUtils.isEmpty(title)) { Button button = new Button(context, null, 0, item.getStyleResId()); button.setText(title); checkableAction.addView(button); } return checkableAction; }
Source:
<code>private Map.Entry<String, Object> downloadSingleFile(String path) throws DropboxException { try { OutputStreamBuilder target = OutputStreamBuilder.withExchange(exchange); DbxEntry.File downloadedFile = client.getFile(path, null, target); if (downloadedFile != null) { <START> LOG.info("downloaded path:" + path); <END> return new AbstractMap.SimpleEntry<>(path, target.build()); } else { return null; } } catch (DbxException e) { throw new DropboxException(path + " does not exist or can't obtain metadata"); } catch (IOException e) { throw new DropboxException(path + " can't obtain a stream"); } }</code><technical_language>Debug level</technical_language>

Target:
private Map.Entry<String, Object> downloadSingleFile(String path) throws DropboxException { try { OutputStreamBuilder target = OutputStreamBuilder.withExchange(exchange); DbxEntry.File downloadedFile = client.getFile(path, null, target); if (downloadedFile != null) { LOG.debug("downloaded path={}", path); return new AbstractMap.SimpleEntry<>(path, target.build()); } else { return null; } } catch (DbxException e) { throw new DropboxException(path + " does not exist or can't obtain metadata"); } catch (IOException e) { throw new DropboxException(path + " can't obtain a stream"); } }
Source:
<code>protected boolean loadNextFromDisk() { <START> return !fetched && (state == null || state.getAddedProperty( propertyKeyId ) == null); <END> }</code><technical_language>do this in multiple lines</technical_language>

Target:
protected boolean loadNextFromDisk() { if ( fetched ) { return false; } return state == null || state.getAddedProperty( propertyKeyId ) == null; }
Source:
<code>public int compareTo(BaragonRequestKey o) { <START> return updatedAt >= o.updatedAt ? -1 : 1; <END> }</code><technical_language>consider Long.compare() instead</technical_language>

Target:
public int compareTo(BaragonRequestKey o) { return Long.compare(updatedAt, o.updatedAt); }
Source:
<code>private String readLine(boolean trim) throws IOException { boolean done = false; boolean sawCarriage = false; int removalBytes = 0; while (!done) { if (isReadBufferEmpty()) { offset = 0; end = 0; <START> int bytesRead = inputStream.read(buffer, end, Math.min(DEFAULT_READ_COUNT, buffer.length - end)); <END> if (bytesRead < 0) { if (sawCarriage) { done = true; if (trim) { removalBytes = -1; } } else { throw new IOException("Reached the end of the stream"); } } else { end += bytesRead; } } int originalOffset = offset; for (; !done && offset < end; offset++) { if (buffer[offset] == LF || sawCarriage) { int cpLength = offset - originalOffset + 1; if (trim) { int length = 0; if (buffer[offset] == LF) { length ++; if (sawCarriage) { length++; } } else { offset--; length += 2; } cpLength -= length; } if (cpLength > 0) { copyToStrBuffer(buffer, originalOffset, cpLength); } else { removalBytes = cpLength; } done = true; } else { sawCarriage = buffer[offset] == CR; } } if (!done) { copyToStrBuffer(buffer, originalOffset, end - originalOffset); offset = end; } } int strLength = strBufferIndex + removalBytes; strBufferIndex = 0; return new String(strBuffer, 0, strLength, charset); }</code><technical_language>i looked edge cases, buffer.length - end 0? if so, i suspect this throw. is worth wrapping in a Math.max(0, ...)</technical_language>

Target:
private String readLine(boolean trim) throws IOException { boolean done = false; boolean sawCarriage = false; int removalBytes = 0; while (!done) { if (isReadBufferEmpty()) { offset = 0; end = 0; int bytesRead = inputStream.read(buffer, end, Math.min(DEFAULT_READ_COUNT, buffer.length - end)); if (bytesRead < 0) { throw new IOException("Reached the end of the stream"); } else { end += bytesRead; } } int originalOffset = offset; for (; !done && offset < end; offset++) { if (buffer[offset] == LF) { int cpLength = offset - originalOffset + 1; if (trim) { int length = 0; if (buffer[offset] == LF) { length ++; if (sawCarriage) { length++; } } cpLength -= length; } if (cpLength > 0) { copyToStrBuffer(buffer, originalOffset, cpLength); } else { removalBytes = cpLength; } done = true; } else { sawCarriage = buffer[offset] == CR; } } if (!done) { copyToStrBuffer(buffer, originalOffset, end - originalOffset); offset = end; } } int strLength = strBufferIndex + removalBytes; strBufferIndex = 0; return new String(strBuffer, 0, strLength, charset); }
Source:
<code>public RemoteConnector(RemoteSettings settings) { fSettings = settings; <START> new Throwable().printStackTrace(); <END> }</code><technical_language>Please remove</technical_language>

Target:
public RemoteConnector(RemoteSettings settings) { fSettings = settings; }
Source:
<code>public void register() { if (!registered.get() && registered.compareAndSet(false, true)) { DubboShutdownHook dubboShutdownHook = getDubboShutdownHook(); Runtime.getRuntime().addShutdownHook(dubboShutdownHook); dispatch(new DubboShutdownHookRegisteredEvent(dubboShutdownHook)); <START> ShutdownHookCallbacks.INSTANCE.addCallback(() -> { <END> AbstractRegistryFactory.destroyAll(); this.destroyProtocols(); }); } }</code><technical_language>If DubboBootstrap is enabled, register DubboShutdownHook repeatedly call destroy operations</technical_language>

Target:
public void register() { if (!registered.get() && registered.compareAndSet(false, true)) { DubboShutdownHook dubboShutdownHook = getDubboShutdownHook(); Runtime.getRuntime().addShutdownHook(dubboShutdownHook); dispatch(new DubboShutdownHookRegisteredEvent(dubboShutdownHook)); } }
Source:
<code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"- " \"<LINK_0>\">"); email = request.getParameter("email"); password = request.getParameter("password"); BasicUserService basicUserService = new BasicUserService(new DbUserServices()); boolean authenticated = false; try { authenticated = basicUserService.verifyUser(email, password); } catch (PersistanceUserServicesException e) { <START> e.printStackTrace(); <END> } if (authenticated) { out.println("<p>HI</p>"); } else { out.println("<p>Username not found. Do you want to <a href = \"register.html\"> register</a>?</p>"); } }</code><technical_language>need real exception handling here</technical_language>

Target:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"- " \"<LINK_0>\">"); out.println("<head><title>Login Page</title></head><body>"); email = request.getParameter("email"); password = request.getParameter("password"); UserService userService = ServiceFactory.getUserServiceInstance(); boolean authenticated = false; try { authenticated = userService.verifyUser(email, password); } catch (UserServiceException e) { System.err.println("User service error occurred"); e.printStackTrace(); } if (authenticated) { out.println("<p>Welcome to the Diet Tracker App</p><p>Redirecting...</p>"); response.setHeader("Location", "./welcome.jsp"); } else { out.println("<p>Username not found. Do you want to <a href = \"register.html\"> register</a>?</p>"); } out.println("</body></html>"); }
Source:
<code>protected Object openWhenClosed(Object info, boolean forceAdd, IProgressMonitor monitor) throws JavaModelException { JavaModelManager manager = JavaModelManager.getJavaModelManager(); boolean hadTemporaryCache = manager.hasTemporaryCache(); try { HashMap<IJavaElement, Object> newElements = manager.getTemporaryCache(); generateInfos(info, newElements, monitor); if (info == null) { info = newElements.get(this); } if (info == null) { <START> info = <END> manager.getInfo(this); } if (info == null) { Openable openable = (Openable) getOpenable(); if (newElements.containsKey(openable)) { openable.closeBuffer(); } throw newNotPresentException(); } if (!hadTemporaryCache) { info = manager.putInfos(this, info, forceAdd, newElements); } } finally { if (!hadTemporaryCache) { manager.resetTemporaryCache(); } } return info; }</code><technical_language>non-null info return, want call manager.putInfos value</technical_language>

Target:
protected Object openWhenClosed(Object info, boolean forceAdd, IProgressMonitor monitor) throws JavaModelException { JavaModelManager manager = JavaModelManager.getJavaModelManager(); boolean hadTemporaryCache = manager.hasTemporaryCache(); try { HashMap<IJavaElement, Object> newElements = manager.getTemporaryCache(); generateInfos(info, newElements, monitor); if (info == null) { info = newElements.get(this); } if (info == null) { info = manager.getInfo(this); if (info != null) { return info; } } if (info == null) { Openable openable = (Openable) getOpenable(); if (newElements.containsKey(openable)) { openable.closeBuffer(); } throw newNotPresentException(); } if (!hadTemporaryCache) { info = manager.putInfos(this, info, forceAdd, newElements); } } finally { if (!hadTemporaryCache) { manager.resetTemporaryCache(); } } return info; }
Source:
<code>private void notifyThingsAboutBridgeStatusChange(final Bridge bridge, final ThingStatusInfo bridgeStatus) { if (bridgeStatus.getStatus() == ThingStatus.ONLINE || bridgeStatus.getStatus() == ThingStatus.OFFLINE) { for (final Thing child : bridge.getThings()) { ThreadPoolManager.getPool(THING_MANAGER_THREADPOOL_NAME).execute(new Runnable() { @Override public void run() { try { ThingHandler handler = child.getHandler(); if (handler != null && isInitialized(child)) { handler.bridgeStatusChanged(bridgeStatus); } } catch (Exception ex) { logger.error("Exception occured during notification about bridge status change on thing '" <START> + child.getUID() + "': " + ex.getMessage(), ex); <END> } } }); } } }</code><technical_language>wrong commit, touched this line instead of string concatenation</technical_language>

Target:
private void notifyThingsAboutBridgeStatusChange(final Bridge bridge, final ThingStatusInfo bridgeStatus) { if (bridgeStatus.getStatus() == ThingStatus.ONLINE || bridgeStatus.getStatus() == ThingStatus.OFFLINE) { for (final Thing child : bridge.getThings()) { ThreadPoolManager.getPool(THING_MANAGER_THREADPOOL_NAME).execute(new Runnable() { @Override public void run() { try { ThingHandler handler = child.getHandler(); if (handler != null && isInitialized(child)) { handler.bridgeStatusChanged(bridgeStatus); } } catch (Exception e) { logger.error( "Exception occured during notification about bridge status change on thing '{}': {}", child.getUID(), e.getMessage(), e); } } }); } } }
Source:
<code>protected BaseCommand(SelectedOptions selectedOptions) { this.options = selectedOptions; this.paths = selectedOptions.getPaths(); if (options.isQuiet()) { this.printStream = new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { <START> } <END> }); } }</code><technical_language>a setter for printstream. This interesting this shows a design flaw set printstream override quiet option knowing it</technical_language>

Target:
protected BaseCommand(SelectedOptions selectedOptions) { this.options = selectedOptions; this.paths = selectedOptions.getPaths(); if (options.isQuiet()) { this.printStream = new PrintStream(new OutputStream() { @Override public void write(int b) { } }); } }
Source:
<code>public void writeTo(Wrapper<?> identifier, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { Map<String, String> parameters = mediaType.getParameters(); Boolean isStrict = Boolean.parseBoolean(parameters.get("strict")); MarshallingFormat format = MarshallingFormat.fromType(mediaType.toString()); <START> Marshaller marshaller = MarshallerFactory.getMarshaller(format, Thread.currentThread().getContextClassLoader()); <END> if ((isStrict || STRICT_ID_JSON) && MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)) { entityStream.write(marshaller.marshall(identifier).getBytes()); } else { entityStream.write(identifier.getId().toString().getBytes()); } }</code><technical_language>Well, idea :) mix responsibilities this ProcessDefinitionList object. register provider for that, marshal ourselves. I default providers returning response object marshal internal marshaller String. (probably) means JAX-RS leave is. I said, idea code. work for XML approach needs modify Provider for XML well. you</technical_language>

Target:
public void writeTo(Wrapper<?> identifier, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { Map<String, String> parameters = mediaType.getParameters(); Boolean isStrict = Boolean.parseBoolean(parameters.get("strict")); MarshallingFormat format = MarshallingFormat.fromType(mediaType.toString()); Marshaller marshaller = MarshallerFactory.getMarshaller(format, Thread.currentThread().getContextClassLoader()); boolean isJsonFormat = MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType); boolean isXmlFormat = MediaType.APPLICATION_XML_TYPE.isCompatible(mediaType); if ((isStrict || STRICT_ID_FORMAT) && (isJsonFormat || isXmlFormat)) { entityStream.write(marshaller.marshall(identifier).getBytes()); } else { entityStream.write(identifier.getId().toString().getBytes()); } }
Source:
<code>protected ChangeLogSet(Run<?,?> run, RepositoryBrowser<?> browser) { this.run = run; build = run instanceof AbstractBuild ? (AbstractBuild) run : null; this.browser = browser; <START> this.scm = null; <END> }</code><technical_language>this(run, browser, null) avoid code duplication</technical_language>

Target:
protected ChangeLogSet(Run<?,?> run, RepositoryBrowser<?> browser) { this(run, browser, null); }
Source:
<code>public String toString() { return "Offset: " + offset + ", Size: " + getSize() + ", Deleted: " + isFlagSet(Flags.Delete_Index) <START> + ", TTL Updated: " + isFlagSet(Flags.Ttl_Update_Index) + ", Undelete Updated: " + isFlagSet( <END> Flags.Undelete_Index) + ", ExpiresAtMs: " + getExpiresAtMs() + ", Original Message Offset: " + getOriginalMessageOffset() + (formatVersion != PersistentIndex.VERSION_0 ? (", OperationTimeAtSecs " + getOperationTimeInMs() + ", AccountId " + getAccountId() + ", ContainerId " + getContainerId()) : "") + (formatVersion > PersistentIndex.VERSION_2 ? ", Update Version:" + lifeVersion : ""); }</code><technical_language>Undelete Updated -> Undelete</technical_language>

Target:
public String toString() { return "Offset: " + offset + ", Size: " + getSize() + ", Deleted: " + isFlagSet(Flags.Delete_Index) + ", TTL Updated: " + isFlagSet(Flags.Ttl_Update_Index) + ", Undelete: " + isFlagSet( Flags.Undelete_Index) + ", ExpiresAtMs: " + getExpiresAtMs() + ", Original Message Offset: " + getOriginalMessageOffset() + (formatVersion != PersistentIndex.VERSION_0 ? (", OperationTimeAtSecs " + getOperationTimeInMs() + ", AccountId " + getAccountId() + ", ContainerId " + getContainerId()) : "") + (formatVersion > PersistentIndex.VERSION_2 ? ", Life Version:" + lifeVersion : ""); }
Source:
<code>public void fallsBackInsideResponse() throws Exception { MatcherAssert.assertThat( new RsPrint( new TkFallback( new Take() { @Override public Response act(final Request req) { <START> return new RsOf( <END> () -> { throw new UnsupportedOperationException(""); }, () -> { throw new IllegalArgumentException( "here we fail" ); } ); } }, new FbFixed(new RsText("caught here!")) ).act(new RqFake()) ).printBody(), Matchers.startsWith("caught") ); }</code><technical_language>@fanifieiev above</technical_language>

Target:
public void fallsBackInsideResponse() throws Exception { MatcherAssert.assertThat( new RsPrint( new TkFallback( new Take() { @Override public Response act(final Request req) { return new ResponseOf( () -> { throw new UnsupportedOperationException(""); }, () -> { throw new IllegalArgumentException( "here we fail" ); } ); } }, new FbFixed(new RsText("caught here!")) ).act(new RqFake()) ).printBody(), Matchers.startsWith("caught") ); }
Source:
<code>private Map<String, List<String>> getRefererParameters(Map<String, String[]> requestParams, String referer) throws URISyntaxException { <START> List<NameValuePair> refererParameters = new URIBuilder(referer).getQueryParams(); <END> Map<String, List<String>> combinedRefererParameters = new HashMap<>(); for (NameValuePair pair : refererParameters) { if (!requestParams.containsKey(pair.getName())) { if (combinedRefererParameters.containsKey(pair.getName())) { List<String> values = combinedRefererParameters.get(pair.getName()); values.add(pair.getValue()); combinedRefererParameters.put(pair.getName(), values); } else { combinedRefererParameters.put(pair.getName(), new ArrayList<>(Arrays.asList(pair.getValue()))); } } } return combinedRefererParameters; }</code><technical_language>this is reason for include additional dependency. I avoid that. java.net.URI get query string referer split & = get values. URLEncoder decode percent-encoded values query string. remove dependency</technical_language>

Target:
private Map<String, List<String>> getRefererParameters(Map<String, String[]> requestParams, String referer) throws URISyntaxException, UnsupportedEncodingException { List<Map.Entry<String, String>> queryPairs = getParameterNameValuePairsFromURL(referer); Map<String, List<String>> combinedRefererParameters = new HashMap<>(); for (Map.Entry<String, String> pair : queryPairs) { if (!requestParams.containsKey(pair.getKey())) { if (combinedRefererParameters.containsKey(pair.getKey())) { List<String> values = combinedRefererParameters.get(pair.getKey()); values.add(pair.getValue()); combinedRefererParameters.put(pair.getKey(), values); } else { combinedRefererParameters.put(pair.getKey(), new ArrayList<>(Arrays.asList(pair.getValue()))); } } } return combinedRefererParameters; }
Source:
<code>private void createToolbar() { final IMenuService menuService = (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class); form.getToolBarManager().add(new Action("", Activator.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)) { @Override <START> public void run() { <END> final EditingDomain editingDomain = AdapterFactoryEditingDomain .getEditingDomainFor(modelElementContext .getDomainObject()); new ECPCommand(modelElementContext.getDomainObject(), editingDomain) { @Override protected void doRun() { EcoreUtil.delete(modelElementContext.getDomainObject(), true); } }.run(true); MEEditorPage.this.getEditor().close(true); } }); menuService.populateContributionManager((ContributionManager) form.getToolBarManager(), TOOLBAR_ORG_ECLIPSE_EMF_ECP_EDITOR_INTERNAL_E3_ME_EDITOR_PAGE); form.getToolBarManager().update(true); }</code><technical_language>dont delete service here</technical_language>

Target:
private void createToolbar() { final IMenuService menuService = (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class); form.getToolBarManager().add(new Action("", Activator.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)) { @Override public void run() { deleteService.deleteElement(modelElementContext.getDomainObject()); MEEditorPage.this.getEditor().close(true); } }); menuService.populateContributionManager((ContributionManager) form.getToolBarManager(), TOOLBAR_ORG_ECLIPSE_EMF_ECP_EDITOR_INTERNAL_E3_ME_EDITOR_PAGE); form.getToolBarManager().update(true); }
Source:
<code>public CompletableFuture<Boolean> getIssueMetadata(String repoId, List<TurboIssue> issues) { String message = "Getting metadata for " + repoId + "..."; logger.info("Getting metadata for issues " <START> + issues.stream().map(TurboIssue::getId).map(Object::toString).collect(Collectors.joining(", "))); <END> UI.status.displayMessage(message); String currentUser = prefs.getLastLoginUsername(); return repoIO.getIssueMetadata(repoId, issues).thenApply(this::processUpdates) .thenApply(metadata -> { String updatedMessage = "Received metadata from " + repoId + "!"; UI.status.displayMessage(updatedMessage); models.insertMetadata(repoId, metadata, currentUser); return true; }) .exceptionally(withResult(false)); }</code><technical_language>Is this needed? I List::toString invokes toString contents</technical_language>

Target:
public CompletableFuture<Boolean> getIssueMetadata(String repoId, List<TurboIssue> issues) { String message = "Getting metadata for " + repoId + "..."; logger.info("Getting metadata for issues " + issues); UI.status.displayMessage(message); return repoIO.getIssueMetadata(repoId, issues).thenApply(this::processUpdates) .thenApply(metadata -> insertMetadata(metadata, repoId, prefs.getLastLoginUsername())) .exceptionally(withResult(false)); }
Source:
<code><START> public TimeFormat getTimeFormat() <END> { return fTimeFormat; }</code><technical_language>API breakage. need method</technical_language>

Target:
public Utils.TimeFormat getTimeFormat() { return Utils.TimeFormat.values()[fTimeFormat.ordinal()]; }
Source:
<code>public void testStringFunction() throws Exception { FilterFactory ff = dataStore.getFilterFactory(); Function function = ff.function("strToLowerCase", ff.property("stringProperty")); PropertyIsLike likeWithStringFunction = ff.like(function, "z%", "%", "-", "\\", true); <START> assumeTrue(dataStore.getFilterCapabilities().fullySupports(likeWithStringFunction)); <END> assertEquals(1, featureSource.getCount(new Query(null, likeWithStringFunction))); }</code><technical_language>Please put assume line in test, precondition clearer</technical_language>

Target:
public void testStringFunction() throws Exception { if (!dataStore.getFilterCapabilities().supports(FilterFunction_strToLowerCase.class)) { LOGGER.info("Ignoring testStringFunction test"); return; } FilterFactory ff = dataStore.getFilterFactory(); Function function = ff.function("strToLowerCase", ff.property("stringProperty")); PropertyIsLike likeWithStringFunction = ff.like(function, "z%", "%", "-", "\\", true); assertEquals(1, featureSource.getCount(new Query(null, likeWithStringFunction))); }
Source:
<code>private void postRefundRequest(String payload) { publicAuthMock.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID); String refundStatus = "available"; connectorMock.respondAccepted_whenCreateARefund(AMOUNT, REFUND_AMOUNT_AVAILABLE, GATEWAY_ACCOUNT_ID, CHARGE_ID, REFUND_ID, refundStatus, CREATED_DATE); given().port(app.getLocalPort()) .header(AUTHORIZATION, "Bearer " + API_KEY) .header(CONTENT_TYPE, APPLICATION_JSON) .body(payload) .post(format("/v1/payments/%s/refunds", CHARGE_ID)) <START> .then() <END> .statusCode(ACCEPTED.getStatusCode()) .contentType(JSON) .body("refund_id", is(REFUND_ID)) .body("amount", is(AMOUNT)) .body("status", is(refundStatus)) .body("created_date", is(CREATED_DATE)) .body("_links.self.href", is(paymentRefundLocationFor(CHARGE_ID, REFUND_ID))) .body("_links.payment.href", is(paymentLocationFor(CHARGE_ID))); }</code><technical_language>minor: a reusable method given().port(app.getLocalPort()) .header(AUTHORIZATION, "Bearer " + API_KEY) .header(CONTENT_TYPE, APPLICATION_JSON) .body(payload) .post(format("/v1/payments/%s/refunds", CHARGE_ID)) .then()</technical_language>

Target:
private void postRefundRequest(String payload) { publicAuthMock.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID); String refundStatus = "available"; connectorMock.respondAccepted_whenCreateARefund(AMOUNT, REFUND_AMOUNT_AVAILABLE, GATEWAY_ACCOUNT_ID, CHARGE_ID, REFUND_ID, refundStatus, CREATED_DATE); postRefunds(payload) .then() .statusCode(ACCEPTED.getStatusCode()) .contentType(JSON) .body("refund_id", is(REFUND_ID)) .body("amount", is(AMOUNT)) .body("status", is(refundStatus)) .body("created_date", is(CREATED_DATE)) .body("_links.self.href", is(paymentRefundLocationFor(CHARGE_ID, REFUND_ID))) .body("_links.payment.href", is(paymentLocationFor(CHARGE_ID))); }