auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static String process(String origin) { Document doc = Jsoup.parse(origin); Elements components = doc.select("[bennu-component]"); for (Element component : components) { String key = component.attr("bennu-component"); <START> Element result = COMPONENTS.get(key).process(component); <END> component.replaceWith(result); } return doc.toString(); }</code><technical_language>gracefully handle a definition of a missing component. This NPE</technical_language>

Target:
public static String process(String origin) { Document doc = Jsoup.parse(origin); Elements components = doc.select("[bennu-component]"); for (Element component : components) { String key = component.attr("bennu-component"); Optional.ofNullable(COMPONENTS.get(key)).ifPresent(x -> component.replaceWith(x.process(component))); } return doc.toString(); }
Source:
<code>public boolean apply(ServerConfiguration conf, Flags cmdFlags) { ServerConfiguration bfconf = new ServerConfiguration(conf); boolean result = Bookie.format(bfconf, cmdFlags.nonInteractive, cmdFlags.force); if (cmdFlags.deleteCookie) { try { runFunctionWithRegistrationManager(conf, rm -> { try { Versioned<Cookie> cookie = Cookie.readFromRegistrationManager(rm, bfconf); cookie.getValue().deleteFromRegistrationManager(rm, bfconf, cookie.getVersion()); } catch (BookieException.CookieNotFoundException nne) { LOG.warn("No cookie to remove : ", nne); } catch (BookieException e) { <START> e.printStackTrace(); <END> } return null; }); } catch (MetadataException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } return result; }</code><technical_language>this shallow exception. I suggest throw new UncheckedExecutionException(be.getMessage(), be);</technical_language>

Target:
public boolean apply(ServerConfiguration conf, Flags cmdFlags) { ServerConfiguration bfconf = new ServerConfiguration(conf); boolean result = Bookie.format(bfconf, cmdFlags.nonInteractive, cmdFlags.force); if (cmdFlags.deleteCookie) { try { runFunctionWithRegistrationManager(conf, rm -> { try { Versioned<Cookie> cookie = Cookie.readFromRegistrationManager(rm, bfconf); cookie.getValue().deleteFromRegistrationManager(rm, bfconf, cookie.getVersion()); } catch (Exception e) { throw new UncheckedExecutionException(e.getMessage(), e); } return null; }); } catch (MetadataException | ExecutionException e) { throw new UncheckedExecutionException(e.getMessage(), e); } } return result; }
Source:
<code>static public Collection<AutoScalingTag> getTagsForDelete(AutoScalingTag[] all, Tag[] tags) { Collection<AutoScalingTag> result = null; <START> if (all != null) { <END> result = new ArrayList<AutoScalingTag>(); for (AutoScalingTag tag : all) { if (!TagUtils.isKeyInTags(tag.getKey(), tags)) { result.add(tag); } } } return result; }</code><technical_language>a conventions in dasein: - for collection return types T[] Iterable<T>, - returning collection return a null, empty array empty iterable; - strive static code analysis tools relevant annotations parameters return values of public methods, this helps driver implementors a great deal; code, return of getTagsForDelete converted array a calling method, return AutoScalingTag[] this method do conversion source</technical_language>

Target:
static public AutoScalingTag[] getTagsForDelete( AutoScalingTag[] all, Tag[] tags ) { Collection<AutoScalingTag> result = new ArrayList<AutoScalingTag>(); if( all != null ) { for( AutoScalingTag tag : all ) { if( !TagUtils.isKeyInTags(tag.getKey(), tags) ) { result.add(tag); } } } return result.toArray(new AutoScalingTag[result.size()]); }
Source:
<code>public void doPolling(Guid cmdId, List<Guid> childCmdIds) { DestroyImageCommand<DestroyImageParameters> command = commandCoordinatorUtil.retrieveCommand(cmdId); ArrayList<Guid> taskIds = command.getReturnValue().getVdsmTaskIdList(); <START> ArrayList<AsyncTaskStatus> <END> taskStatuses = commandCoordinatorUtil.pollTasks(taskIds); for (AsyncTaskStatus status : taskStatuses) { if (status.getTaskIsRunning()) { log.info("Waiting on destroy image command to complete."); return; } } command.setSucceeded(true); command.setCommandStatus(CommandStatus.SUCCEEDED); command.persistCommand(command.getParameters().getParentCommand()); log.info("Destroy image command has completed."); }</code><technical_language>this List I</technical_language>

Target:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { DestroyImageCommand<DestroyImageParameters> command = commandCoordinatorUtil.retrieveCommand(cmdId); Set<Guid> taskIds = new HashSet<>(command.getReturnValue().getVdsmTaskIdList()); Map<Guid, AsyncTaskStatus> idToStatusMap = commandCoordinatorUtil.pollTasks(taskIds); for (Map.Entry<Guid, AsyncTaskStatus> idToStatus : idToStatusMap.entrySet()) { final Guid id = idToStatus.getKey(); final AsyncTaskStatus status = idToStatus.getValue(); if (status.getTaskIsRunning()) { log.info("Waiting on destroy image command to complete the task (taskId = {})", id); return; } } List<Guid> failed = new ArrayList<>(); for (Map.Entry<Guid, AsyncTaskStatus> idToStatus : idToStatusMap.entrySet()) { final Guid id = idToStatus.getKey(); final AsyncTaskStatus status = idToStatus.getValue(); if (!status.getTaskEndedSuccessfully()) { failed.add(id); } } if (failed.isEmpty()) { command.setSucceeded(true); command.setCommandStatus(CommandStatus.SUCCEEDED); command.persistCommand(command.getParameters().getParentCommand()); log.info("Destroy image command has completed successfully for images '{}' with async tasks '{}'.", command.getParameters().getImageList(), taskIds); } else { command.setSucceeded(false); command.setCommandStatus(CommandStatus.FAILED); log.info("Destroy image command has failed for images '{}' with async tasks '{}'.", command.getParameters().getImageList(), failed); } command.persistCommand(command.getParameters().getParentCommand()); }
Source:
<code>public void postCollectionAdminGroupCreateAdminGroupForbidden() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isForbidden()); <START> <END> }</code><technical_language>double check group created a get</technical_language>

