auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testOptionalRequirements() { TmfAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1_FIELD1), ImmutableSet.of(EVENT1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2), ImmutableSet.of(EVENT1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2), ImmutableSet.of(EVENT1, EVENT2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(Collections.EMPTY_LIST, Collections.EMPTY_LIST); <START> assertFalse(req.isFulfilled(trace)); <END> }</code><technical_language>empty lists, is expected return false? return true</technical_language>

Target:
public void testOptionalRequirements() { TmfAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1, EVENT2), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(checkNotNull(Collections.EMPTY_LIST), checkNotNull(Collections.EMPTY_LIST)); assertTrue(req.isFulfilled(trace)); }
Source:
<code>public final void delegatesSubList() throws Exception { <START> final int fridx = 3; <END> final int toidx = 5; this.list.subList(fridx, toidx); Mockito.verify(this.origin).subList(fridx, toidx); }</code><technical_language>@Happy-Neko call this from, [avoid compound names](<LINK_0></technical_language>

Target:
public final void delegatesSubList() throws Exception { final int from = 3; final int toidx = 5; this.list.subList(from, toidx); Mockito.verify(this.origin).subList(from, toidx); }
Source:
<code>protected Segment getSegment( WorkspaceCache cache ) { ChildReference self = parentReferenceToSelf(cache); <START> if (self == null) { <END> self = parentReferenceToSelf(cache); } return self.getSegment(); }</code><technical_language>this happen ? parentReferenceToSelf(cache) throw a NodeNotFoundInParentException if a reference is</technical_language>

Target:
protected Segment getSegment( WorkspaceCache cache ) { return parentReferenceToSelf(cache).getSegment(); }
Source:
<code><START> private CharSequence getMediaXML() { <END> XmlStringBuilder mediaXML = new XmlStringBuilder(); for (URINode node : uriNodeList) { mediaXML.element(node); } return mediaXML; }</code><technical_language>return XmlStringBuilder here</technical_language>

Target:
private XmlStringBuilder getMediaXML() { XmlStringBuilder mediaXML = new XmlStringBuilder(); for (URINode node : uriNodeList) { mediaXML.element(node); } return mediaXML; }
Source:
<code>@Override public void setCard(@NonNull final MainPageCard card) { super.setCard(card); setLayoutDirectionByWikiSite(card.wikiSite(), containerView); headerView.setTitle(L10nUtil.getStringForArticleLanguage(getCard().wikiSite().languageCode(), R.string.view_main_page_card_title)) .setLangCode(getCard().wikiSite().languageCode()) .setCard(getCard()) .setCallback(getCallback()); footerView.setCallback(this::goToMainPage); <START> footerView.setFooterActionText(L10nUtil.getStringForArticleLanguage(getCard().wikiSite().languageCode(), R.string.view_main_page_card_action)); <END> }</code><technical_language>In other cards, L10nUtil.getStringForArticleLanguage() footer action text. if do this here</technical_language>

Target:
@Override public void setCard(@NonNull final MainPageCard card) { super.setCard(card); setLayoutDirectionByWikiSite(card.wikiSite(), containerView); headerView.setTitle(L10nUtil.getStringForArticleLanguage(getCard().wikiSite().languageCode(), R.string.view_main_page_card_title)) .setLangCode(getCard().wikiSite().languageCode()) .setCard(getCard()) .setCallback(getCallback()); footerView.setCallback(this::goToMainPage); footerView.setFooterActionText(getContext().getString(R.string.view_main_page_card_action)); }
Source:
<code>public static void main(String[] args) { KeyVaultBackupClient backupClient = new KeyVaultBackupClientBuilder() .vaultUrl("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); String blobStorageUrl = "<blob-storage-url>"; String sasToken = "<sas-token>"; SyncPoller<KeyVaultBackupOperation, String> backupPoller = backupClient.beginBackup(blobStorageUrl, sasToken); backupPoller.waitForCompletion(); String backupUri = backupPoller.getFinalResult(); <START> String[] segments = backupUri.split("/"); <END> String folderName = segments[segments.length - 1]; SyncPoller<KeyVaultRestoreOperation, Void> restorePoller = backupClient.beginRestore(blobStorageUrl, sasToken, folderName); restorePoller.waitForCompletion(); }</code><technical_language>Do intend change this handle Uri parsing internally? ([.NET example](<LINK_6></technical_language>

Target:
public static void main(String[] args) { KeyVaultBackupClient backupClient = new KeyVaultBackupClientBuilder() .vaultUrl("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); String blobStorageUrl = "<blob-storage-url>"; String sasToken = "<sas-token>"; SyncPoller<KeyVaultBackupOperation, String> backupPoller = backupClient.beginBackup(blobStorageUrl, sasToken); backupPoller.waitForCompletion(); String backupFolderUrl = backupPoller.getFinalResult(); SyncPoller<KeyVaultRestoreOperation, Void> restorePoller = backupClient.beginRestore(backupFolderUrl, sasToken); restorePoller.waitForCompletion(); }
Source:
<code>public void receiveAll() { ServiceBusReceiverAsyncClient receiver = new ServiceBusClientBuilder() .connectionString("fake-string") .buildReceiverClientBuilder() .buildAsyncClient(); <START> <END> Disposable subscription = receiver.receive().subscribe(receivedMessage -> { String messageId = receivedMessage.getMessageId(); System.out.printf("Received message messageId %s%n", messageId); System.out.printf("Contents of message as string: %s%n", new String(receivedMessage.getBody(), UTF_8)); }); subscription.dispose(); END: com.azure.messaging.servicebus.servicebusasyncreceiverclient.receive#all }</code><technical_language>nit: empty line</technical_language>

Target:
public void receiveAll() { ServiceBusReceiverAsyncClient receiver = new ServiceBusClientBuilder() .connectionString("fake-string") .buildReceiverClientBuilder() .queueName("<QUEUE-NAME>") .buildAsyncClient(); Disposable subscription = receiver.receive().subscribe(receivedMessage -> { String messageId = receivedMessage.getMessageId(); System.out.printf("Received message messageId %s%n", messageId); System.out.printf("Contents of message as string: %s%n", new String(receivedMessage.getBody(), UTF_8)); }); receiver.close(); subscription.dispose(); END: com.azure.messaging.servicebus.servicebusasyncreceiverclient.receive#all }
Source:
<code>public Optional<String> resolveTestQueryFailure(ErrorCodeSupplier errorCode, QueryStats controlQueryStats, QueryStats testQueryStats, Optional<QueryBundle> test) { if (errorCode != HIVE_TOO_MANY_OPEN_PARTITIONS || !test.isPresent()) { return Optional.empty(); } try { ShowCreate showCreate = new ShowCreate(TABLE, test.get().getTableName()); String showCreateResult = getOnlyElement(prestoAction.execute(showCreate, DESCRIBE, resultSet -> resultSet.getString(1)).getResults()); CreateTable createTable = (CreateTable) sqlParser.createStatement(showCreateResult, ParsingOptions.builder().setDecimalLiteralTreatment(AS_DOUBLE).build()); List<Property> bucketCountProperty = createTable.getProperties().stream() .filter(property -> property.getName().getValue().equals(BUCKET_COUNT_PROPERTY)) .collect(toImmutableList()); if (bucketCountProperty.size() != 1) { return Optional.empty(); } long bucketCount = ((LongLiteral) getOnlyElement(bucketCountProperty).getValue()).getValue(); <START> int testClusterSize = testResourceClient.getJsonResponse(NODE_RESOURCE_PATH, listJsonCodec(HeartbeatFailureDetector.Stats.class)).size(); <END> if (testClusterSize * maxBucketPerWriter < bucketCount) { return Optional.of("Auto Resolved: No enough worker on test cluster"); } return Optional.empty(); } catch (Throwable t) { log.warn(t, "Exception when resolving HIVE_TOO_MANY_OPEN_PARTITIONS"); return Optional.empty(); } }</code><technical_language>This generally change execution of a query (it can, chances low). In opinion reduce reliance external services, if end caching this value</technical_language>

Target:
public Optional<String> resolveTestQueryFailure(ErrorCodeSupplier errorCode, QueryStats controlQueryStats, QueryStats testQueryStats, Optional<QueryBundle> test) { if (errorCode != HIVE_TOO_MANY_OPEN_PARTITIONS || !test.isPresent()) { return Optional.empty(); } try { ShowCreate showCreate = new ShowCreate(TABLE, test.get().getTableName()); String showCreateResult = getOnlyElement(prestoAction.execute(showCreate, DESCRIBE, resultSet -> resultSet.getString(1)).getResults()); CreateTable createTable = (CreateTable) sqlParser.createStatement(showCreateResult, ParsingOptions.builder().setDecimalLiteralTreatment(AS_DOUBLE).build()); List<Property> bucketCountProperty = createTable.getProperties().stream() .filter(property -> property.getName().getValue().equals(BUCKET_COUNT_PROPERTY)) .collect(toImmutableList()); if (bucketCountProperty.size() != 1) { return Optional.empty(); } long bucketCount = ((LongLiteral) getOnlyElement(bucketCountProperty).getValue()).getValue(); int testClusterSize = testClusterSizeSupplier.get(); if (testClusterSize * maxBucketPerWriter < bucketCount) { return Optional.of("Auto Resolved: No enough worker on test cluster"); } return Optional.empty(); } catch (Throwable t) { log.warn(t, "Exception when resolving HIVE_TOO_MANY_OPEN_PARTITIONS"); return Optional.empty(); } }
Source:
<code>public void disconnect() { if (winrm != null && shellSelector != null) { try { winrmCallRetryConnFailure(new CallableFunction<DeleteResponse>() { @Override public DeleteResponse call() { setActionToContext((BindingProvider) winrm, "<LINK_1>"); return winrm.delete(null, RESOURCE_URI, MAX_ENVELOPER_SIZE, operationTimeout, locale, shellSelector); } }); } catch (SOAPFaultException soapFault) { assertFaultCode(soapFault, WSMAN_FAULT_CODE_SHELL_WAS_NOT_FOUND); } } <START> if (bus != null) { <END> bus.shutdown(true); } }</code><technical_language>is good a fix for shutting CXF bus. in CXF docs is wsdl is care of creating a bus sharing a common bus. I suggest parametrizing shutdown disconnect default in Apache Brooklyn. @neykov share performance results multiple winrm connections process</technical_language>

Target:
public void disconnect() { if (context == null) return; boolean isBusRunning = context.getBus().getState() != BusState.SHUTDOWN; if (!isBusRunning) return; try { if (winrm != null && shellSelector != null) { try { winrmCallRetryConnFailure(new CallableFunction<DeleteResponse>() { @Override public DeleteResponse call() { setActionToContext((BindingProvider) winrm, "<LINK_1>"); return winrm.delete(null, RESOURCE_URI, MAX_ENVELOPER_SIZE, operationTimeout, locale, shellSelector); } }); } catch (SOAPFaultException soapFault) { assertFaultCode(soapFault, WSMAN_FAULT_CODE_SHELL_WAS_NOT_FOUND); } } } finally { if (cleanupContext) { context.getBus().shutdown(true); context = null; } } }
Source:
<code>private void setUsingDocs(RenderRequest request, User user, ComponentService.Iface client, Set<String> releaseIds) { Set<Project> usingProjects = null; Set<Component> usingComponentsForComponent = null; <START> int allUsingProjectsCount = -1; <END> if (releaseIds != null && releaseIds.size() > 0) { try { ProjectService.Iface projectClient = thriftClients.makeProjectClient(); usingProjects = projectClient.searchByReleaseIds(releaseIds, user); allUsingProjectsCount = projectClient.getProjectCountByReleaseIds(releaseIds); usingComponentsForComponent = client.getUsingComponentsForComponent(releaseIds); } catch (TException e) { log.error("Problem filling using docs", e); } } request.setAttribute(USING_PROJECTS, nullToEmptySet(usingProjects)); request.setAttribute(USING_COMPONENTS, nullToEmptySet(usingComponentsForComponent)); request.setAttribute(ALL_USING_PROJECTS_COUNT, allUsingProjectsCount); }</code><technical_language>is -1 fallback, instead of 0</technical_language>

Target:
private void setUsingDocs(RenderRequest request, User user, ComponentService.Iface client, Set<String> releaseIds) { Set<Project> usingProjects = null; Set<Component> usingComponentsForComponent = null; int allUsingProjectsCount = 0; if (releaseIds != null && releaseIds.size() > 0) { try { ProjectService.Iface projectClient = thriftClients.makeProjectClient(); usingProjects = projectClient.searchByReleaseIds(releaseIds, user); allUsingProjectsCount = projectClient.getCountByReleaseIds(releaseIds); usingComponentsForComponent = client.getUsingComponentsForComponent(releaseIds); } catch (TException e) { log.error("Problem filling using docs", e); } } request.setAttribute(USING_PROJECTS, nullToEmptySet(usingProjects)); request.setAttribute(USING_COMPONENTS, nullToEmptySet(usingComponentsForComponent)); request.setAttribute(ALL_USING_PROJECTS_COUNT, allUsingProjectsCount); }
Source:
<code>public CompletableFuture<Void> visitDataWriteCommand(InvocationContext ctx, DataWriteCommand command, boolean assumeOriginKeptEntryInL1) throws Throwable { ctx.onReturn((ctx1, command1, rv, throwable) -> { if (throwable != null) throw throwable; Object key; <START> if (shouldUpdateOnWriteCommand(command) && command.isSuccessful() && <END> cdl.localNodeIsOwner((key = command.getKey()))) { if (trace) { log.trace("Sending additional invalidation for requestors if necessary."); } blockOnL1FutureIfNeeded(l1Manager .flushCache(Collections.singleton(key), ctx1.getOrigin(), assumeOriginKeptEntryInL1)); } return null; }); return ctx.continueInvocation(); }</code><technical_language>is a case command != command1 ctx != ctx1? if not, I remove arguments return handler. otherwise, need update code command1 :)</technical_language>

Target:
public CompletableFuture<Void> visitDataWriteCommand(InvocationContext ctx, DataWriteCommand command, boolean assumeOriginKeptEntryInL1) throws Throwable { return ctx.onReturn((rCtx, rCommand, rv, throwable) -> { if (throwable != null) throw throwable; Object key; DataWriteCommand writeCommand = (DataWriteCommand) rCommand; if (shouldUpdateOnWriteCommand(writeCommand) && writeCommand.isSuccessful() && cdl.localNodeIsOwner((key = writeCommand.getKey()))) { if (trace) { log.trace("Sending additional invalidation for requestors if necessary."); } blockOnL1FutureIfNeeded(l1Manager .flushCache(Collections.singleton(key), rCtx.getOrigin(), assumeOriginKeptEntryInL1)); } return null; }); }
Source:
<code>public void getLocation(String url) { if (NetworkUtils.hasNetwork()) { <START> String locationEndPoint = url + ApplicationConstants.API.REST_ENDPOINT + "LocationEntity"; <END> Call<Results<LocationEntity>> call = restApi.getLocations(locationEndPoint, "Admission LocationEntity", "full"); call.enqueue(new Callback<Results<LocationEntity>>() { @Override public void onResponse(Call<Results<LocationEntity>> call, Response<Results<LocationEntity>> response) { if (response.isSuccessful()) { view.updateLocationAdapter(response.body().getResults()); } else { view.showToast(mContext.getResources().getString(R.string.error_occurred)); view.enableSubmitButton(false); } } @Override public void onFailure(Call<Results<LocationEntity>> call, Throwable t) { view.showToast(t.getMessage()); view.enableSubmitButton(false); } }); } else { view.showToast(mContext.getResources().getString(R.string.offline_error_message)); } }</code><technical_language>need change this string this calling REST endpoint, local database</technical_language>

Target:
public void getLocation(String url) { if (NetworkUtils.hasNetwork()) { String locationEndPoint = url + ApplicationConstants.API.REST_ENDPOINT + "location"; Call<Results<LocationEntity>> call = restApi.getLocations(locationEndPoint, "Admission Location", "full"); call.enqueue(new Callback<Results<LocationEntity>>() { @Override public void onResponse(Call<Results<LocationEntity>> call, Response<Results<LocationEntity>> response) { if (response.isSuccessful()) { view.updateLocationAdapter(response.body().getResults()); } else { view.showToast(mContext.getResources().getString(R.string.error_occurred)); view.enableSubmitButton(false); } } @Override public void onFailure(Call<Results<LocationEntity>> call, Throwable t) { view.showToast(t.getMessage()); view.enableSubmitButton(false); } }); } else { view.showToast(mContext.getResources().getString(R.string.offline_error_message)); } }
Source:
<code>private Action onFixMessage( final DirectBuffer buffer, final int offset, final int blockLength, final int version, final long position) { messageFrame.wrap(buffer, offset, blockLength, version); final int messageLength = messageFrame.bodyLength(); <START> final long messageType = messageFrame.sbeSchemaVersion() > 2 ? <END> messageFrame.messageType() : messageFrame.deprecatedMessageType(); return protocolHandler.onMessage( buffer, offset + FRAME_SIZE, messageLength, messageFrame.libraryId(), messageFrame.connection(), messageFrame.session(), messageFrame.sequenceIndex(), messageType, messageFrame.timestamp(), messageFrame.status(), messageFrame.sequenceNumber(), position); }</code><technical_language>Beginning if worth extracting this a utility method</technical_language>

Target:
private Action onFixMessage( final DirectBuffer buffer, final int offset, final int blockLength, final int version, final long position) { messageFrame.wrap(buffer, offset, blockLength, version); final int messageLength = messageFrame.bodyLength(); final long messageType = MessageTypeExtractor.getMessageType(messageFrame); return protocolHandler.onMessage( buffer, offset + FRAME_SIZE, messageLength, messageFrame.libraryId(), messageFrame.connection(), messageFrame.session(), messageFrame.sequenceIndex(), messageType, messageFrame.timestamp(), messageFrame.status(), messageFrame.sequenceNumber(), position); }
Source:
<code>public String toString(String indent) { StringBuilder result = new StringBuilder(); int i = 0; for (Type field : schema.getFields()) { String name = field.getName(); List<Object> values = data[i]; ++i; if (values != null && !values.isEmpty()) { for (Object value : values) { result.append(indent); result.append(name); if (value == null) { result.append(": NULL\n"); } else if (value instanceof Group) { <START> result.append("\n"); <END> result.append(((SimpleGroup)value).toString(indent+" ")); } else { result.append(": " ); result.append(value.toString()); result.append("\n"); } } } } return result.toString(); }</code><technical_language>nit: Appending a char instead of a string char perform a bit suggestion result.append('\n');</technical_language>

Target:
public String toString(String indent) { StringBuilder builder = new StringBuilder(); appendToString(builder, indent); return builder.toString(); }
Source:
<code>private void defineMetadataConceptsForFilters(){ <START> metaDataObservations = Arrays.asList(1473,163161,162724); <END> }</code><technical_language>values supposed hardcoded predefined</technical_language>

Target:
private void defineMetadataConceptsForFilters(){ metaDataObservations = Arrays.asList(Constants.Shr.KenyaEmr.CONCEPTS.HIV_TESTS.PROVIDER_DETAILS.NAME.concept_id, Constants.Shr.KenyaEmr.CONCEPTS.HIV_TESTS.PROVIDER_DETAILS.ID.concept_id, Constants.Shr.KenyaEmr.CONCEPTS.HIV_TESTS.TEST_FACILITY.concept_id); }
Source:
<code>private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { List<Set<GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); if (replicaCount > volume.getBricks().size()) { <START> throw new EngineException(EngineError.GlusterVolumeGeoRepSyncFailed, <END> "Not all bricks are available for this volume"); } for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { Set<GeoRepSessionStatus> subVolumeStatusSet = new HashSet<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusSet.add(getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusSet); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (Set<GeoRepSessionStatus> subVolumeStatusValues : list) { if (subVolumeStatusValues.contains(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusValues.contains(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (subVolumeStatusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) subVolumeStatusValues.toArray()[0]); } else { log.info("Multiple status values found in volume '{}'", session.getMasterVolumeName()); } } } }</code><technical_language>exception is returned session's status is updated? update session status UNKNOWN/something equivalent log this error instead</technical_language>

Target:
private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { List<Set<GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); if (replicaCount > volume.getBricks().size()) { session.setStatus(GeoRepSessionStatus.UNKNOWN); log.info("Not all bricks are available for this volume. replicaCount : , volumeBrickCount: {}", replicaCount, volume.getBricks().size()); return; } for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { Set<GeoRepSessionStatus> subVolumeStatusSet = new HashSet<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusSet.add(getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusSet); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (Set<GeoRepSessionStatus> subVolumeStatusValues : list) { if (subVolumeStatusValues.contains(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusValues.contains(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (subVolumeStatusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) subVolumeStatusValues.toArray()[0]); } else { log.info("Multiple status values found in volume '{}'", session.getMasterVolumeName()); } } } }
Source:
<code>public URL execute( @DescribeParameter(name = "coverage", description = "Input raster") GridCoverage2D coverage) throws IOException { String fileName = coverage.getName().toString() + ".tif"; final Resource resource = resources.getOutputResource(null, fileName); OutputStream os = resource.out(); GeoTiffWriter writer = new GeoTiffWriter(os); final ParameterValueGroup params = new GeoTiffFormat().getWriteParameters(); params.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue( DEFAULT_WRITE_PARAMS); final GeneralParameterValue[] wps = params.values().toArray( new GeneralParameterValue[1]); try { writer.write(coverage, wps); } finally { try { writer.dispose(); } catch (Exception e) { } <START> os.close(); <END> } return new URL(resources.getOutputResourceUrl(fileName, "image/tiff")); }</code><technical_language>@NielsCharlier, try-with-resources? GeoTiffWriter implement AutoCloseable. @aaime</technical_language>

Target:
public URL execute( @DescribeParameter(name = "coverage", description = "Input raster") GridCoverage2D coverage) throws IOException { String fileName = coverage.getName().toString() + ".tif"; final Resource resource = resources.getOutputResource(null, fileName); final ParameterValueGroup params = new GeoTiffFormat().getWriteParameters(); params.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue( DEFAULT_WRITE_PARAMS); final GeneralParameterValue[] wps = params.values().toArray( new GeneralParameterValue[1]); try (OutputStream os = resource.out()) { GeoTiffWriter writer = new GeoTiffWriter(os); try { writer.write(coverage, wps); } finally { writer.dispose(); } } return new URL(resources.getOutputResourceUrl(fileName, "image/tiff")); }
Source:
<code>private void attachedFile() throws ApiError { this.deliveriesBackend.attach(delivery, fileName, in); assertEquals(1, delivery.getAttachments().size()); <START> assertEquals(1, delivery.getAttachments().stream() <END> .map((attachment) -> attachment.getFileName().equals(fileName) ).count()); }</code><technical_language>assertEquals(fileName, delivery.getAttachments().iterator().next().getFileName()) do trick? assertThat(delivery.getAttachments(), Matchers.contains(attachment))? (Don't equals() for attachment currently checks for though, require instantiate manually instead of mocking it)</technical_language>

Target:
private void attachedFile() throws ApiError { this.deliveriesBackend.attach(delivery, fileName, in); assertEquals(1, delivery.getAttachments().size()); assertEquals(fileName, delivery.getAttachments().iterator().next().getFileName()); }
Source:
<code>public List<String> getGroupMembers(byte[] groupId) { <START> return new ArrayList<String>(getGroup(groupId).members); <END> }</code><technical_language>group null, please check this</technical_language>

Target:
public List<String> getGroupMembers(byte[] groupId) { GroupInfo group = getGroup(groupId); if (group == null) { return new ArrayList<String>(); } else { return new ArrayList<String>(group.members); } }
Source:
<code><START> protected MockHandler createMockHandlerForTestClass(Class<?> testClass, Class<? extends MockHandler> defaultMockHandler) { <END> final Annotation annotation = testClass.getAnnotation(ModulesForTesting.class); if (annotation != null) { Class<? extends MockHandler> mockHandlerClass = ((ModulesForTesting) annotation).mockHandler(); try { return mockHandlerClass != MockHandler.class ? mockHandlerClass.newInstance() : defaultMockHandler.newInstance(); } catch (SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalArgumentException("Failed to instantiate MockHandler " + mockHandlerClass.getName() + ". Ensure that is has an accessible no-arg constructor.", e); } } else { throw new IllegalStateException("No MockHandler specified!"); } }</code><technical_language>Do want allow scanning of base classes is inheritance for tests anti-pattern</technical_language>

Target:
protected MockHandler createMockHandlerForTestClass(Class<?> testClass, Class<? extends MockHandler> defaultMockHandler) { Class<? extends MockHandler> mockHandlerClass = defaultMockHandler; for(Class<?> superClass : getAllSuperClassesInReverseOrder(testClass)) { ModulesForTesting annotation = superClass.getAnnotation(ModulesForTesting.class); if(annotation != null && !annotation.mockHandler().equals(MockHandler.class)) { mockHandlerClass = annotation.mockHandler(); } } ModulesForTesting annotation = testClass.getAnnotation(ModulesForTesting.class); if(annotation != null && !annotation.mockHandler().equals(MockHandler.class)) { mockHandlerClass = annotation.mockHandler(); } if (mockHandlerClass != null) { try { return mockHandlerClass != MockHandler.class ? mockHandlerClass.newInstance() : defaultMockHandler.newInstance(); } catch (SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalArgumentException("Failed to instantiate MockHandler " + mockHandlerClass.getName() + ". Ensure that is has an accessible no-arg constructor.", e); } } else { throw new IllegalStateException("No MockHandler specified!"); } }
Source:
<code>public static QueryExecuteOperationFragmentMapping getById(final int id) { <START> for (QueryExecuteOperationFragmentMapping type : values()) { <END> if (type.id == id) { return type; } } return null; }</code><technical_language>cache values(), a new array is allocated invocation</technical_language>

Target:
public static QueryExecuteOperationFragmentMapping getById(final int id) { for (QueryExecuteOperationFragmentMapping type : VALUES) { if (type.id == id) { return type; } } return null; }
Source:
<code>private synchronized void onFailure(final ConnectionManager manager, final Throwable ex) { if (connectionManager.isPresent() && connectionManager.get() == manager) { <START> logger.debug("Unrecoverable failure, forcing disconnect: {}", ex); <END> try { if (connectionManager.isPresent()) { this.disconnect(); } } catch (ConnectionException e) { logger.warn("Unable to Disconnect..."); } } else { logger.debug("Ignoring failure from old connection: {}", ex); } }</code><technical_language>Exception needs placeholder in message. Remove ': {}'</technical_language>

Target:
private synchronized void onFailure(final ConnectionManager manager, final Throwable ex) { if (connectionManager.isPresent() && connectionManager.get() == manager) { logger.debug("Unrecoverable failure, forcing disconnect", ex); try { this.disconnect(); } catch (ConnectionException e) { logger.warn("Unable to Disconnect..."); } } else { logger.debug("Ignoring failure from old connection", ex); } }
Source:
<code>private void handshakeFinished() throws IOException { if (handshakeResult.getHandshakeStatus() == HandshakeStatus.FINISHED) { if (netWriteBuffer.hasRemaining()) key.interestOps(key.interestOps() | SelectionKey.OP_WRITE); else { state = State.READY; key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE); SSLSession session = sslEngine.getSession(); log.debug("SSL handshake completed successfully with peerHost '{}' peerPort peerPrincipal '{}' cipherSuite '{}'", session.getPeerHost(), session.getPeerPort(), peerPrincipal(), session.getCipherSuite()); if (sslInformation == null) { String cipherSuiteName = session.getCipherSuite(); if ((cipherSuiteName == null) || cipherSuiteName.isEmpty()) { cipherSuiteName = "unknown"; } <START> String protocolName = session.getProtocol(); <END> if ((protocolName == null) || protocolName.isEmpty()) { protocolName = "unknown"; } sslInformation = new SslInformation(cipherSuiteName, protocolName); } } log.trace("SSLHandshake FINISHED channelId {}, appReadBuffer pos {}, netReadBuffer pos {}, netWriteBuffer pos ", channelId, appReadBuffer.position(), netReadBuffer.position(), netWriteBuffer.position()); } else { throw new IOException("NOT_HANDSHAKING during handshake"); } }</code><technical_language>parens null check needed (or is this a style I aware of?)</technical_language>

Target:
private void handshakeFinished() throws IOException { if (handshakeResult.getHandshakeStatus() == HandshakeStatus.FINISHED) { if (netWriteBuffer.hasRemaining()) key.interestOps(key.interestOps() | SelectionKey.OP_WRITE); else { state = State.READY; key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE); SSLSession session = sslEngine.getSession(); log.debug("SSL handshake completed successfully with peerHost '{}' peerPort peerPrincipal '{}' cipherSuite '{}'", session.getPeerHost(), session.getPeerPort(), peerPrincipal(), session.getCipherSuite()); if (cipherInformation == null) { String cipherSuiteName = session.getCipherSuite(); if (cipherSuiteName == null || cipherSuiteName.isEmpty()) { cipherSuiteName = "unknown"; } String protocolName = session.getProtocol(); if (protocolName == null || protocolName.isEmpty()) { protocolName = "unknown"; } cipherInformation = new CipherInformation(cipherSuiteName, protocolName); } } log.trace("SSLHandshake FINISHED channelId {}, appReadBuffer pos {}, netReadBuffer pos {}, netWriteBuffer pos ", channelId, appReadBuffer.position(), netReadBuffer.position(), netWriteBuffer.position()); } else { throw new IOException("NOT_HANDSHAKING during handshake"); } }
Source:
<code>public static Collection<Object[]> data() { <START> return Arrays.asList(new Object[][] { { 5, 1000 }, { 100, 2000 }, { 200, 1000 }, { 300, 3000 } }); <END> }</code><technical_language>data set is for JobRecoveryTest (and is interesting test JobRecoveryTest NodeRecoveryTest data set), share this data set a dedicated class, for example RecoveryDataSet</technical_language>

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { 5, 1000 }, { 100, 2000 }, { 200, 2000 } }); }
Source:
<code>public int hashCode() { <START> return Objects.hash(sourceId, destinationIds); <END> }</code><technical_language>destinationIds needs hashed content: suggestion return Objects.hash(sourceId, Arrays.hashCode(destinationIds));</technical_language>

Target:
public int hashCode() { return Objects.hash(sourceId, Arrays.hashCode(destinationIds)); }
Source:
<code>public void setUp() throws Exception { vlanNetwork = createNetworkWithId(); vlanNetwork.setVlanId(1); vmNetwork1 = createNetworkWithId(); vmNetwork1.setVmNetwork(true); vmNetwork2 = createNetworkWithId(); vmNetwork2.setVmNetwork(true); nonVmNetwork1 = createNetworkWithId(); nonVmNetwork1.setVmNetwork(false); nonVmNetwork2 = createNetworkWithId(); nonVmNetwork2.setVmNetwork(false); networkMap = new BusinessEntityMap<>( Arrays.asList(vlanNetwork, vmNetwork1, vmNetwork2, nonVmNetwork1, nonVmNetwork2)); <START> Mockito.when(networkExclusivenessValidator.getViolationMessage()) <END> .thenReturn(NETWORK_INTERFACES_NOT_EXCLUSIVELY_USED_BY_NETWORK); }</code><technical_language>please static import</technical_language>

Target:
public void setUp() throws Exception { vlanNetwork = createNetworkWithId(); vlanNetwork.setVlanId(1); vmNetwork1 = createNetworkWithId(); vmNetwork1.setVmNetwork(true); vmNetwork2 = createNetworkWithId(); vmNetwork2.setVmNetwork(true); nonVmNetwork1 = createNetworkWithId(); nonVmNetwork1.setVmNetwork(false); nonVmNetwork2 = createNetworkWithId(); nonVmNetwork2.setVmNetwork(false); networkMap = new BusinessEntityMap<>( Arrays.asList(vlanNetwork, vmNetwork1, vmNetwork2, nonVmNetwork1, nonVmNetwork2)); when(networkExclusivenessValidator.getViolationMessage()) .thenReturn(NETWORK_INTERFACES_NOT_EXCLUSIVELY_USED_BY_NETWORK); }
Source:
<code>final void clearEpollIn() { final EventLoop loop = isRegistered() ? eventLoop() : null; final AbstractEpollUnsafe unsafe = (AbstractEpollUnsafe) unsafe(); if (loop == null || loop.inEventLoop()) { unsafe.clearEpollIn0(); return; } <START> loop.execute(new Runnable() { <END> @Override public void run() { if (!unsafe.readPending && !config().isAutoRead()) { unsafe.clearEpollIn0(); } } }); }</code><technical_language>nit: create this Runnable re-use</technical_language>

Target:
final void clearEpollIn() { final EventLoop loop = isRegistered() ? eventLoop() : null; final AbstractEpollUnsafe unsafe = (AbstractEpollUnsafe) unsafe(); if (loop == null || loop.inEventLoop()) { unsafe.clearEpollIn0(); return; } Runnable clearFlagTask = clearEpollInTask; if (clearFlagTask == null) { clearEpollInTask = clearFlagTask = new Runnable() { @Override public void run() { if (!unsafe.readPending && !config().isAutoRead()) { unsafe.clearEpollIn0(); } } }; } loop.execute(clearFlagTask); }
Source:
<code>public static Map<Guid, List<DiskImage>> getImagesLeaf(List<DiskImage> images) { Map<Guid, List<DiskImage>> retVal = new HashMap<>(); <START> images.stream().forEach(image <END> -> MultiValueMapUtils.addToMap(image.getId(), image, retVal)); retVal.values().forEach(ImagesHandler::sortImageList); return retVal; }</code><technical_language>images.forEach</technical_language>

Target:
public static Map<Guid, List<DiskImage>> getImagesLeaf(List<DiskImage> images) { Map<Guid, List<DiskImage>> retVal = new HashMap<>(); images.forEach(image -> MultiValueMapUtils.addToMap(image.getId(), image, retVal)); retVal.values().forEach(ImagesHandler::sortImageList); return retVal; }
Source:
<code>public abstract ErlangEntryPoint getEntryPoint() throws ExecutionException; <START> public abstract String getWorkDirectory(); <END> public ErlangEntryPoint getDebugEntryPoint() throws ExecutionException { return getEntryPoint(); }</code><technical_language>Annotations</technical_language>

Target:
public abstract ErlangEntryPoint getEntryPoint() throws ExecutionException; @Nullable public abstract String getWorkDirectory(); public ErlangEntryPoint getDebugEntryPoint() throws ExecutionException { return getEntryPoint(); }
Source:
<code>public void setup(OperatorContext context) { operatorId = context.getId(); globalProcessedFileCount.setValue(processedFiles.size()); LOG.debug("Setup processed file count: {}", globalProcessedFileCount); this.context = context; try { filePath = new Path(directory); configuration = new Configuration(); fs = getFSInstance(); } catch (IOException ex) { failureHandling(ex); } fileCounters.setCounter(FileCounters.GLOBAL_PROCESSED_FILES, globalProcessedFileCount); fileCounters.setCounter(FileCounters.LOCAL_PROCESSED_FILES, localProcessedFileCount); fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_FAILURES, globalNumberOfFailures); fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_FAILURES, localNumberOfFailures); fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_RETRIES, globalNumberOfRetries); fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_RETRIES, localNumberOfRetries); fileCounters.setCounter(FileCounters.PENDING_FILES, pendingFileCount); windowDataManager.setup(context); if (context.getValue(OperatorContext.ACTIVATION_WINDOW_ID) < windowDataManager.getLargestCompletedWindow()) { currentFile = null; offset = 0; } fileQueue = new ArrayBlockingQueue<Path>(queueCapacity); <START> scanDirService = Executors.newScheduledThreadPool(1); <END> }</code><technical_language>Executors.newSingleThreadExecutor()</technical_language>

