auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void checkRamResourcesAvailability( String accountId, String namespace, Workspace workspace, @Nullable String envName) throws NotFoundException, ServerException, ConflictException { if (workspace.getConfig() != null) { checkRamResourcesAvailability( accountId, namespace, workspace.getId(), workspace.getConfig(), envName); } else { LOG.warn( <START> "Can not estimate memory needed for devfile based workspace {}. Set memory resources limits may work incorrectly", <END> workspace.getId()); } }</code><technical_language>about: "Cannot estimate memory requirements of a devfile-based workspace {}. memory limits applied correctly."</technical_language>

Target:
void checkRamResourcesAvailability( String accountId, String namespace, Workspace workspace, @Nullable String envName) throws NotFoundException, ServerException, ConflictException { if (workspace.getConfig() != null) { checkRamResourcesAvailability( accountId, namespace, workspace.getId(), workspace.getConfig(), envName); } else { LOG.warn( "Cannot estimate the memory requirements of a devfile-based workspace `{}`." + " The memory limits may not be applied correctly.", workspace.getId()); } }
Source:
<code>public void cherryPick() throws Exception { repo.updateRef("HEAD").link("refs/heads/master"); RevCommit head = tr.branch("master").commit() .add("foo", "foo contents\n") .create(); RevCommit toPick = tr.commit() .parent(tr.commit().create()) .message("message to cherry-pick") .add("bar", "bar contents\n") <START> .create(); <END> RevCommit result = tr.cherryPick(toPick); rw.parseBody(result); Ref headRef = tr.getRepository().getRef("HEAD"); assertEquals(result, headRef.getObjectId()); assertTrue(headRef.isSymbolic()); assertEquals("refs/heads/master", headRef.getLeaf().getName()); assertEquals(result, headRef.getObjectId()); assertEquals(1, result.getParentCount()); assertEquals(head, result.getParent(0)); assertEquals(toPick.getAuthorIdent(), result.getAuthorIdent()); assertEquals(new PersonIdent(toPick.getCommitterIdent(), new Date(0)), new PersonIdent(result.getCommitterIdent(), new Date(0))); assertTrue(toPick.getCommitTime() < result.getCommitTime()); assertEquals("message to cherry-pick", result.getFullMessage()); assertEquals("foo contents\n", blobAsString(result, "foo")); assertEquals("bar contents\n", blobAsString(result, "bar")); }</code><technical_language>I create a commit non-default Author Committer. more obvious right idents</technical_language>

Target:
public void cherryPick() throws Exception { repo.updateRef("HEAD").link("refs/heads/master"); RevCommit head = tr.branch("master").commit() .add("foo", "foo contents\n") .create(); rw.parseBody(head); RevCommit toPick = tr.commit() .parent(tr.commit().create()) .author(new PersonIdent("Cherrypick Author", "cpa@example.com", tr.getClock(), tr.getTimeZone())) .author(new PersonIdent("Cherrypick Committer", "cpc@example.com", tr.getClock(), tr.getTimeZone())) .message("message to cherry-pick") .add("bar", "bar contents\n") .create(); RevCommit result = tr.cherryPick(toPick); rw.parseBody(result); Ref headRef = tr.getRepository().getRef("HEAD"); assertEquals(result, headRef.getObjectId()); assertTrue(headRef.isSymbolic()); assertEquals("refs/heads/master", headRef.getLeaf().getName()); assertEquals(1, result.getParentCount()); assertEquals(head, result.getParent(0)); assertEquals(toPick.getAuthorIdent(), result.getAuthorIdent()); assertEquals(new PersonIdent(head.getCommitterIdent(), new Date(0)), new PersonIdent(result.getCommitterIdent(), new Date(0))); assertTrue(toPick.getCommitTime() < result.getCommitTime()); assertEquals("message to cherry-pick", result.getFullMessage()); assertEquals("foo contents\n", blobAsString(result, "foo")); assertEquals("bar contents\n", blobAsString(result, "bar")); }
Source:
<code>public void getStorageConnectionsByStorageTypeWithRecords(EnumSet<StorageDomainStatus> statuses, Collection<Guid> expectedDomains) { List<StorageServerConnections> result = dao.getStorageConnectionsByStorageTypeAndStatus(FixturesTool.STORAGE_POOL_MIXED_TYPES, StorageType.NFS, statuses); assertNotNull(result); <START> assertFalse(result.isEmpty()); <END> for (StorageServerConnections storageServerConnection : result) { assertEquals(StorageType.NFS, storageServerConnection.getstorage_type()); } List<StoragePoolIsoMap> poolIsoMap = dbFacade.getStoragePoolIsoMapDao().getAllForStoragePool(FixturesTool.STORAGE_POOL_MIXED_TYPES); List<Guid> storageDomainIds = new LinkedList<>(); for (StoragePoolIsoMap isoMap : poolIsoMap) { if (statuses.contains(isoMap.getStatus())) { storageDomainIds.add(isoMap.getstorage_id()); } } assertTrue(CollectionUtils.isEqualCollection(expectedDomains, storageDomainIds)); List<StorageServerConnections> domainConnections = new LinkedList<>(); for (Guid domainId : storageDomainIds) { domainConnections.addAll(dao.getAllForDomain(domainId)); } assertTrue(CollectionUtils.isEqualCollection(domainConnections, result)); }</code><technical_language>please add a message</technical_language>