Target:
public void postCollectionAdminGroupCreateAdminGroupForbidden() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isForbidden()); token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isNoContent()); }
Source:
<code>private void initialize() { viewModel = new ParseTexDialogViewModel(databaseContext, dialogService, taskExecutor, preferencesService); fileTreeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); fileTreeView.showRootProperty().bindBidirectional(viewModel.successfulSearchProperty()); fileTreeView.rootProperty().bind(EasyBind.map(viewModel.rootProperty(), fileNode -> new RecursiveTreeItem<>(fileNode, FileNodeViewModel::getChildren))); EasyBind.subscribe(fileTreeView.rootProperty(), root -> { if (root != null) { ((CheckBoxTreeItem<FileNodeViewModel>) root).setSelected(true); root.setExpanded(true); <START> EasyBind.listBind(viewModel.getCheckedFileList(), fileTreeView.getCheckModel().getCheckedItems()); <END> } }); new ViewModelTreeCellFactory<FileNodeViewModel>() .withText(FileNodeViewModel::getDisplayText) .install(fileTreeView); texDirectoryField.textProperty().bindBidirectional(viewModel.texDirectoryProperty()); browseButton.disableProperty().bindBidirectional(viewModel.searchInProgressProperty()); searchButton.disableProperty().bindBidirectional(viewModel.searchInProgressProperty()); selectAllButton.disableProperty().bindBidirectional(viewModel.noFilesFoundProperty()); unselectAllButton.disableProperty().bindBidirectional(viewModel.noFilesFoundProperty()); }</code><technical_language>Is necessary listBind statement in root change listener (instead of a one-time binding for example showRootProperty</technical_language>

Target:
private void initialize() { viewModel = new ParseTexDialogViewModel(databaseContext, dialogService, taskExecutor, preferencesService); fileTreeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); fileTreeView.showRootProperty().bindBidirectional(viewModel.successfulSearchProperty()); fileTreeView.rootProperty().bind(EasyBind.map(viewModel.rootProperty(), fileNode -> new RecursiveTreeItem<>(fileNode, FileNodeViewModel::getChildren))); EasyBind.subscribe(fileTreeView.rootProperty(), root -> { ((CheckBoxTreeItem<FileNodeViewModel>) root).setSelected(true); root.setExpanded(true); EasyBind.listBind(viewModel.getCheckedFileList(), fileTreeView.getCheckModel().getCheckedItems()); }); new ViewModelTreeCellFactory<FileNodeViewModel>() .withText(FileNodeViewModel::getDisplayText) .install(fileTreeView); texDirectoryField.textProperty().bindBidirectional(viewModel.texDirectoryProperty()); validationVisualizer.setDecoration(new IconValidationDecorator()); validationVisualizer.initVisualization(viewModel.texDirectoryValidation(), texDirectoryField); browseButton.disableProperty().bindBidirectional(viewModel.searchInProgressProperty()); searchButton.disableProperty().bind(viewModel.texDirectoryValidation().validProperty().not()); selectAllButton.disableProperty().bindBidirectional(viewModel.noFilesFoundProperty()); unselectAllButton.disableProperty().bindBidirectional(viewModel.noFilesFoundProperty()); progressIndicator.visibleProperty().bindBidirectional(viewModel.searchInProgressProperty()); }
Source:
<code>private static Decimal toHiveDecimal(Object objectValue, int scale) { <START> double value; <END> if (objectValue instanceof Double) { value = (double) objectValue; } else if (objectValue instanceof Integer) { value = (int) objectValue; } else { throw new IllegalStateException("Unsupported decimal representation type: " + objectValue.getClass()); } BigInteger bigInteger = BigInteger.valueOf(Math.round(value * scale)); return new Decimal(ByteBuffer.wrap(bigInteger.toByteArray()), checkedCast(scale)); }</code><technical_language>((Number)objectValue).toDouble()</technical_language>

Target:
private static Decimal toHiveDecimal(Object objectValue, int scale) { double value = ((Number) objectValue).doubleValue(); BigInteger bigInteger = BigInteger.valueOf(Math.round(value * scale)); return new Decimal(ByteBuffer.wrap(bigInteger.toByteArray()), checkedCast(scale)); }
Source:
<code>public void testApplyEmptyOrNull() { Assert.assertEquals(null, loadingLookup.apply(null)); <START> if (!NullHandling.replaceWithDefault()) { <END> Assert.assertEquals(null, loadingLookup.apply("")); } }</code><technical_language>This is NullHandling.sqlCompatible()</technical_language>

Target:
public void testApplyEmptyOrNull() { Assert.assertEquals(null, loadingLookup.apply(null)); if (NullHandling.sqlCompatible()) { Assert.assertEquals(null, loadingLookup.apply("")); } }
Source:
<code>public static IContainerDMContext[] getContainerContexts() throws InterruptedException, ExecutionException, TimeoutException { assert!fProcessesService.getExecutor().isInExecutorThread(); Query<IContainerDMContext[]> query = new Query<IContainerDMContext[]>() { @Override protected void execute(final DataRequestMonitor<IContainerDMContext[]> rm) { fProcessesService.getProcessesBeingDebugged(fGdbControl.getContext(), new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleSuccess() { <START> if (isSuccess()) { <END> IDMContext[] contexts = getData(); rm.done((IContainerDMContext[]) contexts); } } }); } }; fGdbControl.getExecutor().execute(query); return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); }</code><technical_language>I suppose if handleSuccess is called, isSuccess is true</technical_language>