Target:
public void setup(OperatorContext context) { operatorId = context.getId(); globalProcessedFileCount.setValue(processedFiles.size()); LOG.debug("Setup processed file count: {}", globalProcessedFileCount); this.context = context; try { filePath = new Path(directory); configuration = new Configuration(); fs = getFSInstance(); } catch (IOException ex) { failureHandling(ex); } fileCounters.setCounter(FileCounters.GLOBAL_PROCESSED_FILES, globalProcessedFileCount); fileCounters.setCounter(FileCounters.LOCAL_PROCESSED_FILES, localProcessedFileCount); fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_FAILURES, globalNumberOfFailures); fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_FAILURES, localNumberOfFailures); fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_RETRIES, globalNumberOfRetries); fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_RETRIES, localNumberOfRetries); fileCounters.setCounter(FileCounters.PENDING_FILES, pendingFileCount); windowDataManager.setup(context); if (context.getValue(OperatorContext.ACTIVATION_WINDOW_ID) < windowDataManager.getLargestCompletedWindow()) { currentFile = null; offset = 0; } fileQueue = new ArrayBlockingQueue<Path>(queueCapacity); scanDirService = Executors.newSingleThreadScheduledExecutor(); }
Source:
<code>public VmDevice() { <START> alias = alias == null ? "" : alias; <END> }</code><technical_language>do need check for null here</technical_language>