Target:
public void getStorageConnectionsByStorageTypeWithRecords(EnumSet<StorageDomainStatus> statuses, Collection<Guid> expectedDomains) { List<StoragePoolIsoMap> poolIsoMap = dbFacade.getStoragePoolIsoMapDao().getAllForStoragePool(FixturesTool.STORAGE_POOL_MIXED_TYPES); List<Guid> storageDomainIds = new LinkedList<>(); for (StoragePoolIsoMap isoMap : poolIsoMap) { if (statuses.contains(isoMap.getStatus())) { storageDomainIds.add(isoMap.getstorage_id()); } } assertTrue("the list of the pool domains expected to be in the given statuses doesn't match the queried data", CollectionUtils.isEqualCollection(expectedDomains, storageDomainIds)); List<StorageServerConnections> result = dao.getStorageConnectionsByStorageTypeAndStatus(FixturesTool.STORAGE_POOL_MIXED_TYPES, StorageType.NFS, statuses); assertFalse("there should be connections for the tested domains to verify the correctness", result.isEmpty()); for (StorageServerConnections storageServerConnection : result) { assertEquals("connections were loaded with incorrect storage type", StorageType.NFS, storageServerConnection.getstorage_type()); } List<StorageServerConnections> domainConnections = new LinkedList<>(); for (Guid domainId : storageDomainIds) { domainConnections.addAll(dao.getAllForDomain(domainId)); } assertTrue("the connections loaded by the given dao function should match the connections loaded separately", CollectionUtils.isEqualCollection(domainConnections, result)); }
Source:
<code>private String getOSGiMetadataFileName() { String packaging = project.getPackaging(); if (PackagingType.TYPE_ECLIPSE_PLUGIN.equals(packaging) || PackagingType.TYPE_ECLIPSE_TEST_PLUGIN.equals(packaging)) { return "META-INF/MANIFEST.MF"; } else if (PackagingType.TYPE_ECLIPSE_FEATURE.equals(packaging)) { return "feature.xml"; } else if (PackagingType.TYPE_ECLIPSE_APPLICATION.equals(packaging)) { return project.getArtifactId() + ".product"; } else if (PackagingType.TYPE_ECLIPSE_REPOSITORY.equals(packaging)) { return project.getArtifactId(); } else if (PackagingType.TYPE_P2_IU.equals(packaging)) { return <START> IU.P2_IU; <END> } return "<unknown packaging=" + packaging + ">"; }</code><technical_language>is hard guess this is supposed be. Rename SOURCE_FILE_NAME P2_IU_XML</technical_language>

Target:
private String getOSGiMetadataFileName() { String packaging = project.getPackaging(); if (PackagingType.TYPE_ECLIPSE_PLUGIN.equals(packaging) || PackagingType.TYPE_ECLIPSE_TEST_PLUGIN.equals(packaging)) { return "META-INF/MANIFEST.MF"; } else if (PackagingType.TYPE_ECLIPSE_FEATURE.equals(packaging)) { return "feature.xml"; } else if (PackagingType.TYPE_ECLIPSE_APPLICATION.equals(packaging)) { return project.getArtifactId() + ".product"; } else if (PackagingType.TYPE_ECLIPSE_REPOSITORY.equals(packaging)) { return project.getArtifactId(); } else if (PackagingType.TYPE_P2_IU.equals(packaging)) { return IU.SOURCE_FILE_NAME; } return "<unknown packaging=" + packaging + ">"; }
Source:
<code>private void setUpMetricData(List<MetricData> metricDataList) { List<PointValue> chartPoints = new ArrayList<>(); List<AxisValue> chartAxisPoints = new ArrayList<>(); for (int metricDataPosition = 0; metricDataPosition < metricDataList.size(); metricDataPosition++) { MetricData metricData = metricDataList.get(metricDataPosition); chartPoints.add(new PointValue(metricDataPosition, metricData.getValue())); chartAxisPoints.add(new AxisValue(metricDataPosition) .setLabel(DateFormat.getTimeInstance(DateFormat.SHORT).format(new Date(metricData.getTimestamp())))); } Line chartLine = new Line(chartPoints) .setColor(getResources().getColor(R.color.background_primary_dark)) .setCubic(true) .setHasPoints(false); LineChartData chartData = new LineChartData() .setLines(Collections.singletonList(chartLine)); chartData.setAxisXBottom(new Axis() .setValues(chartAxisPoints)); chartData.setAxisYLeft(new Axis() .setHasLines(true)); chart.setLineChartData(chartData); Viewport chartViewport = new Viewport(chart.getMaximumViewport()); chartViewport.bottom = chart.getMaximumViewport().bottom - 50; chartViewport.top = chart.getMaximumViewport().top + 50; chart.setMaximumViewport(chartViewport); chart.setCurrentViewport(chartViewport); <START> hideProgress(); <END> }</code><technical_language>curious - is startProgress()</technical_language>

Target:
private void setUpMetricData(List<MetricData> metricDataList) { sortMetricData(metricDataList); List<PointValue> chartPoints = new ArrayList<>(); List<AxisValue> chartAxisPoints = new ArrayList<>(); for (int metricDataPosition = 0; metricDataPosition < metricDataList.size(); metricDataPosition++) { MetricData metricData = metricDataList.get(metricDataPosition); chartPoints.add(new PointValue(metricDataPosition, metricData.getValue())); chartAxisPoints.add(new AxisValue(metricDataPosition) .setLabel(DateFormat.getTimeInstance(DateFormat.SHORT).format(new Date(metricData.getTimestamp())))); } Line chartLine = new Line(chartPoints) .setColor(getResources().getColor(R.color.background_primary_dark)) .setCubic(true) .setHasPoints(false); LineChartData chartData = new LineChartData() .setLines(Collections.singletonList(chartLine)); chartData.setAxisXBottom(new Axis() .setValues(chartAxisPoints)); chartData.setAxisYLeft(new Axis() .setHasLines(true)); chart.setLineChartData(chartData); Viewport chartViewport = new Viewport(chart.getMaximumViewport()); chartViewport.bottom = chart.getMaximumViewport().bottom - 50; chartViewport.top = chart.getMaximumViewport().top + 50; chart.setMaximumViewport(chartViewport); chart.setCurrentViewport(chartViewport); hideProgress(); }
Source:
<code>protected Command createChangeBoundsCommand(final IGraphicalEditPart editPart, final Point newPosition) { Command result = null; final Object existingRequest = this.findRequest(editPart, org.eclipse.gef.RequestConstants.REQ_MOVE); ChangeBoundsRequest request = null; double scale = 1.0; if (editPart.getRoot() instanceof DiagramRootEditPart) { final ZoomManager zoomManager = ((DiagramRootEditPart) editPart.getRoot()).getZoomManager(); scale = zoomManager.getZoom(); } if (existingRequest instanceof ChangeBoundsRequest) { request = (ChangeBoundsRequest) existingRequest; } else if (existingRequest == null) { request = new ChangeBoundsRequest(); request.setEditParts(editPart); result = this.buildCommandWrapper(request, editPart); } if (newPosition != null) { final Dimension delta = newPosition.getDifference(editPart.getFigure().getBounds().getLocation()); delta.width *= scale; delta.height *= scale; if (request != null) { request.setMoveDelta(new Point(delta.width, delta.height)); request.setLocation(newPosition); request.setType(org.eclipse.gef.RequestConstants.REQ_MOVE); <START> request.getExtendedData().put(RegionResizableEditPolicy.IS_AUTHORIZED_MOVE, Boolean.TRUE); <END> } else { return null; } } return result; }</code><technical_language>constant declared in region editpolicy in PinnedElementProvider</technical_language>