Target:
public static IContainerDMContext[] getContainerContexts() throws InterruptedException, ExecutionException, TimeoutException { assert!fProcessesService.getExecutor().isInExecutorThread(); Query<IContainerDMContext[]> query = new Query<IContainerDMContext[]>() { @Override protected void execute(final DataRequestMonitor<IContainerDMContext[]> rm) { fProcessesService.getProcessesBeingDebugged(fGdbControl.getContext(), new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleSuccess() { IDMContext[] contexts = getData(); rm.done((IContainerDMContext[]) contexts); } }); } }; fGdbControl.getExecutor().execute(query); return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); }
Source:
<code>private void startDiscovery() { <START> log.info("Shard organizer start discovery, organizationDiscoveryIntervalMillis: %s", organizationDiscoveryIntervalMillis); <END> discoveryService.scheduleWithFixedDelay(() -> { try { SECONDS.sleep(ThreadLocalRandom.current().nextLong(1, organizationDiscoveryIntervalMillis / 1000)); log.info("Running shard organizer..."); submitJobs(discoverAndInitializeTablesToOrganize()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { log.error(t, "Error running shard organizer"); } }, 0, organizationDiscoveryIntervalMillis, TimeUnit.MILLISECONDS); }</code><technical_language>nit: need print out organizationDiscoveryIntervalMillis</technical_language>

Target:
private void startDiscovery() { discoveryService.scheduleWithFixedDelay(() -> { try { SECONDS.sleep(ThreadLocalRandom.current().nextLong(1, organizationDiscoveryIntervalMillis)); log.info("Running shard organizer..."); submitJobs(discoverAndInitializeTablesToOrganize()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { log.error(t, "Error running shard organizer"); } }, 0, organizationDiscoveryIntervalMillis, TimeUnit.MILLISECONDS); }
Source:
<code><START> static AwsDates fromXAmzDate(String xAmzDate) { <END> return new AwsDates(xAmzDate, xAmzDate, xAmzDate.substring(0, 8)); }</code><technical_language>date validated. Do good here</technical_language>

Target:
static AwsDates fromXAmzDate(String xAmzDate) throws ParseException { new SimpleDateFormat(AwsDates.X_AMZ_DATE_FORMAT).parse(xAmzDate); return new AwsDates(xAmzDate); }
Source:
<code>private Set<InsightCard.Category> getRecentInsightsCategories(final Long accountId) { <START> final DateTime aWeekAgo = DateTime.now(DateTimeZone.UTC).minusDays(14); <END> final Boolean chronological = true; final List<InsightCard> cards = this.insightsDAODynamoDB.getInsightsByDate(accountId, aWeekAgo, chronological, RECENT_DAYS); final Set<InsightCard.Category> seenCategories = new HashSet<>(); for (InsightCard card : cards) { seenCategories.add(card.category); } return seenCategories; }</code><technical_language>'aWeekAgo' a variable name is misleading. Also, this subtracting 6 days (one week - 1), is subtracting 14. need 13 is this correct</technical_language>

Target:
private Set<InsightCard.Category> getRecentInsightsCategories(final Long accountId) { final DateTime twoWeeksAgo = DateTime.now(DateTimeZone.UTC).minusDays(13); final Boolean chronological = true; final List<InsightCard> cards = this.insightsDAODynamoDB.getInsightsByDate(accountId, twoWeeksAgo, chronological, RECENT_DAYS); final Set<InsightCard.Category> seenCategories = new HashSet<>(); for (InsightCard card : cards) { seenCategories.add(card.category); } return seenCategories; }
Source:
<code>public void setUp() throws Exception { super.setUp(); if (SystemUtils.IS_OS_LINUX) { try { eventLoopGroup = new EpollEventLoopGroup(); <START> } catch (Exception e) { <END> LOG.warn("Could not use Netty Epoll event loop"); eventLoopGroup = new NioEventLoopGroup(); } } else { eventLoopGroup = new NioEventLoopGroup(); } executor = OrderedSafeExecutor.newBuilder() .name("BKClientOrderedSafeExecutor") .numThreads(2) .build(); }</code><technical_language>catch (Throwable) Exception, do in other parts. a common utility function create EventLoopGroups in fact running native epoll support libraries library path test fail</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); if (SystemUtils.IS_OS_LINUX) { try { eventLoopGroup = new EpollEventLoopGroup(); } catch (Throwable t) { LOG.warn("Could not use Netty Epoll event loop {}", t.getMessage()); eventLoopGroup = new NioEventLoopGroup(); } } else { eventLoopGroup = new NioEventLoopGroup(); } executor = OrderedSafeExecutor.newBuilder() .name("BKClientOrderedSafeExecutor") .numThreads(2) .build(); }
Source:
<code>public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (elementId: "); result.append(elementId); <START> if(tags != null){ <END> result.append(", tags: "); result.append(tags); } if(contributorURI != null){ result.append(", contributorURI: "); result.append(contributorURI); } if(persistedState != null){ result.append(", persistedState: "); result.append(persistedState); } if(transientData != null && !transientData.isEmpty()){ result.append(", transientData: "); result.append(transientData); } result.append(')'); return result.toString(); }</code><technical_language>This is generated code, please remove this adjust EMF code generator</technical_language>

Target:
public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (elementId: "); result.append(elementId); result.append(", tags: "); result.append(tags); result.append(", contributorURI: "); result.append(contributorURI); result.append(')'); return result.toString(); }
Source:
<code>private Collection<EStructuralFeature.Setting> safGetNonNavigableInverseReferences(EObject eObject, ECrossReferenceAdapter crossReferencer) { <START> final Collection<EStructuralFeature.Setting> originInverseReference; <END> if (eObject != null) { originInverseReference = crossReferencer.getNonNavigableInverseReferences(eObject, false); } else { originInverseReference = ImmutableList.of(); } return originInverseReference; }</code><technical_language>"origin"</technical_language>

Target:
private Collection<EStructuralFeature.Setting> safGetNonNavigableInverseReferences(EObject eObject, ECrossReferenceAdapter crossReferencer) { final Collection<EStructuralFeature.Setting> inverseReference; if (eObject != null) { inverseReference = crossReferencer.getNonNavigableInverseReferences(eObject, false); } else { inverseReference = ImmutableList.of(); } return inverseReference; }
Source:
<code>void dropTables(final Set<TableReference> tablesToDrop) { try { clientPool.runWithRetry(client -> { KsDef ks = client.describe_keyspace(config.getKeyspaceOrThrow()); Set<TableReference> existingTables = Sets.newHashSet(); existingTables.addAll(ks.getCf_defs().stream() .map(CassandraKeyValueServices::tableReferenceFromCfDef) .collect(Collectors.toList())); for (TableReference table : tablesToDrop) { CassandraVerifier.sanityCheckTableName(table); if (existingTables.contains(table)) { cassandraTableTruncator.runTruncateOnClient(ImmutableSet.of(table), client); client.system_drop_column_family(CassandraKeyValueServiceImpl.internalTableName(table)); updateMetadataForTable(table); } else { log.warn("Ignored call to drop a table ({}) that did not exist.", LoggingArgs.tableRef(table)); } } <START> CassandraKeyValueServices.waitForSchemaVersions(config, client, "after dropping the column " <END> + "family for tables " + tablesToDrop + " in a call to drop tables"); return null; }); } catch (Exception e) { throw Throwables.unwrapAndThrowAtlasDbDependencyException(e); } }</code><technical_language>I if wrapping drop/create call this (both sides of individual resource level). more like: for (TableReference table: tablesToDrop) { // wait for schema versions // drop table // wait for schema versions }</technical_language>

Target:
void dropTables(final Set<TableReference> tablesToDrop) { try { clientPool.runWithRetry(client -> { KsDef ks = client.describe_keyspace(config.getKeyspaceOrThrow()); Set<TableReference> existingTables = Sets.newHashSet(); existingTables.addAll(ks.getCf_defs().stream() .map(CassandraKeyValueServices::tableReferenceFromCfDef) .collect(Collectors.toList())); for (TableReference table : tablesToDrop) { CassandraVerifier.sanityCheckTableName(table); if (existingTables.contains(table)) { CassandraKeyValueServices.runWithWaitingForSchemas( () -> truncateThenDrop(table, client), config, client, "dropping the column family for table " + table + " in a call to drop tables"); deleteAtlasMetadataForTable(table); } else { log.warn("Ignored call to drop a table ({}) that did not exist.", LoggingArgs.tableRef(table)); } } return null; }); } catch (Exception e) { throw Throwables.unwrapAndThrowAtlasDbDependencyException(e); } }
Source:
<code>private void log(Environment result) { logger.info(String.format("Located environment: name=%s, profiles=%s, label=%s, version=%s, state=%s", result.getName(), result.getProfiles() == null ? "" : Arrays.asList(result.getProfiles()), result.getLabel(), result.getVersion(), result.getState())); if (logger.isDebugEnabled()) { <START> List<PropertySource> propertySourceList = result.getPropertySources(); <END> if (propertySourceList != null) { int propertyCount = 0; for (PropertySource propertySource: propertySourceList) { propertyCount += propertySource.getSource().size(); } logger.debug(String.format("Environment %s has %d property sources with %d properties.", result.getName(), result.getPropertySources().size(), propertyCount)); } } }</code><technical_language>Tabs, spaces</technical_language>

Target:
private void log(Environment result) { if (logger.isInfoEnabled()) { logger.info(String.format("Located environment: name=%s, profiles=%s, label=%s, version=%s, state=%s", result.getName(), result.getProfiles() == null ? "" : Arrays.asList(result.getProfiles()), result.getLabel(), result.getVersion(), result.getState())); } if (logger.isDebugEnabled()) { List<PropertySource> propertySourceList = result.getPropertySources(); if (propertySourceList != null) { int propertyCount = 0; for (PropertySource propertySource: propertySourceList) { propertyCount += propertySource.getSource().size(); } logger.debug(String.format("Environment %s has %d property sources with %d properties.", result.getName(), result.getPropertySources().size(), propertyCount)); } } }
Source:
<code>public void mustRecommendHeapMemory() { assertThat( recommendHeapMemory( mebiBytes( 100 ) ), between( mebiBytes( 45 ), mebiBytes( 55 ) ) ); assertThat( recommendHeapMemory( gibiBytes( 1 ) ), between( mebiBytes( 450 ), mebiBytes( 550 ) ) ); assertThat( recommendHeapMemory( gibiBytes( 3 ) ), between( mebiBytes( 1256 ), mebiBytes( 1356 ) ) ); assertThat( recommendHeapMemory( gibiBytes( 6 ) ), between( mebiBytes( 3000 ), mebiBytes( 3200 ) ) ); assertThat( recommendHeapMemory( gibiBytes( 192 ) ), between( gibiBytes( 31 ), gibiBytes( 33 ) ) ); <START> assertThat( recommendHeapMemory( gibiBytes( 1920 ) ), between( gibiBytes( 31 ), gibiBytes( 33 ) ) ); <END> }</code><technical_language>numbers? (I ask 2 people recommend thing)</technical_language>

Target:
public void mustRecommendHeapMemory() { assertThat( recommendHeapMemory( mebiBytes( 100 ) ), between( mebiBytes( 45 ), mebiBytes( 55 ) ) ); assertThat( recommendHeapMemory( gibiBytes( 1 ) ), between( mebiBytes( 450 ), mebiBytes( 550 ) ) ); assertThat( recommendHeapMemory( gibiBytes( 3 ) ), between( mebiBytes( 1256 ), mebiBytes( 1356 ) ) ); assertThat( recommendHeapMemory( gibiBytes( 6 ) ), between( mebiBytes( 3000 ), mebiBytes( 3200 ) ) ); assertThat( recommendHeapMemory( gibiBytes( 192 ) ), between( gibiBytes( 30 ), gibiBytes( 32 ) ) ); assertThat( recommendHeapMemory( gibiBytes( 1920 ) ), between( gibiBytes( 30 ), gibiBytes( 32 ) ) ); }
Source:
<code>public void createFHIRCondition_shouldReturnCreatedFHIRCondition() { Condition condition = new Condition(); IdType id = new IdType(); id.setValue(CONDITION_UUID); condition.setId(id); Patient patientRef = Context.getPatientService().getPatient(2); Reference patient = FHIRUtils.buildPatientOrPersonResourceReference(patientRef); condition.setSubject(patient); condition.setClinicalStatus(Condition.ConditionClinicalStatus.ACTIVE); condition.setCode(new CodeableConcept().addCoding( new Coding().setCode("999").setDisplay("NO").setSystem(FHIRConstants.OPENMRS_URI)).setText("NO")); <START> Condition justCreatedCondition = getService().createFHIRCondition(condition); <END> assertNotNull(justCreatedCondition); assertEquals(justCreatedCondition.getSubject().getReference(), patient.getReference()); assertEquals(justCreatedCondition.getClinicalStatus(), Condition.ConditionClinicalStatus.ACTIVE); assertEquals(justCreatedCondition.getOnset(), condition.getOnset()); }</code><technical_language>improve this test fetching saved condition instead of simply return value? way, catch problem of save method returning give saving it</technical_language>

Target:
public void createFHIRCondition_shouldReturnCreatedFHIRCondition() { Condition condition = new Condition(); IdType id = new IdType(); id.setValue(CONDITION_UUID); condition.setId(id); Patient patientRef = Context.getPatientService().getPatient(2); Reference patient = FHIRUtils.buildPatientOrPersonResourceReference(patientRef); condition.setSubject(patient); condition.setClinicalStatus(Condition.ConditionClinicalStatus.ACTIVE); condition.setCode(new CodeableConcept().addCoding( new Coding().setCode("999").setDisplay("NO").setSystem(FHIRConstants.OPENMRS_URI)).setText("NO")); Condition justCreatedCondition = getService().createFHIRCondition(condition); Condition getSavedCondition = getService().getConditionByUuid(justCreatedCondition.getId()); assertNotNull(justCreatedCondition); assertEquals(justCreatedCondition.getSubject().getReference(), patient.getReference()); assertEquals(justCreatedCondition.getClinicalStatus(), Condition.ConditionClinicalStatus.ACTIVE); assertEquals(justCreatedCondition.getOnset(), condition.getOnset()); assertNotNull(getSavedCondition); assertEquals(justCreatedCondition.getId(), getSavedCondition.getId()); assertEquals(justCreatedCondition.getClinicalStatus(), getSavedCondition.getClinicalStatus()); assertEquals(justCreatedCondition.getOnset(), getSavedCondition.getOnset()); }
Source:
<code>private Throwable mapError(Throwable throwable, ServiceBusErrorSource errorSource) { <START> if (throwable instanceof ServiceBusAmqpException) { <END> return throwable; } if (throwable instanceof AmqpException) { return new ServiceBusAmqpException((AmqpException) throwable, errorSource); } else { return throwable; } }</code><technical_language>This condensed. java if ((throwable instanceof ServiceBusAmqpException) || !(throwable instanceof AmqpException)) { return throwable; } return new ServiceBusAmqpException((AmqpException) throwable, errorSource);</technical_language>

Target:
private Throwable mapError(Throwable throwable, ServiceBusErrorSource errorSource) { if ((throwable instanceof ServiceBusAmqpException) || !(throwable instanceof AmqpException)) { return throwable; } else { return new ServiceBusAmqpException((AmqpException) throwable, errorSource); } }
Source:
<code>public byte[] serialize(final String topic, final Set<Statement> data) { if(data == null) { return null; } <START> final ByteArrayOutputStream boas = new ByteArrayOutputStream(); <END> final RDFWriter writer = WRITER_FACTORY.getWriter(boas); writer.startRDF(); for(final Statement stmt : data) { log.debug("Writing Statement: " + stmt); writer.handleStatement(stmt); } writer.endRDF(); return boas.toByteArray(); }</code><technical_language>change variable name baos</technical_language>

Target:
public byte[] serialize(final String topic, final Set<Statement> data) { if(data == null) { return null; } final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final RDFWriter writer = WRITER_FACTORY.getWriter(baos); writer.startRDF(); for(final Statement stmt : data) { log.debug("Writing Statement: " + stmt); writer.handleStatement(stmt); } writer.endRDF(); return baos.toByteArray(); }
Source:
<code>public List<Ref> getRefsByPrefix(String... prefixes) throws IOException { List<Ref> result = new ArrayList<>(); <START> if (prefixes.length == 0) { <END> result.addAll(getRefsByPrefix(ALL)); } else { for (String prefix : prefixes) { result.addAll(getRefsByPrefix(prefix)); } } return Collections.unmodifiableList(result); }</code><technical_language>Do need this special case? 'else' case unconditionally (so calling getRefsByPrefix(new String[]{}) produce empty list)</technical_language>

Target:
public List<Ref> getRefsByPrefix(String... prefixes) throws IOException { List<Ref> result = new ArrayList<>(); for (String prefix : prefixes) { result.addAll(getRefsByPrefix(prefix)); } return Collections.unmodifiableList(result); }
Source:
<code>public final Object write(final SFileDescriptor file, final long nBytes, final long offset, final SBlock fail) { file.write((int) nBytes, offset, fail); <START> return Nil.nilObject; <END> }</code><technical_language>I is common return written value</technical_language>

Target:
public final Object write(final SFileDescriptor file, final long nBytes, final long offset, final SBlock fail) { file.write((int) nBytes, offset, fail, dispatchHandler); return file; }
Source:
<code>private IncrementalResultsImpl getIncrementalResults(Map<String, Collection<KnowledgeBuilderError>> currentErrors) { IncrementalResultsImpl results = new IncrementalResultsImpl(); for (Map.Entry<String, Collection<KnowledgeBuilderError>> entry : currentErrors.entrySet()) { <START> Collection<KnowledgeBuilderError> previousErrorsInKB = previousErrors.remove(entry.getValue()); <END> for ( KnowledgeBuilderError error : entry.getValue() ) { if ( previousErrorsInKB == null || !previousErrorsInKB.remove( error ) ) { results.addMessage( error, entry.getKey() ); } } if (previousErrorsInKB != null) { for ( KnowledgeBuilderError error : previousErrorsInKB ) { results.removeMessage( error, entry.getKey() ); } } } for (Map.Entry<String, Collection<KnowledgeBuilderError>> entry : previousErrors.entrySet()) { for ( KnowledgeBuilderError error : entry.getValue() ) { results.removeMessage( error, entry.getKey() ); } } return results; }</code><technical_language>question Mike</technical_language>

Target:
private IncrementalResultsImpl getIncrementalResults(Map<String, Collection<KnowledgeBuilderError>> currentErrors) { IncrementalResultsImpl results = new IncrementalResultsImpl(); for (Map.Entry<String, Collection<KnowledgeBuilderError>> entry : currentErrors.entrySet()) { Collection<KnowledgeBuilderError> previousErrorsInKB = previousErrors.remove(entry.getKey()); for ( KnowledgeBuilderError error : entry.getValue() ) { if ( previousErrorsInKB == null || !previousErrorsInKB.remove( error ) ) { results.addMessage( error, entry.getKey() ); } } if (previousErrorsInKB != null) { for ( KnowledgeBuilderError error : previousErrorsInKB ) { results.removeMessage( error, entry.getKey() ); } } } for (Map.Entry<String, Collection<KnowledgeBuilderError>> entry : previousErrors.entrySet()) { for ( KnowledgeBuilderError error : entry.getValue() ) { results.removeMessage( error, entry.getKey() ); } } return results; }
Source:
<code>protected ImmutableValue<Double> getValueGetter() { <START> return new ImmutableSpongeValue<>(this.usedKey, DataConstants.Entity.DEFAULT_ABSORPTION, this.getValue()); <END> }</code><technical_language>cached</technical_language>

Target:
protected ImmutableValue<Double> getValueGetter() { return this.value; }
Source:
<code>public void onReceive(Context context, Intent intent) { final String methodName = ":onReceive"; if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) { Logger.v(TAG + methodName, "Application install message is received"); if (intent != null && intent.getData() != null) { <START> Logger.v(TAG + methodName, "Installing:" + intent.getData().toString()); <END> final String receivedInstalledPackageName = intent.getData().toString(); if (receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME) || receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationSettings.INSTANCE.getBrokerPackageName())) { Logger.v(TAG + methodName, receivedInstalledPackageName + " is installed, start sending request to broker."); String request = getInstallRequestInthisApp(context); if (!StringExtensions.IsNullOrBlank(request)) { resumeRequestInBroker(context, request); } else { Logger.v(TAG + methodName, "No request saved in sharedpreferences, cannot resume broker request."); } } } } }</code><technical_language>Please update log message... installation occurred</technical_language>

Target:
public void onReceive(Context context, Intent intent) { final String methodName = "onReceive"; if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) { Logger.v(TAG + methodName, "Application install message is received"); if (intent != null && intent.getData() != null) { Logger.v(TAG + methodName, "ApplicationReceiver detectes the installation of " + intent.getData().toString()); final String receivedInstalledPackageName = intent.getData().toString(); if (receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME) || receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationSettings.INSTANCE.getBrokerPackageName())) { installedPackageName = receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME)? AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME : AuthenticationConstants.Broker.COMPANY_PORTAL_APP_PACKAGE_NAME; String request = getInstallRequestInthisApp(context); brokerProxy = new BrokerProxy(context); final Date dateTimeForSavedRequest = new Date(getInstallRequestTimeStamp(context)); if (!StringExtensions.IsNullOrBlank(request) && brokerProxy.canSwitchToBroker() && isRequestTimestampValidForResume(dateTimeForSavedRequest)) { Logger.v(TAG + methodName, receivedInstalledPackageName + " is installed, start sending request to broker."); resumeRequestInBroker(context, request); } else { Logger.v(TAG + methodName, "No request saved in sharedpreferences or request already timeout" + ", cannot resume broker request."); } } } } }
Source:
<code>public boolean isBlacklisted(String name) { if (Main.isUnitTest && name.contains("$$EnhancerByMockitoWithCGLIB$$")) { mockOff(); return false; } for (CustomClassFilter f : ExtensionList.lookup(CustomClassFilter.class)) { Boolean r = f.permits(name); if (r != null) { if (r) { LOGGER.log(Level.FINER, "{0} specifies a policy for {1}: {2}", new Object[] {f, name, r}); } else { notifyRejected(null, name, String.format("%s specifies a policy for %s: %s", f, name, r)); } return !r; } } if (ClassFilter.STANDARD.isBlacklisted(name)) { if (SUPPRESS_ALL) { <START> LOGGER.log(Level.WARNING, "would normally reject {0} according to standard blacklist; see <LINK_0>", name); <END> return false; } notifyRejected(null, name, String.format("rejecting %s according to standard blacklist; see <LINK_0>", name)); return true; } else { return false; } }</code><technical_language>inconsistent log stack trace blacklist is suppressed do log if whitelist is suppressed</technical_language>