Target:
public VmDevice() { alias = ""; }
Source:
<code>private void fixSize() { perspSwitcherToolbar.pack(); perspSwitcherToolbar.getParent().pack(); <START> perspSwitcherToolbar.getShell().requestLayout(); <END> }</code><technical_language>requestLayout called perspSwitcherToolbar Control directly, instead of Shell</technical_language>

Target:
private void fixSize() { perspSwitcherToolbar.pack(); perspSwitcherToolbar.getParent().pack(); perspSwitcherToolbar.requestLayout(); }
Source:
<code><START> private List<Topic> listTopics(String groupName) { <END> return topicRepository.listTopics(groupName); }</code><technical_language>change access of list methods private</technical_language>

Target:
public List<Topic> listTopics(String groupName) { return topicRepository.listTopics(groupName); }
Source:
<code>public void shouldThrowIllegalStateExceptionOnCallingNextAfterClose() throws Exception { try ( GBPTree<MutableLong,MutableLong> tree = index().build() ) { try ( Writer<MutableLong,MutableLong> writer = tree.writer() ) { MutableLong value = new MutableLong(); for ( int i = 0; i < 10; i++ ) { value.setValue( i ); writer.put( value, value ); } } RawCursor<Hit<MutableLong,MutableLong>,IOException> seek = tree.seek( new MutableLong( 0 ), new MutableLong( Long.MAX_VALUE ) ); assertTrue( seek.next() ); assertTrue( seek.next() ); seek.close(); try { while ( seek.next() ) <START> { END> } fail( "Should have failed" ); } catch ( IllegalStateException e ) { } } }</code><technical_language>able continue a closed cursor. if get results read buffer need verify cursor is open. I this test verify this behaviour</technical_language>