Target:
protected Command createChangeBoundsCommand(final IGraphicalEditPart editPart, final Point newPosition) { Command result = null; final Object existingRequest = this.findRequest(editPart, org.eclipse.gef.RequestConstants.REQ_MOVE); ChangeBoundsRequest request = null; double scale = 1.0; if (editPart.getRoot() instanceof DiagramRootEditPart) { final ZoomManager zoomManager = ((DiagramRootEditPart) editPart.getRoot()).getZoomManager(); scale = zoomManager.getZoom(); } if (existingRequest instanceof ChangeBoundsRequest) { request = (ChangeBoundsRequest) existingRequest; } else if (existingRequest == null) { request = new ChangeBoundsRequest(); request.setEditParts(editPart); result = this.buildCommandWrapper(request, editPart); } if (newPosition != null) { final Dimension delta = newPosition.getDifference(editPart.getFigure().getBounds().getLocation()); delta.width *= scale; delta.height *= scale; if (request != null) { request.setMoveDelta(new Point(delta.width, delta.height)); request.setLocation(newPosition); request.setType(org.eclipse.gef.RequestConstants.REQ_MOVE); request.getExtendedData().put(PinnedElementsLayoutProvider.PINNED_ELEMENTS_MOVE, Boolean.TRUE); } else { return null; } } return result; }
Source:
<code>public void testListAttribute() { DummyNodeWithListAndEnum dummy = new DummyNodeWithListAndEnum(1); SaxonXPathRuleQuery query = createQuery(" List<Node> result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); <START> query = createQuery(" END> result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(0, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(0, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); }</code><technical_language>This statements duplicated extracted a single method call. assertResultSize(0, "//dummyNode[@List = \"C\"]");</technical_language>

Target:
public void testListAttribute() { DummyNodeWithListAndEnum dummy = new DummyNodeWithListAndEnum(1); assertQuery(1, " assertQuery(1, " assertQuery(0, " assertQuery(1, " assertQuery(0, " assertQuery(1, " assertQuery(1, " assertQuery(1, " assertQuery(0, " }
Source:
<code>public boolean doMonitor(ServiceEmitter emitter) { final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder(); Map<String, Long> diff = keyedDiff.to( "queryCountStats", <START> ImmutableMap.of("query/total/count", statsProvider.getSuccessfulQueryCount() + statsProvider.getFailedQueryCount(), <END> "query/success/count", statsProvider.getSuccessfulQueryCount(), "query/failed/count", statsProvider.getFailedQueryCount(), "query/interrupted/count", statsProvider.getInterruptedQueryCount() ) ); if (diff != null) { for (Map.Entry<String, Long> diffEntry : diff.entrySet()) { emitter.emit(builder.build(diffEntry.getKey(), diffEntry.getValue())); } } return true; }</code><technical_language>I this include interrupted too. "failed" "interrupted" exclusive. For consistency suggest retrieving successful/failed/interrupted counts first, summing total. This is counts updated in background, if call getSuccessfulQueryCount() more once, necessarily same</technical_language>

Target:
public boolean doMonitor(ServiceEmitter emitter) { final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder(); final long successfulQueryCount = statsProvider.getSuccessfulQueryCount(); final long failedQueryCount = statsProvider.getFailedQueryCount(); final long interruptedQueryCount = statsProvider.getInterruptedQueryCount(); Map<String, Long> diff = keyedDiff.to( "queryCountStats", ImmutableMap.of( "query/count", successfulQueryCount + failedQueryCount + interruptedQueryCount, "query/success/count", successfulQueryCount, "query/failed/count", failedQueryCount, "query/interrupted/count", interruptedQueryCount ) ); if (diff != null) { for (Map.Entry<String, Long> diffEntry : diff.entrySet()) { emitter.emit(builder.build(diffEntry.getKey(), diffEntry.getValue())); } } return true; }
Source:
<code>public void test() throws Exception { tester.assertThat(new RemoveDistinctFromSemiJoin()) .on(p -> { Symbol sourceKey = p.symbol("custkey", BigintType.BIGINT); Symbol filteringSourceKey = p.symbol("custkey_1", BigintType.BIGINT); Symbol outputKey = p.symbol("orderkey", BigintType.BIGINT); return p.semiJoin( p.tableScan("orders", ImmutableMap.of("custkey", "custkey")), p.project(Assignments.of(filteringSourceKey, expression("x")), p.aggregation(ab -> ab.step(AggregationNode.Step.SINGLE) .groupingSets(ImmutableList.of(ImmutableList.of(filteringSourceKey))) .source(p.tableScan("customer", ImmutableMap.of("custkey_1", "custkey"))) .build()) ), sourceKey, filteringSourceKey, outputKey ); }) .matches( semiJoin("Source", "Filter", "Output", tableScan("orders", ImmutableMap.of("Source", "custkey")), <START> project(tableScan("customer", ImmutableMap.of("Filter", "custkey"))) <END> ) ); }</code><technical_language>please try plan node matcher in separate line</technical_language>

Target:
public void test() throws Exception { tester.assertThat(new RemoveDistinctFromSemiJoin()) .on(p -> { Symbol sourceKey = p.symbol("custkey", BigintType.BIGINT); Symbol filteringSourceKey = p.symbol("custkey_1", BigintType.BIGINT); Symbol outputKey = p.symbol("orderkey", BigintType.BIGINT); return p.semiJoin( p.tableScan( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "orders", TINY_SCALE_FACTOR)), ImmutableList.of(sourceKey), ImmutableMap.of(sourceKey, new TpchColumnHandle("custkey", BIGINT))), p.project(Assignments.of(filteringSourceKey, expression("x")), p.aggregation(ab -> ab.step(AggregationNode.Step.SINGLE) .groupingSets(ImmutableList.of(ImmutableList.of(filteringSourceKey))) .source( p.tableScan( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "customer", TINY_SCALE_FACTOR)), ImmutableList.of(filteringSourceKey), ImmutableMap.of(filteringSourceKey, new TpchColumnHandle("custkey", BIGINT))) ) .build()) ), sourceKey, filteringSourceKey, outputKey ); }) .matches( semiJoin("Source", "Filter", "Output", tableScan("orders", ImmutableMap.of("Source", "custkey")), project(tableScan("customer", ImmutableMap.of("Filter", "custkey"))) ) ); }
Source:
<code>public void onConnected(Bundle bundle) { <START> if(SmartLocationOptions.getDebugging()) Log.i(getClass().getSimpleName(), "connected"); <END> continueRemoveUpdates(); }</code><technical_language>curly braces in kind of one-liners</technical_language>

Target:
public void onConnected(Bundle bundle) { if(smartLocationOptions.getDebugging()) { Log.i(getClass().getSimpleName(), "connected"); } continueRemoveUpdates(); }
Source:
<code>private DefaultGroupCheckpointStore(@Parameter(SharedStorePath.class) final String tmpFolderpath) { this.tmpFolderPath = tmpFolderpath; this.avroDagDatumWriter = new SpecificDatumWriter<>(AvroDag.class); this.avroDagDatumReader = new SpecificDatumReader<>(AvroDag.class); this.groupCheckpointDatumWriter = new SpecificDatumWriter<>(GroupCheckpoint.class); this.groupCheckpointDatumReader = new SpecificDatumReader<>(GroupCheckpoint.class); <START> final File folder = new File(tmpFolderPath); <END> if (!folder.exists()) { folder.mkdir(); } }</code><technical_language>folder is created master please remove this code</technical_language>

Target:
private DefaultGroupCheckpointStore(@Parameter(SharedStorePath.class) final String tmpFolderpath) { this.tmpFolderPath = tmpFolderpath; this.avroDagDatumWriter = new SpecificDatumWriter<>(AvroDag.class); this.avroDagDatumReader = new SpecificDatumReader<>(AvroDag.class); this.groupCheckpointDatumWriter = new SpecificDatumWriter<>(GroupCheckpoint.class); this.groupCheckpointDatumReader = new SpecificDatumReader<>(GroupCheckpoint.class); }
Source:
<code>public void testGetByNameAndDataCenter() { <START> Network result = dao.getByNameAndDataCenter("engine", datacenter); <END> assertNotNull(result); assertEquals("engine", result.getname()); }</code><technical_language>"engine" extracted constant</technical_language>

Target:
public void testGetByNameAndDataCenter() { Network result = dao.getByNameAndDataCenter(EXISTING_NETWORK_NAME, datacenter); assertNotNull(result); assertEquals(EXISTING_NETWORK_NAME, result.getname()); }
Source:
<code>private void updateButtonState(boolean isBlocked) { <START> android.util.Log.w("tjs", "updateButtonState " + isBlocked); <END> mBlockButton.setEnabled(!isBlocked); mBlockTransientButton.setEnabled(!isBlocked); mUnblockButton.setEnabled(isBlocked); }</code><technical_language>Do need this log message</technical_language>

Target:
private void updateButtonState(boolean isBlocked) { mBlockButton.setEnabled(!isBlocked); mBlockTransientButton.setEnabled(!isBlocked); mUnblockButton.setEnabled(isBlocked); mTerminateButton.setEnabled(WebViewFeature.isFeatureSupported( WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE)); }
Source:
<code>public void execute(final String activeContextId, final EventHandler<AvroElasticMemoryMessage> callback) { final ActiveContext activeContext = activeContexts.remove(activeContextId); final boolean isSuccess; if (activeContext == null) { LOG.log(Level.WARNING, <START> "Trying to remove running task on active context {0}. Cannot find running task on it", activeContextId); <END> isSuccess = false; } else { workerContextsToClose.remove(activeContext); activeContext.close(); final int remainingNumWorkers = runningWorkerContextCount.decrementAndGet(); LOG.log(Level.FINE, "Worker has been deleted successfully. Remaining workers: {0}", remainingNumWorkers); isSuccess = true; } sendCallback(activeContextId, callback, isSuccess); }</code><technical_language>activeContext registered activeContexts, event of ActiveContext happens. is mentioning running tasks</technical_language>

Target:
public boolean execute(final String activeContextId, final EventHandler<AvroElasticMemoryMessage> callback) { final ActiveContext activeContext = activeContexts.remove(activeContextId); final boolean isSuccess; if (activeContext == null) { LOG.log(Level.WARNING, "Trying to remove active context {0}, which is not found", activeContextId); isSuccess = false; } else { deletedWorkerSet.add(activeContextId); final RunningTask runningTask = contextIdToRunningTasks.remove(activeContextId); runningTask.close(); activeContext.close(); final int remainingNumWorkers = runningWorkerContextCount.decrementAndGet(); LOG.log(Level.FINE, "Worker has been deleted successfully. Remaining workers: {0}", remainingNumWorkers); isSuccess = true; } sendCallback(activeContextId, callback, isSuccess); return isSuccess; }
Source:
<code>public String toString() { <START> return getClass().getName() + " [policyDirectives=" + this.policy + "]"; <END> }</code><technical_language>suggestion return getClass().getName() + " [policy=" + this.policy + "]";</technical_language>

Target:
public String toString() { return getClass().getName() + " [policy=" + this.policy + "]"; }
Source:
<code>public static void createDecisionReviews(boolean DEBUG, SkynetTransaction transaction) throws Exception { Date createdDate = new Date(); IAtsUser createdBy = AtsClientService.get().getAtsUserAdmin().getCurrentUser(); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "Create Decision reviews"); } TeamWorkFlowArtifact firstTestArt = getSampleReviewTestWorkflows().get(0); TeamWorkFlowArtifact secondTestArt = getSampleReviewTestWorkflows().get(1); DecisionReviewArtifact reviewArt = ValidateReviewManager.createValidateReview(firstTestArt, true, createdDate, createdBy, transaction); Result result = DecisionReviewManager.transitionTo(reviewArt, DecisionReviewState.Followup, <START> AtsClientService.get().getAtsUserAdmin().getCurrentUser(), false, transaction); <END> if (result.isFalse()) { throw new IllegalStateException("Failed transitioning review to Followup: " + result.getText()); } reviewArt.persist(transaction); reviewArt = ValidateReviewManager.createValidateReview(secondTestArt, true, createdDate, createdBy, transaction); DecisionReviewManager.transitionTo(reviewArt, DecisionReviewState.Completed, AtsClientService.get().getAtsUserAdmin().getCurrentUser(), false, transaction); if (result.isFalse()) { throw new IllegalStateException("Failed transitioning review to Completed: " + result.getText()); } reviewArt.persist(transaction); }</code><technical_language>variable createdBy set this call xxxx.getCurrentuser()</technical_language>

Target:
public static void createDecisionReviews(boolean DEBUG, SkynetTransaction transaction) throws Exception { Date createdDate = new Date(); IAtsUser createdBy = AtsClientService.get().getAtsUserAdmin().getCurrentUser(); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "Create Decision reviews"); } TeamWorkFlowArtifact firstTestArt = getSampleReviewTestWorkflows().get(0); TeamWorkFlowArtifact secondTestArt = getSampleReviewTestWorkflows().get(1); DecisionReviewArtifact reviewArt = ValidateReviewManager.createValidateReview(firstTestArt, true, createdDate, createdBy, transaction); Result result = DecisionReviewManager.transitionTo(reviewArt, DecisionReviewState.Followup, createdBy, false, transaction); if (result.isFalse()) { throw new IllegalStateException("Failed transitioning review to Followup: " + result.getText()); } reviewArt.persist(transaction); reviewArt = ValidateReviewManager.createValidateReview(secondTestArt, true, createdDate, createdBy, transaction); DecisionReviewManager.transitionTo(reviewArt, DecisionReviewState.Completed, createdBy, false, transaction); if (result.isFalse()) { throw new IllegalStateException("Failed transitioning review to Completed: " + result.getText()); } reviewArt.persist(transaction); }
Source:
<code>protected com.woorea.openstack.quantum.model.Network createNewNetworkEntity(Network network) { com.woorea.openstack.quantum.model.Network networkForCreate = super.createNewNetworkEntity(network); <START> networkForCreate.setTenantId(DEVICE_OWNER); <END> return networkForCreate; }</code><technical_language>remove surrounding 'if'- if (!provider.isRequiringAuthentication()) { networkForCreate.setTenantId(DEVICE_OWNER); }</technical_language>