Target:
public boolean isBlacklisted(String name) { if (Main.isUnitTest && name.contains("$$EnhancerByMockitoWithCGLIB$$")) { mockOff(); return false; } for (CustomClassFilter f : ExtensionList.lookup(CustomClassFilter.class)) { Boolean r = f.permits(name); if (r != null) { if (r) { LOGGER.log(Level.FINER, "{0} specifies a policy for {1}: {2}", new Object[] {f, name, r}); } else { notifyRejected(null, name, String.format("%s specifies a policy for %s: %s", f, name, r)); } return !r; } } if (ClassFilter.STANDARD.isBlacklisted(name)) { if (SUPPRESS_ALL) { notifyRejected(null, name, String.format("would normally reject %s according to standard blacklist; see <LINK_0>", name)); return false; } notifyRejected(null, name, String.format("rejecting %s according to standard blacklist; see <LINK_0>", name)); return true; } else { return false; } }
Source:
<code>public LineParameters(Color c, Double op, Double w, String d){ color = c == null ? Color.BLACK : c; opacity = op == null ? 1.0 : Math.min(1.0, Math.max(0,op)); <START> width = w == null ? .25 : w; <END> dash = d == null || !ParameterUtil.validateDashArray(d)? "" : d; }</code><technical_language>DEFAULT_LINE_WIDTH constant ? unit test</technical_language>