Target:
public void shouldThrowIllegalStateExceptionOnCallingNextAfterClose() throws Exception { try ( GBPTree<MutableLong,MutableLong> tree = index().build() ) { try ( Writer<MutableLong,MutableLong> writer = tree.writer() ) { MutableLong value = new MutableLong(); for ( int i = 0; i < 10; i++ ) { value.setValue( i ); writer.put( value, value ); } } RawCursor<Hit<MutableLong,MutableLong>,IOException> seek = tree.seek( new MutableLong( 0 ), new MutableLong( Long.MAX_VALUE ) ); assertTrue( seek.next() ); assertTrue( seek.next() ); seek.close(); for ( int i = 0; i < 2; i++ ) { try { seek.next(); fail( "Should have failed" ); } catch ( IllegalStateException e ) { } } } }
Source:
<code>protected int run() throws Exception { boolean errorOccurred = false; final Jenkins jenkins = Jenkins.getActiveInstance(); final HashSet<String> hs = new HashSet<String>(nodes); List<String> names = null; for (String node_s : hs) { <START> Computer computer = null; <END> try { computer = jenkins.getComputer(node_s); if (computer == null) { if (names == null) { names = new ArrayList<String>(); for (Computer c : jenkins.getComputers()) { if (!c.getName().isEmpty()) { names.add(c.getName()); } } } String adv = EditDistance.findNearest(node_s, names); throw new IllegalArgumentException(adv == null ? hudson.model.Messages.Computer_NoSuchSlaveExistsWithoutAdvice(node_s) : hudson.model.Messages.Computer_NoSuchSlaveExists(node_s, adv)); } computer.cliOffline(cause); } catch (Exception e) { if (hs.size() == 1) { throw e; } final String errorMsg = node_s + ": " + e.getMessage(); stderr.println(errorMsg); errorOccurred = true; continue; } } if (errorOccurred) { throw new AbortException("Error occured while performing this command, see previous stderr output."); } return 0; }</code><technical_language>I toy do <code>computer</code> of try-catch</technical_language>