Target:
protected com.woorea.openstack.quantum.model.Network createNewNetworkEntity(Network network) { com.woorea.openstack.quantum.model.Network networkForCreate = super.createNewNetworkEntity(network); if (!provider.isRequiringAuthentication()) { networkForCreate.setTenantId(DEVICE_OWNER); } return networkForCreate; }
Source:
<code>public <K, V> OnHeapStore<K, V> createStore(final Configuration<K, V> storeConfig, final ServiceConfiguration<?>... serviceConfigs) { TimeSource timeSource = serviceProvider.getService(TimeSourceService.class).getTimeSource(); CopyProvider copyProvider = serviceProvider.getService(CopyProvider.class); Copier<K> keyCopier = copyProvider.createKeyCopier(storeConfig.getKeyType(), storeConfig.getKeySerializer(), serviceConfigs); Copier<V> valueCopier = copyProvider.createValueCopier(storeConfig.getValueType(), storeConfig.getValueSerializer(), serviceConfigs); SizeOfEngineProvider sizeOfEngineProvider = serviceProvider.getService(SizeOfEngineProvider.class); boolean isByteSized = storeConfig.getResourcePools().getPoolForResource(ResourceType.Core.HEAP).getUnit() instanceof MemoryUnit; <START> SizeOfEngine sizeOfEngine = sizeOfEngineProvider.createSizeOfEngine(isByteSized, serviceConfigs); <END> OnHeapStore<K, V> onHeapStore = new OnHeapStore<K, V>(storeConfig, timeSource, keyCopier, valueCopier, sizeOfEngine); createdStores.add(onHeapStore); return onHeapStore; }</code><technical_language>provider handle logic</technical_language>