Target:
public LineParameters(Color c, Double op, Double w, String d){ color = c == null ? Color.BLACK : c; opacity = op == null ? SolidFill.DEFAULT_OPACITY : Math.min(1.0, Math.max(0,op)); width = w == null ? PenStroke.DEFAULT_WIDTH : w; dash = d == null || !ParameterUtil.validateDashArray(d)? "" : d; }
Source:
<code>public void testGetBlockDeviceTemplateGroups() { Set<VirtualGuestBlockDeviceTemplateGroup> privateImages = api().getBlockDeviceTemplateGroups(); <START> assertNotNull(privateImages); <END> }</code><technical_language>some assertion check "contents" of returned set</technical_language>

Target:
public void testGetBlockDeviceTemplateGroups() { Set<VirtualGuestBlockDeviceTemplateGroup> privateImages = api().getBlockDeviceTemplateGroups(); assertNotNull(privateImages); for (VirtualGuestBlockDeviceTemplateGroup privateImage : privateImages) { assertTrue(privateImage.getId() > 0, "id must be greater than 0"); assertTrue(privateImage.getStatusId() > 0, "status id must be greater than 0"); assertTrue(privateImage.getAccountId() > 0, "id must be greater than 0"); } }
Source:
<code>public void channelInactiveTest() { HttpRequest request = createRequestWithHeaders(HttpMethod.GET, TestingUri.Close.toString()); ChunkedWriteHandler chunkedWriteHandler = new ChunkedWriteHandler(); EmbeddedChannel channel = new EmbeddedChannel(chunkedWriteHandler); NettyResponseChannel nettyResponseChannel = new NettyResponseChannel(new MockChannelHandlerContext(channel), new NettyMetrics(new MetricRegistry()), new PerformanceConfig(new VerifiableProperties(new Properties())), <START> new NettyConfig(new VerifiableProperties(new Properties()))); <END> channel.disconnect().awaitUninterruptibly(); assertFalse("Channel should be closed", channel.isOpen()); Future<Long> future = nettyResponseChannel.write(Unpooled.buffer(1), null); try { future.get(); fail("Future.get() should throw exception."); } catch (InterruptedException | ExecutionException e) { assertTrue("Should be ClosedChannelException", e.getCause() instanceof ClosedChannelException); } }</code><technical_language>Minor: please create VerifiableProperties multiple times</technical_language>