Target:
protected int run() throws Exception { boolean errorOccurred = false; final Jenkins jenkins = Jenkins.getInstance(); final HashSet<String> hs = new HashSet<String>(nodes); List<String> names = null; for (String node_s : hs) { try { Computer computer = jenkins.getComputer(node_s); if (computer == null) { if (names == null) { names = ComputerSet.getComputerNames(); } String adv = EditDistance.findNearest(node_s, names); throw new IllegalArgumentException(adv == null ? hudson.model.Messages.Computer_NoSuchSlaveExistsWithoutAdvice(node_s) : hudson.model.Messages.Computer_NoSuchSlaveExists(node_s, adv)); } computer.cliOffline(cause); } catch (Exception e) { if (hs.size() == 1) { throw e; } stderr.println(node_s + ": " + e.getMessage()); errorOccurred = true; continue; } } if (errorOccurred) { throw new AbortException("Error occured while performing this command, see previous stderr output."); } return 0; }
Source:
<code>public boolean findPom(IContainer container) { IFile file = container.getFile(new Path("pom.xml")); boolean rc = false; if (file.exists()) { try { Document xmlDocument = builder.parse(file.getContents()); String parent = xPath.compile(PARENT_NODE).evaluate(xmlDocument); if (!parent.equals("")) { <START> rc = findPom(container.getParent()); <END> } else { rc = true; } } catch (SAXException e) { StubbyLog.logError(e); } catch (IOException e) { StubbyLog.logError(e); } catch (XPathExpressionException e) { StubbyLog.logError(e); } catch (CoreException e) { StubbyLog.logError(e); } } return rc; }</code><technical_language>if container.getParent() is correct give filesystem parent, parent in Eclipse model. For : I a feature project parent folder contained a pom.xml IResource#getParent() feature project gave workspace root</technical_language>