Target:
public <K, V> OnHeapStore<K, V> createStore(final Configuration<K, V> storeConfig, final ServiceConfiguration<?>... serviceConfigs) { TimeSource timeSource = serviceProvider.getService(TimeSourceService.class).getTimeSource(); CopyProvider copyProvider = serviceProvider.getService(CopyProvider.class); Copier<K> keyCopier = copyProvider.createKeyCopier(storeConfig.getKeyType(), storeConfig.getKeySerializer(), serviceConfigs); Copier<V> valueCopier = copyProvider.createValueCopier(storeConfig.getValueType(), storeConfig.getValueSerializer(), serviceConfigs); SizeOfEngineProvider sizeOfEngineProvider = serviceProvider.getService(SizeOfEngineProvider.class); SizeOfEngine sizeOfEngine = sizeOfEngineProvider.createSizeOfEngine(storeConfig.getResourcePools().getPoolForResource(ResourceType.Core.HEAP).getUnit(), serviceConfigs); OnHeapStore<K, V> onHeapStore = new OnHeapStore<K, V>(storeConfig, timeSource, keyCopier, valueCopier, sizeOfEngine); createdStores.add(onHeapStore); return onHeapStore; }
Source:
<code>protected void addUserInputPages() { RenameResourceProcessor processor= getRefactoring().getAdapter(RenameResourceProcessor.class); <START> RenameResourceRefactoringConfigurationPage page= new RenameResourceRefactoringConfigurationPage(processor); addPage(page); <END> }</code><technical_language>Is this change necessary? breaking in functionality before</technical_language>

Target:
protected void addUserInputPages() { RenameResourceProcessor processor= getRefactoring().getAdapter(RenameResourceProcessor.class); addPage(new RenameResourceRefactoringConfigurationPage(processor)); }
Source:
<code>protected void executeCommand() { EngineLock monitoringLock = aquireMonitorLock(); try { ResourceManager.getInstance().GetVdsManager(getVdsId()).refreshHost(getVds()); setSucceeded(true); } finally { <START> releaseMonitorLock(monitoringLock, "Get Capabilities"); <END> } }</code><technical_language>"Refresh host capabilities"</technical_language>