Target:
public void channelInactiveTest() { HttpRequest request = createRequestWithHeaders(HttpMethod.GET, TestingUri.Close.toString()); ChunkedWriteHandler chunkedWriteHandler = new ChunkedWriteHandler(); EmbeddedChannel channel = new EmbeddedChannel(chunkedWriteHandler); VerifiableProperties verifiableProperties = new VerifiableProperties(new Properties()); NettyResponseChannel nettyResponseChannel = new NettyResponseChannel(new MockChannelHandlerContext(channel), new NettyMetrics(new MetricRegistry()), new PerformanceConfig(verifiableProperties), new NettyConfig(verifiableProperties)); channel.disconnect().awaitUninterruptibly(); assertFalse("Channel should be closed", channel.isOpen()); Future<Long> future = nettyResponseChannel.write(Unpooled.buffer(1), null); try { future.get(); fail("Future.get() should throw exception."); } catch (InterruptedException | ExecutionException e) { assertTrue("Should be ClosedChannelException", e.getCause() instanceof ClosedChannelException); } }
Source:
<code>public boolean isModified(File packFile) { return super.isModified(packFile) || (checksum != MISSING_CHECKSUM <START> && !checksum.equals(readChecksum(packFile))); <END> }</code><technical_language>checksum checking return a more accurate return improve performance. I hoped (also?) improving performance. is adding a check executed super.isModified() returned false. In majority of calls this function packfile unchanged, isModified return false adding a performance penality this dominating case. I hoped checksum check improve situation of false positives returned isModified: situation isModified() returns true return false. isModified() returns true of racy git situation. metadata file is unchanged if lastReadTime lastModificationTime close do return true force a reread of content. instead of re-read re-parse of content I hoped read checksum find out: "The packfile is unchanged checksum is same. need read content." I suggest do like: boolean modified = super.isModified(packFile); if (!modified) { return modified; } // super.isModified() return true. Check checksum // returning file is modified if (checksum != MISSING_CHECKSUM && getModificationReason().lastModifiedChanged && checksum.equals(readChecksum(packFile))) { return false; } return modified;</technical_language>