Target:
public boolean findPom(IContainer container) { if (container.getProject() == null) return false; IFile file = container.getFile(new Path("pom.xml")); boolean rc = false; if (file.exists()) { try { Document xmlDocument = builder.parse(file.getContents()); String parent = xPath.compile(PARENT_NODE).evaluate(xmlDocument); if (!parent.equals("")) { rc = findPom(container.getParent()); } else { rc = true; } } catch (SAXException e) { StubbyLog.logError(e); } catch (IOException e) { StubbyLog.logError(e); } catch (XPathExpressionException e) { StubbyLog.logError(e); } catch (CoreException e) { StubbyLog.logError(e); } } return rc; }
Source:
<code>public void leaveNode(Tree tree) { <START> if (tree instanceof IterationStatementTree) { <END> decrementLoopLevelinScope(); } else { scope.pop(); } }</code><technical_language>This checked is(Kind...) method iterationStatementsArray instance of</technical_language>

Target:
public void leaveNode(Tree tree) { if (tree.is(CheckUtils.iterationStatementsArray())) { decrementLoopLevelinScope(); } else { scope.pop(); } }
Source:
<code>public static PeerToPeerReviewArtifact getOrCreatePeerReview(ReviewBlockType reviewBlockType, AtsTestUtilState relatedToState, SkynetTransaction transaction) throws OseeCoreException { ensureLoaded(); <START> try { <END> if (peerRevArt == null) { peerRevArt = PeerToPeerReviewManager.createNewPeerToPeerReview( AtsWorkDefinitionService.get().getDefaultPeerToPeerWorkflowDefinition(), teamArt, AtsTestUtil.class.getSimpleName() + " Test Peer Review", relatedToState.getName(), transaction); } } catch (Exception ex) { throw new OseeWrappedException(ex); } return peerRevArt; }</code><technical_language>This other methods this thread safe</technical_language>