Target:
protected void executeCommand() { EngineLock monitoringLock = acquireMonitorLock(); try { ResourceManager.getInstance().GetVdsManager(getVdsId()).refreshHost(getVds()); setSucceeded(true); } finally { releaseMonitorLock(monitoringLock, "Refresh host capabilities"); } }
Source:
<code>public Iterable<RevCommit> call() throws IllegalStateException, MissingObjectException, IncorrectObjectTypeException, IOException { processOptions(); <START> walk = new RevWalk(repo); <END> walk.markStart(walk.parseCommit(start)); return walk; }</code><technical_language>reusing walk setup? create a new pool of revision objects reuse have? other hand, a walker dispose of object bodies, a reset reuse confuse caller bodies gone. a bug in RevWalk address fix forcing entire new pool created for a invocation. Likewise, RevWalk discards starting commits resets. allow retained somehow, walk executed needing maintain copy of starting points (RevWalk calls "roots" of itself.) Finally, RevWalk's implementation of Iterable is wrong. works once. Creating a 2nd Iterator fails. fix RevWalk iterator() method resets walk starts again</technical_language>

Target:
public Iterable<RevCommit> call() throws NoHeadException, JGitInternalException { if (!startSpecified) { try { ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) throw new NoHeadException( "No HEAD exists and no explicit starting revision was specified"); add(headId); } catch (IOException e) { throw new JGitInternalException( "An exception occured while trying to add the Id of HEAD", e); } } return walk; }
Source:
<code>public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); Map<String, ModuleService> moduleServices = load(ModuleService.class); if(argMap.containsKey(ARG_HELP)) { System.out.println(getUsage(moduleServices.keySet())); return; } <START> Deque<String> others = (Deque<String>)argMap.get("__other__"); <END> String module = others.removeFirst(); ModuleService moduleService = moduleServices.get(module); if(moduleService != null) { moduleService.parseArguments(others); ExtensionsManager extensionsManager = new ExtensionsManager(); File config = new File((String)argMap.get(ARG_EXT_CONFIG)); if (!config.exists()) { throw new Exception("Could not find extension configuration at the specified path"); } extensionsManager.initialize(extensionsManager.load(config)); moduleService.run(extensionsManager); } else { System.out.println("No such " + module + " module exists. To list existing modules use --help argument."); } } catch (Throwable t) { t.printStackTrace(); System.exit(1); } }</code><technical_language>simplest interface, in this case ordered is List</technical_language>

Target:
public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); Map<String, ModuleService> moduleServices = load(ModuleService.class); if (argMap.containsKey(ARG_HELP)) { System.out.println("core help"); System.out.println("Modules: " + StringUtils.join(moduleServices.keySet(), ", ")); return; } List<String> others = (List<String>) argMap.get("__other__"); String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists. To list existing modules use --help argument.", module) ); } Map<String, Object> moduleArgMap = moduleService.parseArguments(others); if(moduleArgMap.containsKey(ARG_HELP)) { System.out.println(module + " help"); return; } others = (List<String>)moduleArgMap.get("__other__"); if(others.size() > 1) { throw new IllegalArgumentException( String.format( "You've provided illegal arguments '%1$s' for module '%2$s' ", StringUtils.join(others, ", "), module ) ); } ExtensionsManager extensionsManager = new ExtensionsManager(); for(File f : CoreUtil.listFiles((String)argMap.get("extensions-dir"))) { extensionsManager.load(f); } for(ExtensionProxy proxy : extensionsManager.getLoadedExtensions()) { extensionsManager.initialize(proxy.getContext().<String>get(Base.ContextKeys.INSTANCE_NAME)); } ExtMap context = new ExtMap().mput(Base.GlobalContextKeys.EXTENSIONS, extensionsManager.getLoadedExtensions()); moduleService.setContext(context); moduleService.run(); } catch (IllegalArgumentException ex) { System.out.println(ex.getMessage()); } catch (Throwable t) { t.printStackTrace(); } }
Source:
<code>protected Map<String, Pair<String, String>> getExclusiveLocks() { <START> return Collections.singletonMap(getParameters().getStorageServerConnection().getid(), LockMessagesMatchUtil.STORAGE); <END> }</code><technical_language>in other domain related flows, key for lock is - storageDomain.getId()</technical_language>

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Map<String, Pair<String, String>> locks = new HashMap<String, Pair<String, String>>(); locks.put(getStorageDomain().getId().toString(), LockMessagesMatchUtil.STORAGE); locks.put(getParameters().getStorageServerConnection().getconnection(), LockMessagesMatchUtil.STORAGE_CONNECTION); return locks; }
Source:
<code>private void display(final PatchSetPublishDetail r) { descBlock.display(r.getChange(), r.getPatchSetInfo(), r.getAccounts()); if (r.getChange().getStatus().isOpen()) { initApprovals(r, approvalPanel); } if (lastState != null && patchSetId.equals(lastState.patchSetId)) { message.setText(lastState.message); } draftsPanel.clear(); if (!r.getDrafts().isEmpty()) { draftsPanel.add(new SmallHeading(Util.C.headingPatchComments())); Panel panel = null; String priorFile = ""; for (final PatchLineComment c : r.getDrafts()) { final Patch.Key patchKey = c.getKey().getParentKey(); final String fn = patchKey.get(); if (!fn.equals(priorFile)) { panel = new FlowPanel(); panel.addStyleName("gerrit-PatchComments"); draftsPanel.add(panel); <START> panel.add(new PatchLink.SideBySide(fn, new PatchSetKeys(patchKey))); <END> priorFile = fn; } Label m; m = new DoubleClickLinkLabel(patchKey); m.setText(Util.M.lineHeader(c.getLine())); m.setStyleName("gerrit-LineHeader"); panel.add(m); m = new DoubleClickLinkLabel(patchKey); SafeHtml.set(m.getElement(), LineCommentPanel.toSafeHtml(c)); m.setStyleName("gerrit-PatchLineComment"); panel.add(m); } } }</code><technical_language>I if in this context thread files, files drafts</technical_language>