Target:
public boolean isModified(File packFile) { if (!super.isModified(packFile)) { return false; } if (wasSizeChanged() || wasFileKeyChanged() || !wasLastModifiedRacilyClean()) { return true; } return isChecksumChanged(packFile); }
Source:
<code>public static SAXParser getSAXParser() { try { return SAX_PARSER_FACTORY.newSAXParser(); } catch (Exception e) { <START> throw new XmlBeanDefinitionException("Error occurred using SAXParserFactory to create a SAXParser.", e); <END> } }</code><technical_language>Error occurred while SAXParserFactory create a SAXParser</technical_language>

Target:
public static SAXParser getSAXParser() { try { return SAX_PARSER_FACTORY.newSAXParser(); } catch (Exception e) { throw new XmlBeanDefinitionException("Error occurred while creating a SAXParserFactory from SAXParser.", e); } }
Source:
<code>private RemoteFieldValue[] convertChanges(HashMap<IssueAttribute, String> changes) { Set<IssueAttribute> changedAttributes = new HashSet<IssueAttribute>(changes.keySet()); ArrayList<RemoteFieldValue> remoteFields = new ArrayList<RemoteFieldValue>(); if (changedAttributes.contains(Issue.Field.STATUS)) { Issue.Status status = Issue.Status.valueOf(changes.get(Issue.Field.STATUS)); RemoteFieldValue rfv = new RemoteFieldValue(); rfv.setId("STATUS"); rfv.setValues(new String[]{StatusConverter.fromIssueStatus(status)}); changedAttributes.remove(Issue.Field.STATUS); remoteFields.add(rfv); } if (changedAttributes.contains(Issue.Field.TYPE)) { Issue.Type type = Issue.Type.valueOf(changes.get(Issue.Field.TYPE)); RemoteFieldValue rfv = new RemoteFieldValue(); rfv.setId("issuetype"); rfv.setValues(new String[]{TypeConverter.fromIssueType(type)}); changedAttributes.remove(Issue.Field.TYPE); remoteFields.add(rfv); } if (changedAttributes.contains(Issue.Field.PRIORITY)) { Issue.Priority priority = Issue.Priority.valueOf(changes.get(Issue.Field.PRIORITY)); RemoteFieldValue rfv = new RemoteFieldValue(); rfv.setId("priority"); rfv.setValues(new String[]{PriorityConverter.fromIssuePriority(priority)}); changedAttributes.remove(Issue.Field.PRIORITY); remoteFields.add(rfv); <START> } <END> for (IssueAttribute attribute : changedAttributes) { String targetField = FieldConverter.fromIssueField((Issue.Field) attribute); if (targetField != null) { RemoteFieldValue rfv = new RemoteFieldValue(); rfv.setId("priority"); rfv.setValues(new String[]{changes.get(attribute)}); remoteFields.add(rfv); } } RemoteFieldValue[] remoteFieldArray = new RemoteFieldValue[remoteFields.size()]; remoteFields.toArray(remoteFieldArray); return remoteFieldArray; }</code><technical_language>some code duplication here. solve this more style</technical_language>