Target:
public static PeerToPeerReviewArtifact getOrCreatePeerReview(ReviewBlockType reviewBlockType, AtsTestUtilState relatedToState, SkynetTransaction transaction) throws OseeCoreException { ensureLoaded(); try { if (peerRevArt == null) { peerRevArt = PeerToPeerReviewManager.createNewPeerToPeerReview( AtsWorkDefinitionService.get().getDefaultPeerToPeerWorkflowDefinition(), teamArt, AtsTestUtil.class.getSimpleName() + " Test Peer Review", relatedToState.getName(), transaction); } } catch (OseeCoreException ex) { throw new OseeWrappedException(ex); } return peerRevArt; }
Source:
<code>public void testRegenerateKeys() throws Exception { server.enqueue(jsonResponse("/storageaccountkeys.json")); final StorageAccountApi storageAPI = api.getStorageAccountApi(resourceGroup); assertEquals(storageAPI.regenerateKeys("TESTSTORAGE", "key1"), StorageServiceKeys.create( "bndO7lydwDkMo4Y0mFvmfLyi2f9aZY7bwfAVWoJWv4mOVK6E9c/exLnFsSm/NMWgifLCfxC/c6QBTbdEvWUA7w==", "/jMLLT3kKqY4K+cUtJTbh7pCBdvG9EMKJxUvaJJAf6W6aUiZe1A1ulXHcibrqRVA2RJE0oUeXQGXLYJ2l85L7A==")); assertSent(server, "POST", "/subscriptions/" + subsriptionId + "/resourcegroups/" + resourceGroup + <START> "/providers/Microsoft.Storage/storageAccounts/TESTSTORAGE/regenerateKey?api-version=2015-06-15"); <END> }</code><technical_language>Add body check</technical_language>

Target:
public void testRegenerateKeys() throws Exception { server.enqueue(jsonResponse("/storageaccountkeys.json")); final StorageAccountApi storageAPI = api.getStorageAccountApi(resourceGroup); assertEquals(storageAPI.regenerateKeys("TESTSTORAGE", "key1"), StorageServiceKeys.create( "bndO7lydwDkMo4Y0mFvmfLyi2f9aZY7bwfAVWoJWv4mOVK6E9c/exLnFsSm/NMWgifLCfxC/c6QBTbdEvWUA7w==", "/jMLLT3kKqY4K+cUtJTbh7pCBdvG9EMKJxUvaJJAf6W6aUiZe1A1ulXHcibrqRVA2RJE0oUeXQGXLYJ2l85L7A==")); assertSent(server, "POST", "/subscriptions/" + subsriptionId + "/resourcegroups/" + resourceGroup + "/providers/Microsoft.Storage/storageAccounts/TESTSTORAGE/regenerateKey?api-version=2015-06-15", String.format("{\"keyName\":\"key1\"}")); }