Target:
private void display(final PatchSetPublishDetail r) { descBlock.display(r.getChange(), r.getPatchSetInfo(), r.getAccounts()); if (r.getChange().getStatus().isOpen()) { initApprovals(r, approvalPanel); } if (lastState != null && patchSetId.equals(lastState.patchSetId)) { message.setText(lastState.message); } draftsPanel.clear(); if (!r.getDrafts().isEmpty()) { draftsPanel.add(new SmallHeading(Util.C.headingPatchComments())); Panel panel = null; String priorFile = ""; for (final PatchLineComment c : r.getDrafts()) { final Patch.Key patchKey = c.getKey().getParentKey(); final String fn = patchKey.get(); if (!fn.equals(priorFile)) { panel = new FlowPanel(); panel.addStyleName("gerrit-PatchComments"); draftsPanel.add(panel); panel.add(new PatchLink.SideBySide(fn, patchKey, 0, null )); priorFile = fn; } Label m; m = new DoubleClickLinkLabel(patchKey); m.setText(Util.M.lineHeader(c.getLine())); m.setStyleName("gerrit-LineHeader"); panel.add(m); m = new DoubleClickLinkLabel(patchKey); SafeHtml.set(m.getElement(), LineCommentPanel.toSafeHtml(c)); m.setStyleName("gerrit-PatchLineComment"); panel.add(m); } } }
Source:
<code>private GovukOrganisation.Details getBranding() { String custodianId = requestContext.getRegister().getRegistry(); <START> return client.target("<LINK_0>" + custodianId) <END> .request() .get(GovukOrganisation.class) .getDetails(); }</code><technical_language>handle failure gracefully</technical_language>

Target:
private Optional<GovukOrganisation.Details> getBranding() { Optional<GovukOrganisation> organisation = organisationClient.getOrganisation(requestContext.getRegister().getRegistry()); return organisation.map(GovukOrganisation::getDetails); }
Source:
<code><START> public void testAMShutdownOnRMCallback() { <END> YarnConfiguration yarnConfiguration = mock(YarnConfiguration.class); SamzaAppMasterMetrics metrics = mock(SamzaAppMasterMetrics.class); Config config = mock(Config.class); AMRMClientAsync asyncClient = mock(AMRMClientAsync.class); YarnAppState yarnAppState = new YarnAppState(0, mock(ContainerId.class), "host", 8080, 8081); SamzaYarnAppMasterLifecycle lifecycle = mock(SamzaYarnAppMasterLifecycle.class); SamzaYarnAppMasterService service = mock(SamzaYarnAppMasterService.class); NMClientAsync asyncNMClient = mock(NMClientAsync.class); ClusterResourceManager.Callback callback = mock(ClusterResourceManager.Callback.class); YarnClusterResourceManager yarnClusterResourceManager = new YarnClusterResourceManager(asyncClient, asyncNMClient, callback, yarnAppState, lifecycle, service, metrics, yarnConfiguration, config); yarnClusterResourceManager.onShutdownRequest(); verify(lifecycle, times(1)).onShutdown(SamzaApplicationState.SamzaAppStatus.FAILED); verify(asyncClient, times(1)).stop(); verify(asyncNMClient, times(1)).stop(); verify(service, times(1)).onShutdown(); verify(metrics, times(1)).stop(); }</code><technical_language>add cases for unregister throwing exceptions too</technical_language>

Target:
public void testAMShutdownOnRMCallback() throws IOException, YarnException { YarnConfiguration yarnConfiguration = mock(YarnConfiguration.class); SamzaAppMasterMetrics metrics = mock(SamzaAppMasterMetrics.class); Config config = mock(Config.class); AMRMClientAsync asyncClient = mock(AMRMClientAsync.class); YarnAppState yarnAppState = new YarnAppState(0, mock(ContainerId.class), "host", 8080, 8081); SamzaYarnAppMasterLifecycle lifecycle = Mockito.spy(new SamzaYarnAppMasterLifecycle(512, 2, mock(SamzaApplicationState.class), yarnAppState, asyncClient)); SamzaYarnAppMasterService service = mock(SamzaYarnAppMasterService.class); NMClientAsync asyncNMClient = mock(NMClientAsync.class); ClusterResourceManager.Callback callback = mock(ClusterResourceManager.Callback.class); YarnClusterResourceManager yarnClusterResourceManager = new YarnClusterResourceManager(asyncClient, asyncNMClient, callback, yarnAppState, lifecycle, service, metrics, yarnConfiguration, config); yarnClusterResourceManager.onShutdownRequest(); verify(lifecycle, times(1)).onShutdown(SamzaApplicationState.SamzaAppStatus.FAILED); verify(asyncClient, times(1)).unregisterApplicationMaster(FinalApplicationStatus.FAILED, null, null); verify(asyncClient, times(1)).stop(); verify(asyncNMClient, times(1)).stop(); verify(service, times(1)).onShutdown(); verify(metrics, times(1)).stop(); }
Source:
<code>private Host resolveSite(final PageContext context, final HttpServletRequest request) throws DotDataException, DotSecurityException { final User user = context.getUser(); final PageMode mode = context.getPageMode(); Host site = this.getHostFromRequest(request, user, mode); if (site == null) { site = this.getHostFromSession(request, user, mode); } <START> System.out.println("site = " + site); <END> System.out.println("request = " + request.getServerName()); return site != null ? site : this.hostAPI.resolveHostName(request.getServerName(), user, mode.respectAnonPerms) ; }</code><technical_language>This line removed</technical_language>

Target:
private Host resolveSite(final PageContext context, final HttpServletRequest request) throws DotDataException, DotSecurityException { final User user = context.getUser(); final PageMode mode = context.getPageMode(); Optional<Host> optionalSite = this.getHostFromRequest(request, user, mode); if (!optionalSite.isPresent()) { optionalSite = this.getHostFromSession(request, user, mode); } return optionalSite.isPresent() ? optionalSite.get() : this.hostAPI.resolveHostName(request.getServerName(), user, mode.respectAnonPerms) ; }
Source:
<code>public void removeTasksOlderThan(final long timestamp) { connector.retryWithHandle( (HandleCallback<Void>) handle -> { <START> DateTime createdTime = DateTimes.utc(timestamp); <END> log.info("Deleting tasks before [%s] and inactive at metastore.", createdTime.toString()); handle.createStatement( StringUtils.format( getSqlRemoveLogsOlderThan(), logTable, entryTable ) ) .bind("created_date", createdTime.toString()) .execute(); handle.createStatement( StringUtils.format( "DELETE FROM %s WHERE created_date < :created_date AND active = false", entryTable ) ) .bind("created_date", createdTime.toString()) .execute(); return null; } ); }</code><technical_language>I do this variable name, a time point a created time. DateTime dateTime = DateTimes.utc(timestamp);</technical_language>