Target:
private RemoteFieldValue[] convertChanges(HashMap<IssueAttribute, String> changes) { Set<IssueAttribute> changedAttributes = new HashSet<IssueAttribute>(changes.keySet()); ArrayList<RemoteFieldValue> remoteFields = new ArrayList<RemoteFieldValue>(); for (IssueAttribute attribute : changedAttributes) { String targetField = FieldConverter.fromIssueField((Issue.Field) attribute); String targetValue = JiraValueConverter.convert(changes.get(attribute)); if (targetField != null && targetValue != null) { RemoteFieldValue rfv = new RemoteFieldValue(); rfv.setId(targetField); rfv.setValues(new String[]{targetValue}); remoteFields.add(rfv); } } RemoteFieldValue[] remoteFieldArray = new RemoteFieldValue[remoteFields.size()]; remoteFields.toArray(remoteFieldArray); return remoteFieldArray; }
Source:
<code>protected TestResultSummary run() throws Exception { FilePath workspace = getContext().get(FilePath.class); workspace.mkdirs(); Run<?,?> run = getContext().get(Run.class); TaskListener listener = getContext().get(TaskListener.class); Launcher launcher = getContext().get(Launcher.class); FlowNode node = getContext().get(FlowNode.class); String nodeId = node.getId(); List<FlowNode> enclosingBlocks = getEnclosingStagesAndParallels(node); PipelineTestDetails pipelineTestDetails = new PipelineTestDetails(); pipelineTestDetails.setNodeId(nodeId); pipelineTestDetails.setEnclosingBlocks(getEnclosingBlockIds(enclosingBlocks)); pipelineTestDetails.setEnclosingBlockNames(getEnclosingBlockNames(enclosingBlocks)); try { TestResultAction testResultAction = JUnitResultArchiver.parseAndAttach(step, pipelineTestDetails, run, workspace, launcher, listener); if (testResultAction != null) { int testFailures = testResultAction.getResult().getResultByNode(nodeId).getFailCount(); if (testFailures > 0) { node.addOrReplaceAction(new WarningAction(testFailures + " tests failed")); <START> run.setResult(Result.UNSTABLE); <END> } return new TestResultSummary(testResultAction.getResult().getResultByNode(nodeId)); } } catch (Exception e) { listener.getLogger().println(e.getMessage()); throw e; } return new TestResultSummary(); }</code><technical_language>Another option for WarningAction.onAttached call Run.setResult automatically. other hand I imagine wanting this drastic effect explicit</technical_language>

Target:
protected TestResultSummary run() throws Exception { FilePath workspace = getContext().get(FilePath.class); workspace.mkdirs(); Run<?,?> run = getContext().get(Run.class); TaskListener listener = getContext().get(TaskListener.class); Launcher launcher = getContext().get(Launcher.class); FlowNode node = getContext().get(FlowNode.class); String nodeId = node.getId(); List<FlowNode> enclosingBlocks = getEnclosingStagesAndParallels(node); PipelineTestDetails pipelineTestDetails = new PipelineTestDetails(); pipelineTestDetails.setNodeId(nodeId); pipelineTestDetails.setEnclosingBlocks(getEnclosingBlockIds(enclosingBlocks)); pipelineTestDetails.setEnclosingBlockNames(getEnclosingBlockNames(enclosingBlocks)); try { TestResultAction testResultAction = JUnitResultArchiver.parseAndAttach(step, pipelineTestDetails, run, workspace, launcher, listener); if (testResultAction != null) { TestResult testResult = testResultAction.getResult().getResultByNode(nodeId); int testFailures = testResult.getFailCount(); if (testFailures > 0) { node.addOrReplaceAction(new WarningAction(Result.UNSTABLE).withMessage(testFailures + " tests failed")); run.setResult(Result.UNSTABLE); } return new TestResultSummary(testResult); } } catch (Exception e) { listener.getLogger().println(e.getMessage()); throw e; } return new TestResultSummary(); }
Source:
<code>void stubGetUserBySessionIdQuery() { <START> VdcQueryReturnValue returnValue = new VdcQueryReturnValue(); returnValue.setSucceeded(true); returnValue.setReturnValue(mockUser); <END> when(mockBackend.runQuery( eq(VdcQueryType.GetUserBySessionId), isA(VdcQueryParametersBase.class) )).thenReturn(returnValue); }</code><technical_language>This is a good idea of making VdcQueryReturnValue final. I if worth this small cleanup in a separate patch</technical_language>

Target:
void stubGetUserBySessionIdQuery() { when(mockBackend.runQuery( eq(VdcQueryType.GetUserBySessionId), isA(VdcQueryParametersBase.class) )).thenReturn(new VdcQueryReturnValue() { { setSucceeded(true); setReturnValue(mockUser); } }); }