Target:
public void removeTasksOlderThan(final long timestamp) { DateTime dateTime = DateTimes.utc(timestamp); connector.retryWithHandle( (HandleCallback<Void>) handle -> { handle.createStatement(getSqlRemoveLogsOlderThan()) .bind("date_time", dateTime.toString()) .execute(); handle.createStatement( StringUtils.format( "DELETE FROM %s WHERE created_date < :date_time AND active = false", entryTable ) ) .bind("date_time", dateTime.toString()) .execute(); return null; } ); }
Source:
<code>protected String getCommitID(String repositoryId, Version version) { RefsApi refsApi = new RefsApi(apiClient); try { Branch branch = refsApi.repositoriesUsernameRepoSlugRefsBranchesNameGet(repositoryId.split("/")[0], version.getReference(), repositoryId.split("/")[1]); if (branch != null) { return branch.getTarget().getHash(); } } catch (ApiException e) { <START> LOG.error(gitUsername + ": apiexception on reading branch commitid" + e.getMessage()); <END> } try { Tag tag = refsApi.repositoriesUsernameRepoSlugRefsTagsNameGet(repositoryId.split("/")[0], version.getReference(), repositoryId.split("/")[1]); if (tag != null) { return tag.getTarget().getHash(); } } catch (ApiException e) { LOG.error(gitUsername + ": apiexception on reading tag commitid" + e.getMessage()); } return null; }</code><technical_language>Log exception</technical_language>

Target:
protected String getCommitID(String repositoryId, Version version) { RefsApi refsApi = new RefsApi(apiClient); try { Branch branch = refsApi.repositoriesUsernameRepoSlugRefsBranchesNameGet(repositoryId.split("/")[0], version.getReference(), repositoryId.split("/")[1]); if (branch != null) { return branch.getTarget().getHash(); } } catch (ApiException ex) { LOG.error(gitUsername + ": apiexception on reading branch commitid", ex); } try { Tag tag = refsApi.repositoriesUsernameRepoSlugRefsTagsNameGet(repositoryId.split("/")[0], version.getReference(), repositoryId.split("/")[1]); if (tag != null) { return tag.getTarget().getHash(); } } catch (ApiException ex) { LOG.error(gitUsername + ": apiexception on reading tag commitid", ex); } return null; }
Source:
<code><START> public Pair<T, K> getPair() { <END> return pair == null ? new Pair<T, K>(null, null) : pair; }</code><technical_language>this method private</technical_language>

Target:
private Pair<T, K> getPair() { if (pair == null) { pair = new Pair<T, K>(null, null); } return pair; }
Source:
<code>public BAMIndexer(final OutputStream output, final SAMFileHeader fileHeader) { if (fileHeader.getSortOrder() != SAMFileHeader.SortOrder.coordinate) { <START> throw new SAMException("BAM file be coordinate-sorted for indexing."); <END> } numReferences = fileHeader.getSequenceDictionary().size(); indexBuilder = new BAMIndexBuilder(fileHeader.getSequenceDictionary()); outputWriter = new BinaryBAMIndexWriter(numReferences, output); }</code><technical_language>constructors some logic in I good refactor call out a private constructor takes a BinaryBAMIndexWriter</technical_language>

Target:
public BAMIndexer(final OutputStream output, final SAMFileHeader fileHeader) { this(fileHeader, numRefs -> new BinaryBAMIndexWriter(numRefs, output)); }
Source:
<code>public void testAggregationsSum() { String formula = "fn:sum({{" + TERM_1 + "}})"; final Map<String, Object> terms = new HashMap<>(); final HashMap<String, List<Object>> data = new HashMap<>(); final List<Object> termData = new ArrayList<>(); termData.add(new BigDecimal(5.5)); termData.add(new BigDecimal(45)); termData.add(new BigDecimal(12.2)); data.put(wrapTerm(String.valueOf(TERM_1)), termData); formula = replaceDelimiters(formula); this.processor.setData(data); String result = this.processor.evaluateFormula(formula, terms); Assert.assertEquals("Should evaluate avg function", "62.7", result); formula = "fn:sum({{" + TERM_1 + "}}, {{PH_M_cm}})"; final List<Object> term2Data = new ArrayList<>(); term2Data.add(new BigDecimal(14.23)); term2Data.add(new BigDecimal(134.12)); data.put(wrapTerm("PH_M_cm"), term2Data); formula = replaceDelimiters(formula); this.processor = new DerivedVariableProcessor(); this.processor.setData(data); result = this.processor.evaluateFormula(formula, terms); <START> Assert.assertEquals("Should evaluate avg function", "211.05", result); <END> }</code><technical_language>@mderamos modify assertion description appropriately</technical_language>

Target:
public void testAggregationsSum() { String formula = "fn:sum({{" + TERM_1 + "}})"; final Map<String, Object> terms = new HashMap<>(); final HashMap<String, List<Object>> data = new HashMap<>(); final List<Object> termData = new ArrayList<>(); termData.add(new BigDecimal(5.5)); termData.add(new BigDecimal(45)); termData.add(new BigDecimal(12.2)); data.put(wrapTerm(String.valueOf(TERM_1)), termData); formula = replaceDelimiters(formula); this.processor.setData(data); String result = this.processor.evaluateFormula(formula, terms); Assert.assertEquals("Should evaluate sum function", "62.7", result); formula = "fn:sum({{" + TERM_1 + "}}, {{PH_M_cm}})"; final List<Object> term2Data = new ArrayList<>(); term2Data.add(new BigDecimal(14.23)); term2Data.add(new BigDecimal(134.12)); data.put(wrapTerm("PH_M_cm"), term2Data); formula = replaceDelimiters(formula); this.processor = new DerivedVariableProcessor(); this.processor.setData(data); result = this.processor.evaluateFormula(formula, terms); Assert.assertEquals("Should evaluate sum function", "211.05", result); }