auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static <T extends Annotation> T getTypeAnnotation(Class<T> annotation, Class<?> annotatedClass) { T instance = annotatedClass.getAnnotation(annotation); if (instance == null) <START> throw new IllegalStateException(String.format("@%s annotation was not found on %s", <END> annotation.getSimpleName(), annotatedClass)); validateAnnotations(annotatedClass, annotation); return instance; }</code><technical_language>Admittedly IllegalArgumentException type for mapper annotation misuse, IllegalStateException either: - IllegalArgumentException: _Thrown a method passed illegal inappropriate argument_ - IllegalStateException: _Signals a method invoked illegal inappropriate time_ two, IAE for sake of compatibility</technical_language>

Target:
static <T extends Annotation> T getTypeAnnotation(Class<T> annotation, Class<?> annotatedClass) { T instance = annotatedClass.getAnnotation(annotation); if (instance == null) throw new IllegalArgumentException(String.format("@%s annotation was not found on %s", annotation.getSimpleName(), annotatedClass)); validateAnnotations(annotatedClass, annotation); return instance; }
Source:
<code><START> private void removeAlwaysOff(IActionSetDescriptor descriptor) { <END> if (descriptor == null) { return; } if (!alwaysOffActionSets.contains(descriptor)) { return; } alwaysOffActionSets.remove(descriptor); if (page != null) { page.perspectiveActionSetChanged(this, descriptor, ActionSetManager.CHANGE_UNMASK); } }</code><technical_language>similar removeAlwaysOn. join methods a boolean flag</technical_language>

Target:
private void removeAlwaysOff(IActionSetDescriptor descriptor) { if (!alwaysOffActionSets.contains(descriptor)) { return; } alwaysOffActionSets.remove(descriptor); page.perspectiveActionSetChanged(this, descriptor, ActionSetManager.CHANGE_UNMASK); }
Source:
<code>public void run() { try { if (completed) { return; } setupExecutor(); int maxOperationCount = operationCount.get(); int processedBatchCount = 0; QueryOperation operation; while ((operation = operations.pollFirst()) != null) { if (operation instanceof QueryBatchExchangeOperation) { QueryBatchExchangeOperation operation0 = (QueryBatchExchangeOperation) operation; InboundHandler inbox = inboxes.get(operation0.getEdgeId()); assert inbox != null; InboundBatch batch = new InboundBatch( operation0.getBatch(), operation0.isLast(), operation0.getCallerId() ); inbox.onBatch(batch, operation0.getRemainingMemory()); } else { assert operation instanceof QueryFlowControlExchangeOperation; QueryFlowControlExchangeOperation operation0 = (QueryFlowControlExchangeOperation) operation; Map<UUID, OutboundHandler> edgeOutboxes = outboxes.get(operation0.getEdgeId()); assert edgeOutboxes != null; OutboundHandler outbox = edgeOutboxes.get(operation.getCallerId()); assert outbox != null; outbox.onFlowControl(operation0.getRemainingMemory()); } if (++processedBatchCount >= maxOperationCount) { break; } } operationCount.addAndGet(-1 * processedBatchCount); IterationResult res = exec.advance(); if (res != IterationResult.FETCHED_DONE) { for (InboundHandler inbox : inboxes.values()) { <START> inbox.sendFlowControl(); <END> } } if (res == IterationResult.FETCHED_DONE) { completed = true; stateCallback.onFragmentFinished(); } } catch (Exception e) { completed = true; stateCallback.cancel(e); } unschedule(); }</code><technical_language>Do send flow control if res is WAIT</technical_language>

Target:
public void run() { try { if (completed) { return; } setupExecutor(); int maxOperationCount = operationCount.get(); int processedBatchCount = 0; QueryOperation operation; while ((operation = operations.pollFirst()) != null) { if (operation instanceof QueryBatchExchangeOperation) { QueryBatchExchangeOperation operation0 = (QueryBatchExchangeOperation) operation; InboundHandler inbox = inboxes.get(operation0.getEdgeId()); assert inbox != null; InboundBatch batch = new InboundBatch( operation0.getBatch(), operation0.isLast(), operation0.getCallerId() ); inbox.onBatch(batch, operation0.getRemainingMemory()); } else { assert operation instanceof QueryFlowControlExchangeOperation; QueryFlowControlExchangeOperation operation0 = (QueryFlowControlExchangeOperation) operation; Map<UUID, OutboundHandler> edgeOutboxes = outboxes.get(operation0.getEdgeId()); assert edgeOutboxes != null; OutboundHandler outbox = edgeOutboxes.get(operation.getCallerId()); assert outbox != null; outbox.onFlowControl(operation0.getRemainingMemory()); } if (++processedBatchCount >= maxOperationCount) { break; } } operationCount.addAndGet(-1 * processedBatchCount); IterationResult res = exec.advance(); if (res != IterationResult.FETCHED_DONE) { for (InboundHandler inbox : inboxes.values()) { inbox.sendFlowControl(); } } if (res == IterationResult.FETCHED_DONE) { completed = true; stateCallback.onFragmentFinished(); } } catch (Exception e) { completed = true; stateCallback.cancel(e); } finally { unscheduleOrReschedule(); } }
Source:
<code>public T from(@Nonnull byte[] bytes) { ByteArrayInputStream input = new ByteArrayInputStream(bytes); int len = TASK_HEADER.length; byte[] prefix = new byte[len]; if (input.read(prefix, 0, len) == len && Arrays.equals(prefix, TASK_HEADER)) { int bytesToRead = input.read(); if (bytesToRead > 0) { byte[] format = new byte[bytesToRead]; if (input.read(format, 0, bytesToRead) == bytesToRead) { try { InputStream stream; if (Arrays.equals(format, FORMAT_LZ4)) { stream = new LZ4BlockInputStream(input); } else if (Arrays.equals(format, FORMAT_GZIP)) { stream = new GZIPInputStream(input); } else if (Arrays.equals(format, FORMAT_RAW)) { stream = input; } else { logger.warning("Unable to restore persisted task - unsupported data format " + "header detected: " + Arrays.toString(format)); return null; } return (T) objectMapper.readValue(stream, DataSubmissionTask.class); } catch (Throwable t) { logger.warning("Unable to restore persisted task: " + t); } } else { logger.warning("Unable to restore persisted task - corrupted header, ignoring"); } } else { <START> logger.warning("Unable to restore persisted task - corrupted header, ignoring"); <END> } } else { logger.warning("Unable to restore persisted task - no signature found, ignoring"); } errorCounter.inc(); return null; }</code><technical_language>this more specific missing header bytes read 0</technical_language>

Target:
public T from(@Nonnull byte[] bytes) { ByteArrayInputStream input = new ByteArrayInputStream(bytes); int len = TASK_HEADER.length; byte[] prefix = new byte[len]; if (input.read(prefix, 0, len) == len && Arrays.equals(prefix, TASK_HEADER)) { int bytesToRead = input.read(); if (bytesToRead > 0) { byte[] format = new byte[bytesToRead]; if (input.read(format, 0, bytesToRead) == bytesToRead) { InputStream stream = null; try { if (Arrays.equals(format, FORMAT_LZ4)) { stream = new LZ4BlockInputStream(input); } else if (Arrays.equals(format, FORMAT_GZIP)) { stream = new GZIPInputStream(input); } else if (Arrays.equals(format, FORMAT_RAW)) { stream = input; } else { logger.warning("Unable to restore persisted task - unsupported data format " + "header detected: " + Arrays.toString(format)); return null; } return (T) objectMapper.readValue(stream, DataSubmissionTask.class); } catch (Throwable t) { logger.warning("Unable to restore persisted task: " + t); } finally { IOUtils.closeQuietly(stream); } } else { logger.warning("Unable to restore persisted task - corrupted header, ignoring"); } } else { logger.warning("Unable to restore persisted task - missing header, ignoring"); } } else { logger.warning("Unable to restore persisted task - invalid or missing header, ignoring"); } errorCounter.inc(); return null; }
Source:
<code>public void registerRecipes() { BuildcraftRecipeRegistry.refineryRecipes.addDistillationRecipe(Fluids.BIOMASS.getFluid(4), <START> Fluids.BIO_ETHANOL.getFluid(0), Fluids.BIO_ETHANOL.getFluid(1), 100); <END> }</code><technical_language>0 fluid</technical_language>

Target:
public void registerRecipes() { BuildcraftRecipeRegistry.refineryRecipes.addDistillationRecipe(Fluids.BIOMASS.getFluid(10), Fluids.BIO_ETHANOL.getFluid(0), Fluids.BIO_ETHANOL.getFluid(3), 20 * MjAPI.MJ); }
Source:
<code>public synchronized void ack(T checkpoint) { if (!_inFlight.remove(checkpoint)) { LOG.error("Internal state error; could not remove checkpoint {}", checkpoint); } _acked.add(checkpoint); if (_highWaterMark == null || _highWaterMark.compareTo(checkpoint) < 0) { _highWaterMark = checkpoint; } T first = _inFlight.peek(); if (first == null) { <START> setCurrentCheckpoint(_highWaterMark); <END> _acked.clear(); } else { T max = null; while (!_acked.isEmpty() && _acked.peek().compareTo(first) < 0) { max = _acked.poll(); } if (max != null) { setCurrentCheckpoint(max); } } }</code><technical_language>nit: remove highwateMark variable code. set checkpoint acked checkpoint</technical_language>

Target:
public synchronized void ack(T checkpoint) { if (!_inFlight.remove(checkpoint)) { LOG.error("Internal state error; could not remove checkpoint {}", checkpoint); } _acked.add(checkpoint); if (_highWaterMark == null || _highWaterMark.compareTo(checkpoint) < 0) { _highWaterMark = checkpoint; } if (_inFlight.isEmpty()) { _currentCheckpoint = _highWaterMark; _acked.clear(); } else { T max = null; T first = _inFlight.iterator().next(); while (!_acked.isEmpty() && _acked.peek().compareTo(first) < 0) { max = _acked.poll(); } if (max != null) { if (_currentCheckpoint != null && max.compareTo(_currentCheckpoint) < 0) { LOG.error( "Internal error: checkpoints should progress in increasing order. Resolved checkpoint as which is less than current checkpoint of {}", max, _currentCheckpoint); } _currentCheckpoint = max; } } }
Source:
<code>public static Enum<EnumCause> getForClass(Class<? extends Cause> clazz) { <START> return Arrays.stream(values()).filter(enumCause -> enumCause.clazz == clazz).findFirst().orElse(null); <END> }</code><technical_language>abstract method for this instead. return EnumCause Enum<EnumCause> method</technical_language>

Target:
public static EnumCause getForClass(Class<? extends Cause> clazz) { return Arrays.stream(values()).filter(enumCause -> enumCause.clazz == clazz).findFirst().orElse(null); }
Source:
<code>private void verifyUserMetadataHeaders(HttpHeaders expectedHeaders, HttpResponse response, ByteBuffer usermetadata) { if (usermetadata == null) { for (Map.Entry<String, String> header : expectedHeaders) { String key = header.getKey(); if (key.startsWith(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX)) { assertEquals("Value for " + key + "does not match in user metadata", header.getValue(), HttpHeaders.getHeader(response, key)); } } } else { for (Map.Entry<String, String> header : response.headers()) { String key = header.getKey(); if (key.startsWith(RestUtils.Headers.USER_META_DATA_OLD_STYLE_PREFIX)) { <START> for (byte b : header.getValue().getBytes()) { <END> assertTrue("Received user metadata is longer than the original", usermetadata.hasRemaining()); assertEquals("Byte of received user metadata does not match original", usermetadata.get(), b); } } } } }</code><technical_language>is userMetadata set? If keys this prefix, values serialized is usermetadata ByteBuffer</technical_language>

Target:
private void verifyUserMetadataHeaders(HttpHeaders expectedHeaders, HttpResponse response, ByteBuffer usermetadata) { if (usermetadata == null) { for (Map.Entry<String, String> header : expectedHeaders) { String key = header.getKey(); if (key.startsWith(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX)) { assertEquals("Value for " + key + " does not match in user metadata", header.getValue(), HttpHeaders.getHeader(response, key)); } } for (Map.Entry<String, String> header : response.headers()) { String key = header.getKey(); if (key.startsWith(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX)) { assertTrue("Key " + key + " does not exist in expected headers", expectedHeaders.contains(key)); } } } else { int highestIndex = -1; for (Map.Entry<String, String> header : response.headers()) { String key = header.getKey(); if (key.startsWith(RestUtils.Headers.USER_META_DATA_OLD_STYLE_PREFIX)) { int index = Integer.parseInt(key.substring(RestUtils.Headers.USER_META_DATA_OLD_STYLE_PREFIX.length())); highestIndex = Math.max(index, highestIndex); } } if (highestIndex == -1) { fail("There should have been user metadata in the response"); } else { for (int i = 0; i <= highestIndex; i++) { String value = response.headers().get(RestUtils.Headers.USER_META_DATA_OLD_STYLE_PREFIX + i); for (byte b : value.getBytes()) { assertTrue("Received user metadata should not be longer than the original", usermetadata.hasRemaining()); assertEquals("Byte of received user metadata does not match original", usermetadata.get(), b); } } assertFalse("Some user metadata was not found in the response", usermetadata.hasRemaining()); } } }
Source:
<code>public void createS3Bucket(String userName, String s3BucketName) throws IOException { try { if(isAclEnabled) { checkAcls(ResourceType.BUCKET, StoreType.S3, ACLType.CREATE, null, s3BucketName, null); } metrics.incNumBucketCreates(); try { metadataManager.getLock().acquireS3BucketLock(s3BucketName); <START> metadataManager.getLock().acquireVolumeLock( <END> s3BucketManager.formatOzoneVolumeName(userName)); boolean newVolumeCreate = s3BucketManager.createOzoneVolumeIfNeeded( userName); if (newVolumeCreate) { metrics.incNumVolumeCreates(); metrics.incNumVolumes(); } } catch (IOException ex) { metrics.incNumVolumeCreates(); metrics.incNumVolumeCreateFails(); throw ex; } s3BucketManager.createS3Bucket(userName, s3BucketName); metrics.incNumBuckets(); } catch (IOException ex) { metrics.incNumBucketCreateFails(); throw ex; } finally { metadataManager.getLock().releaseVolumeLock( s3BucketManager.formatOzoneVolumeName(userName)); metadataManager.getLock().releaseS3BucketLock(s3BucketName); } }</code><technical_language>If volume lock fails, finally block attempt release it. S3 bucket lock. need nested try-catch a boolean flag lock indicating successfully acquired</technical_language>

Target:
public void createS3Bucket(String userName, String s3BucketName) throws IOException { boolean acquiredS3Lock = false; boolean acquiredVolumeLock = false; try { if(isAclEnabled) { checkAcls(ResourceType.BUCKET, StoreType.S3, ACLType.CREATE, null, s3BucketName, null); } metrics.incNumBucketCreates(); metadataManager.getLock().acquireLock(S3_BUCKET_LOCK, s3BucketName); acquiredS3Lock = true; try { metadataManager.getLock().acquireLock(VOLUME_LOCK, s3BucketManager.formatOzoneVolumeName(userName)); acquiredVolumeLock = true; boolean newVolumeCreate = s3BucketManager.createOzoneVolumeIfNeeded( userName); if (newVolumeCreate) { metrics.incNumVolumeCreates(); metrics.incNumVolumes(); } } catch (IOException ex) { metrics.incNumVolumeCreates(); metrics.incNumVolumeCreateFails(); throw ex; } s3BucketManager.createS3Bucket(userName, s3BucketName); metrics.incNumBuckets(); } catch (IOException ex) { metrics.incNumBucketCreateFails(); throw ex; } finally { if (acquiredVolumeLock) { metadataManager.getLock().releaseLock(VOLUME_LOCK, s3BucketManager.formatOzoneVolumeName(userName)); } if (acquiredS3Lock) { metadataManager.getLock().releaseLock(S3_BUCKET_LOCK, s3BucketName); } } }
Source:
<code>ServiceBusReceiverAsyncClient(String fullyQualifiedNamespace, String entityPath, MessagingEntityType entityType, ReceiverOptions receiverOptions, ServiceBusConnectionProcessor connectionProcessor, TracerProvider tracerProvider, MessageSerializer messageSerializer, MessageLockContainer messageLockContainer, Runnable onClientClose){ this.fullyQualifiedNamespace = Objects.requireNonNull(fullyQualifiedNamespace, "'fullyQualifiedNamespace' cannot be null."); this.entityPath = Objects.requireNonNull(entityPath, "'entityPath' cannot be null."); this.receiverOptions = Objects.requireNonNull(receiverOptions, "'receiveMessageOptions' cannot be null."); this.connectionProcessor = Objects.requireNonNull(connectionProcessor, "'connectionProcessor' cannot be null."); this.tracerProvider = Objects.requireNonNull(tracerProvider, "'tracerProvider' cannot be null."); this.messageSerializer = Objects.requireNonNull(messageSerializer, "'messageSerializer' cannot be null."); this.prefetch = receiverOptions.getPrefetchCount(); this.receiveMode = receiverOptions.getReceiveMode(); this.entityType = entityType; <START> this.isSessionEnabled = receiverOptions.isSessionEnabled(); <END> this.sessionId = receiverOptions.getSessionId(); this.messageLockContainer = messageLockContainer; this.onClientClose = onClientClose; this.defaultReceiveOptions = new ReceiveAsyncOptions() .setEnableAutoComplete(true) .setMaxAutoRenewDuration(connectionProcessor.getRetryOptions().getTryTimeout()); }</code><technical_language>need create dedicated fields now. A reference receiverOptions is held class</technical_language>

Target:
ServiceBusReceiverAsyncClient(String fullyQualifiedNamespace, String entityPath, MessagingEntityType entityType, ReceiverOptions receiverOptions, ServiceBusConnectionProcessor connectionProcessor, TracerProvider tracerProvider, MessageSerializer messageSerializer, MessageLockContainer messageLockContainer, Runnable onClientClose) { this.fullyQualifiedNamespace = Objects.requireNonNull(fullyQualifiedNamespace, "'fullyQualifiedNamespace' cannot be null."); this.entityPath = Objects.requireNonNull(entityPath, "'entityPath' cannot be null."); this.receiverOptions = Objects.requireNonNull(receiverOptions, "'receiveMessageOptions' cannot be null."); this.connectionProcessor = Objects.requireNonNull(connectionProcessor, "'connectionProcessor' cannot be null."); this.tracerProvider = Objects.requireNonNull(tracerProvider, "'tracerProvider' cannot be null."); this.messageSerializer = Objects.requireNonNull(messageSerializer, "'messageSerializer' cannot be null."); this.prefetch = receiverOptions.getPrefetchCount(); this.receiveMode = receiverOptions.getReceiveMode(); this.entityType = entityType; this.messageLockContainer = messageLockContainer; this.onClientClose = onClientClose; this.defaultReceiveOptions = new ReceiveAsyncOptions() .setEnableAutoComplete(true) .setMaxAutoRenewDuration(connectionProcessor.getRetryOptions().getTryTimeout()); }
Source:
<code>public SelectItem[] getAddableDocStructTypes() { switch (positionOfNewDocStrucElement) { case BEFOR_CURRENT_ELEMENT: case AFTER_CURRENT_ELEMENT: return this.metaHelper.getAddableDocStructTypen(this.docStruct, true); case FIRST_CHILD_OF_CURRENT_ELEMENT: case LAST_CHILD_OF_CURRENT_ELEMENT: return this.metaHelper.getAddableDocStructTypen(this.docStruct, false); default: logger.error("Invalid positionOfNewDocStrucElement"); <START> return null; <END> } }</code><technical_language>Returning null avoided introduce unnecessary null pointer checks. a empty object returned</technical_language>

Target:
public SelectItem[] getAddableDocStructTypes() { switch (positionOfNewDocStrucElement) { case BEFOR_CURRENT_ELEMENT: case AFTER_CURRENT_ELEMENT: return this.metaHelper.getAddableDocStructTypen(this.docStruct, true); case FIRST_CHILD_OF_CURRENT_ELEMENT: case LAST_CHILD_OF_CURRENT_ELEMENT: return this.metaHelper.getAddableDocStructTypen(this.docStruct, false); default: logger.error("Invalid positionOfNewDocStrucElement"); return new SelectItem[0]; } }
Source:
<code>public ElasticsearchLoader(Client client, String tableName, TestingPrestoServer prestoServer, <START> Session defaultSession) <END> { super(prestoServer, defaultSession); this.tableName = tableName; this.client = client; }</code><technical_language>add null checks</technical_language>

Target:
public ElasticsearchLoader(Client client, String tableName, TestingPrestoServer prestoServer, Session defaultSession) { super(prestoServer, defaultSession); this.tableName = requireNonNull(tableName, "tableName is null"); this.client = requireNonNull(client, "client is null"); }
Source:
<code>private void writeToQueue() throws JMSException { writeMsg(lines); session.close(); <START> connection.close(); <END> LOG.debug("Sent messages to topic {}", QUEUE_NAME); }</code><technical_language>Suggest extracting setup teardown functions annotated @Before, @BeforeClass, etc. done in other tests</technical_language>

Target:
private void writeToQueue() throws JMSException { writeMsg(lines); LOG.debug("Sent messages to topic {}", qNameToUse); }
Source:
<code>private Future<Optional<String>> sendEmail(EmailNotificationType emailNotificationType, ChargeEntity chargeEntity, HashMap<String, String> personalisation) { <START> Boolean isEmailEnabled = Optional.ofNullable(chargeEntity.getGatewayAccount(). <END> getEmailNotifications() .get(emailNotificationType)) .map(EmailNotificationEntity::isEnabled) .orElse(false); if (emailNotifyGloballyEnabled && isEmailEnabled) { String emailAddress = chargeEntity.getEmail(); Stopwatch responseTimeStopwatch = Stopwatch.createStarted(); return executorService.submit(() -> { try { Pair<NotificationClient, String> notifyClientSettings = getNotifyClientSettings(emailNotificationType, chargeEntity); SendEmailResponse response = notifyClientSettings.getLeft() .sendEmail(notifyClientSettings.getRight(), emailAddress, personalisation, null); return Optional.of(response.getNotificationId().toString()); } catch (NotificationClientException e) { logger.error("Failed to send confirmation email - charge_external_id=" + chargeEntity.getExternalId(), e); metricRegistry.counter("notify-operations.failures").inc(); return Optional.empty(); } finally { responseTimeStopwatch.stop(); metricRegistry.histogram("notify-operations.response_time").update(responseTimeStopwatch.elapsed(TimeUnit.MILLISECONDS)); } }); } return CompletableFuture.completedFuture(Optional.empty()); }</code><technical_language>This Boolean a primitive; need boxed</technical_language>

Target:
private Future<Optional<String>> sendEmail(EmailNotificationType emailNotificationType, ChargeEntity chargeEntity, HashMap<String, String> personalisation) { boolean isEmailEnabled = Optional.ofNullable(chargeEntity.getGatewayAccount().getEmailNotifications().get(emailNotificationType)) .map(EmailNotificationEntity::isEnabled) .orElse(false); if (emailNotifyGloballyEnabled && isEmailEnabled) { String emailAddress = chargeEntity.getEmail(); Stopwatch responseTimeStopwatch = Stopwatch.createStarted(); return executorService.submit(() -> { try { NotifyClientSettings notifyClientSettings = getNotifyClientSettings(emailNotificationType, chargeEntity); SendEmailResponse response = notifyClientSettings.getClient() .sendEmail(notifyClientSettings.getTemplateId(), emailAddress, personalisation, null); return Optional.of(response.getNotificationId().toString()); } catch (NotificationClientException e) { logger.error("Failed to send confirmation email - charge_external_id=" + chargeEntity.getExternalId(), e); metricRegistry.counter("notify-operations.failures").inc(); return Optional.empty(); } finally { responseTimeStopwatch.stop(); metricRegistry.histogram("notify-operations.response_time").update(responseTimeStopwatch.elapsed(TimeUnit.MILLISECONDS)); } }); } return CompletableFuture.completedFuture(Optional.empty()); }
Source:
<code>public long getInitialDelay() { <START> return timeUnit.convert(initialNsDelay, TimeUnit.NANOSECONDS); <END> }</code><technical_language>question unit conversion earlier</technical_language>

Target:
public long getInitialDelay() { return initialDelay; }
Source:
<code>public void testConfigurableAnalyzerIsCaseAndAccentInsensitive() { final String testName = "testConfigurableAnalyzerIsCaseAndAccentInsensitive"; final String turtle = StrUtils.strjoinNL( TURTLE_PROLOG, "<" + RESOURCE_BASE + testName + ">", " rdfs:label 'Feeling a déjà vu'", "." ); String queryString = StrUtils.strjoinNL( QUERY_PROLOG, "SELECT ?s", "WHERE {", " ?s text:query ( rdfs:label '\"feeling ä déja\"*' 10 ) .", "}" ); <START> Set<String> expectedURIs = new HashSet<>() ; <END> expectedURIs.addAll( Arrays.asList(RESOURCE_BASE + testName)) ; doTestSearch(turtle, queryString, expectedURIs); }</code><technical_language>shaded Guava offers Sets::newHashSet functions for this kind of use, read a pinch better</technical_language>

Target:
public void testConfigurableAnalyzerIsCaseAndAccentInsensitive() { final String testName = "testConfigurableAnalyzerIsCaseAndAccentInsensitive"; final String turtle = StrUtils.strjoinNL( TURTLE_PROLOG, "<" + RESOURCE_BASE + testName + ">", " rdfs:label 'Feeling a déjà vu'", "." ); String queryString = StrUtils.strjoinNL( QUERY_PROLOG, "SELECT ?s", "WHERE {", " ?s text:query ( rdfs:label '\"feeling ä déja\"*' 10 ) .", "}" ); Set<String> expectedURIs = Sets.newHashSet(RESOURCE_BASE + testName); doTestSearch(turtle, queryString, expectedURIs); }
Source:
<code>public void edit(final UnitVmModel object) { super.edit(object); if (object.getIsNew()) { object.getNumOfDesktops().setEntity(1); } <START> prestartedVmsEditor.setEnabled(true); <END> }</code><technical_language>true default</technical_language>

Target:
public void edit(final UnitVmModel object) { super.edit(object); if (object.getIsNew()) { object.getNumOfDesktops().setEntity(1); } }
Source:
<code>void createControls(final Composite parent) { this.quickAccessCommand = eCommandService.createCommand(QUICK_ACCESS_COMMAND_ID, null); display = parent.getDisplay(); display.addFilter(SWT.FocusIn, previousFocusListener); final Composite comp = new Composite(parent, SWT.NONE); <START> GridLayoutFactory.swtDefaults().margins(2, 2).applyTo(comp); <END> updateQuickAccessTriggerSequence(); quickAccessButton = createButton(comp); updateQuickAccessText(); quickAccessButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { activate(previousFocusControl); })); }</code><technical_language>2 specifically? Is this a elsewhere</technical_language>

Target:
void createControls(final Composite parent) { this.quickAccessCommand = eCommandService.createCommand(QUICK_ACCESS_COMMAND_ID, null); display = parent.getDisplay(); display.addFilter(SWT.FocusIn, previousFocusListener); final Composite comp = new Composite(parent, SWT.NONE); comp.setSize(SWT.DEFAULT, 32); GridLayoutFactory.swtDefaults().margins(3, 3).applyTo(comp); updateQuickAccessTriggerSequence(); quickAccessButton = createButton(comp); updateQuickAccessText(); quickAccessButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { activate(previousFocusControl); })); }
Source:
<code>protected SimpleName getNewName(ASTRewrite rewrite) { AST ast= rewrite.getAST(); SimpleName nameNode= <START> ast.newSimpleName(String.valueOf("provider")); <END> return nameNode; }</code><technical_language>Is this a left-over char[] constant jdt.core? I suggest a regular String constant in this class</technical_language>

Target:
protected SimpleName getNewName(ASTRewrite rewrite) { AST ast= rewrite.getAST(); SimpleName nameNode= ast.newSimpleName("provider"); return nameNode; }
Source:
<code>public void testIntegerAnnotations() { String message = "message IntMessage {" + " required int32 i8 (INT(8,true));" + " required int32 i16 (INT(16,true));" + " required int32 i32 (INT(32,true));" + " required int64 i64 (INT(64,true));" + " required int32 u8 (INT(8,false));" + " required int32 u16 (INT(16,false));" + " required int32 u32 (INT(32,false));" + " required int64 u64 (INT(64,false));" + "}\n"; MessageType parsed = MessageTypeParser.parseMessageType(message); MessageType expected = Types.buildMessage() <START> .required(INT32).as(LogicalTypeAnnotation.intType(8, true)).named("i8") <END> .required(INT32).as(LogicalTypeAnnotation.intType(16, true)).named("i16") .required(INT32).as(LogicalTypeAnnotation.intType(32, true)).named("i32") .required(INT64).as(LogicalTypeAnnotation.intType(64, true)).named("i64") .required(INT32).as(LogicalTypeAnnotation.intType(8, false)).named("u8") .required(INT32).as(LogicalTypeAnnotation.intType(16, false)).named("u16") .required(INT32).as(LogicalTypeAnnotation.intType(32, false)).named("u32") .required(INT64).as(LogicalTypeAnnotation.intType(64, false)).named("u64") .named("IntMessage"); assertEquals(expected, parsed); MessageType reparsed = MessageTypeParser.parseMessageType(parsed.toString()); assertEquals(expected, reparsed); }</code><technical_language>nit: I think, static import of method intType reading code</technical_language>

Target:
public void testIntegerAnnotations() { String message = "message IntMessage {" + " required int32 i8 (INT(8,true));" + " required int32 i16 (INT(16,true));" + " required int32 i32 (INT(32,true));" + " required int64 i64 (INT(64,true));" + " required int32 u8 (INT(8,false));" + " required int32 u16 (INT(16,false));" + " required int32 u32 (INT(32,false));" + " required int64 u64 (INT(64,false));" + "}\n"; MessageType parsed = MessageTypeParser.parseMessageType(message); MessageType expected = Types.buildMessage() .required(INT32).as(intType(8, true)).named("i8") .required(INT32).as(intType(16, true)).named("i16") .required(INT32).as(intType(32, true)).named("i32") .required(INT64).as(intType(64, true)).named("i64") .required(INT32).as(intType(8, false)).named("u8") .required(INT32).as(intType(16, false)).named("u16") .required(INT32).as(intType(32, false)).named("u32") .required(INT64).as(intType(64, false)).named("u64") .named("IntMessage"); assertEquals(expected, parsed); MessageType reparsed = MessageTypeParser.parseMessageType(parsed.toString()); assertEquals(expected, reparsed); }
Source:
<code>public String createToken(User user) { <START> if (!Boolean.TRUE.equals(user.isActive())) { <END> throw new PasswordResetTokenCreationException(); } deleteTokenIfExists(user); return addPasswordResetToken(user); }</code><technical_language>User.isActive() return a boolean instead of Boolean UserMetadata states active is required</technical_language>

Target:
public String createToken(User user) { if (!user.isActive()) { throw new PasswordResetTokenCreationException(); } deleteTokenIfExists(user); return addPasswordResetToken(user); }
Source:
<code>public void testDestroyNetwork() throws Exception { SubNetwork subNet = new SubNetwork(SUB_NETWORK_NAME, "vdc", "region"); when(subnetworkDao.load(any(String.class))).thenReturn(subNet); <START> subNetworkManager.delete(subNet); <END> }</code><technical_language>secction // add verify sentences</technical_language>

Target:
public void testDestroyNetwork() throws Exception { SubNetwork subNet = new SubNetwork(SUB_NETWORK_NAME, "vdc", "region"); subNetworkManager.delete(subNet); verify (subnetworkDao).remove(subNet); }
Source:
<code>private List<String> getArrayList(String... labelNames) { List<String> listOfLabelNames = new ArrayList<>(); for (String labelName : labelNames) { listOfLabelNames.add(labelName); } return listOfLabelNames; <START> } <END></code><technical_language>methods new HashSet<>(labelNames) new ArrayList<>(labelNames)</technical_language>

Target:
private List<String> getArrayList(String... labelNames) { return Arrays.asList(labelNames); }
Source:
<code>public void insertDiscovery(List<IMetric> batch) { batchHistogram.update(batch.size()); if (batch.size() == 0) { return; } Timer.Context ctx = writeTimer.time(); try { for (Object obj : batch) { if (!(obj instanceof IMetric)) { classCastExceptionMeter.mark(); continue; } } elasticsearchRestHelper.indexMetrics(batch); } catch (IOException e) { <START> log.error(e.getMessage()); <END> e.printStackTrace(); } finally { ctx.stop(); } }</code><technical_language>convention is in BF, I prefer exception logs include a statement of attempted log.error("Failed index metrics: {}", e.getMessage); redundant caller context, helpful is disabled logging</technical_language>

Target:
public void insertDiscovery(List<IMetric> batch) { batchHistogram.update(batch.size()); if (batch.size() == 0) { return; } Timer.Context ctx = writeTimer.time(); try { for (Object obj : batch) { if (!(obj instanceof IMetric)) { classCastExceptionMeter.mark(); continue; } } elasticsearchRestHelper.indexMetrics(batch); } catch (IOException e) { log.error("Indexing metrics into elasticsearch failed. {}", e.getMessage()); throw new RuntimeException(String.format("insertDiscovery failed with message: %s", e.getMessage()), e); } finally { ctx.stop(); } }
Source:
<code>public void publishEntityCapabilities() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, UnsupportedEncodingException, NoSuchAlgorithmException { ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection()); DiscoverInfo discoverInfo = sdm.discoverInfo(connection().getUser()); <START> List<String> algoList = new ArrayList<String>(); <END> algoList.add(defaultAlgo); Caps2Element element = generateCapabilityHash(discoverInfo, algoList); Presence presence = PresenceBuilder .buildPresence() .addExtension(element) .build(); connection().sendStanza(presence); }</code><technical_language>This Collections.singletonList(defaultAlgo), list need mutable</technical_language>

Target:
public void publishEntityCapabilities() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, UnsupportedEncodingException, NoSuchAlgorithmException { ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection()); DiscoverInfo discoverInfo = sdm.discoverInfo(connection().getUser()); List<String> algoList = Collections.singletonList(defaultAlgo); currentEntityCapabilities = generateCapabilityHash(discoverInfo, algoList); Presence presence = PresenceBuilder .buildPresence() .addExtension(currentEntityCapabilities) .build(); connection().sendStanza(presence); setLocalEntityCapsNodeProvider(); }
Source:
<code>public Builder<T> setQuery(@NonNull Query query, @NonNull PagedList.Config config, @NonNull SnapshotParser<T> parser) { <START> <END> FirestoreDataSource.Factory factory = new FirestoreDataSource.Factory(query); mData = new PagingData(new LivePagedListBuilder<>(factory, config).build()); mParser = parser; return this; }</code><technical_language>Nit: lots of space</technical_language>

Target:
public Builder<T> setQuery(@NonNull Query query, @NonNull PagedList.Config config, @NonNull SnapshotParser<T> parser) { FirestoreDataSource.Factory factory = new FirestoreDataSource.Factory(query); mData = new LivePagedListBuilder<>(factory, config).build(); mParser = parser; return this; }
Source:
<code>private void refreshServerData(VDSGroup cluster, VDS upServer, List<VDS> existingServers) { if (cluster.supportsVirtService()) { log.debugFormat("As cluster {0} supports virt service as well, it's servers will not be synced with glusterfs", cluster.getName()); return; } acquireLock(cluster.getId()); <START> log.infoFormat("Refreshing Gluster Server data for cluster {0} using server {1} ", <END> cluster.getName(), upServer.getName()); try { List<GlusterServerInfo> fetchedServers = fetchServers(cluster, upServer, existingServers); if (fetchedServers != null) { removeDetachedServers(existingServers, fetchedServers); } } catch(Exception e) { log.errorFormat("Error while refreshing server data for cluster {0} from database!", cluster.getName(), e); } finally { releaseLock(cluster.getId()); } }</code><technical_language>iiuc, this write log 5 sec, flood it, i this debug/trace</technical_language>

Target:
private void refreshServerData(VDSGroup cluster, VDS upServer, List<VDS> existingServers) { if (cluster.supportsVirtService()) { log.debugFormat("As cluster {0} supports virt service as well, it's servers will not be synced with glusterfs", cluster.getName()); return; } acquireLock(cluster.getId()); log.debugFormat("Refreshing Gluster Server data for cluster {0} using server {1} ", cluster.getName(), upServer.getName()); try { List<GlusterServerInfo> fetchedServers = fetchServers(cluster, upServer, existingServers); if (fetchedServers != null) { removeDetachedServers(existingServers, fetchedServers); } } catch(Exception e) { log.errorFormat("Error while refreshing server data for cluster {0} from database!", cluster.getName(), e); } finally { releaseLock(cluster.getId()); } }
Source:
<code>public String getAnswerHtml(FeedbackQuestionDetails questionDetails) { FeedbackRankOptionsQuestionDetails rankQuestion = (FeedbackRankOptionsQuestionDetails) questionDetails; <START> String invalidAnswer = "Invalid response"; <END> StringBuilder htmlBuilder = new StringBuilder(); htmlBuilder.append("<ul>"); if (answers.get(0) == -1) { htmlBuilder.append("<li>"); htmlBuilder.append(invalidAnswer); htmlBuilder.append("</li>"); } else { SortedMap<Integer, List<String>> orderedOptions = generateMapOfRanksToOptions(rankQuestion); for (Entry<Integer, List<String>> rankAndOption : orderedOptions.entrySet()) { Integer rank = rankAndOption.getKey(); if (rank == Const.POINTS_NOT_SUBMITTED) { continue; } List<String> optionsWithGivenRank = rankAndOption.getValue(); for (String option : optionsWithGivenRank) { htmlBuilder.append("<li>"); htmlBuilder.append(Sanitizer.sanitizeForHtml(rank.toString())); htmlBuilder.append(": "); htmlBuilder.append(option); htmlBuilder.append("</li>"); } } } htmlBuilder.append("</ul>"); return htmlBuilder.toString(); }</code><technical_language>This const repeatedly. Extract Const class</technical_language>

Target:
public String getAnswerHtml(FeedbackQuestionDetails questionDetails) { FeedbackRankOptionsQuestionDetails rankQuestion = (FeedbackRankOptionsQuestionDetails) questionDetails; SortedMap<Integer, List<String>> orderedOptions = generateMapOfRanksToOptions(rankQuestion); StringBuilder htmlBuilder = new StringBuilder(); htmlBuilder.append("<ul>"); for (Entry<Integer, List<String>> rankAndOption : orderedOptions.entrySet()) { Integer rank = rankAndOption.getKey(); if (rank == Const.POINTS_NOT_SUBMITTED) { continue; } List<String> optionsWithGivenRank = rankAndOption.getValue(); for (String option : optionsWithGivenRank) { htmlBuilder.append("<li>"); htmlBuilder.append(Sanitizer.sanitizeForHtml(rank.toString())); htmlBuilder.append(": "); htmlBuilder.append(option); htmlBuilder.append("</li>"); } } htmlBuilder.append("</ul>"); return htmlBuilder.toString(); }
Source:
<code>protected void verifyOutput(RoleDTO source, Role dest, boolean childrenGenerated) { if (source != null) { assertNotNull(dest.getId()); assertEquals(source.getName(), dest.getName()); <START> <END> if (childrenGenerated) { for (UserDTO userDto : source.getUsers()) { for (User user : dest.getUsers()) { assertNotNull(user.getUsername()); assertNotNull(userDto.getUsername()); if (user.getId().equals(userDto.getId())) { this.userDTOTranslatorTest.verifyOutput(userDto, user, childrenGenerated); } } } for (PermissionBlueprintDTO pdto : source.getPermissions()) { for (PermissionBlueprint pbp : dest.getPermissions()) { if (pbp.getId().equals(pdto.getId())) { this.permDTOTranslatorTest.verifyOutput(pdto, pbp, childrenGenerated); } } } } else { assertNotNull(dest.getUsers()); assertTrue(dest.getUsers().isEmpty()); assertNotNull(dest.getPermissions()); assertTrue(dest.getPermissions().isEmpty()); } } else { assertNull(dest); } }</code><technical_language>assertEquals source dest</technical_language>

Target:
protected void verifyOutput(RoleDTO source, Role dest, boolean childrenGenerated) { if (source != null) { assertEquals(source.getId(), dest.getId()); assertEquals(source.getName(), dest.getName()); if (childrenGenerated) { for (UserDTO userDto : source.getUsers()) { for (User user : dest.getUsers()) { assertNotNull(user.getUsername()); assertNotNull(userDto.getUsername()); if (user.getId() != null) { this.userDTOTranslatorTest.verifyOutput(userDto, user, childrenGenerated); } } } for (PermissionBlueprintDTO pdto : source.getPermissions()) { for (PermissionBlueprint pbp : dest.getPermissions()) { if (pbp.getId().equals(pdto.getId())) { this.permDTOTranslatorTest.verifyOutput(pdto, pbp, childrenGenerated); } } } } else { assertNotNull(dest.getUsers()); assertTrue(dest.getUsers().isEmpty()); assertNotNull(dest.getPermissions()); assertTrue(dest.getPermissions().isEmpty()); } } else { assertNull(dest); } }
Source:
<code>public void waitNoGitChangeMarkers() { webDriverWaitFactory <START> .get(DEFAULT_TIMEOUT) <END> .until( (ExpectedCondition<Boolean>) webDriver -> getListGitMarkers() .stream() .allMatch(element -> "".equals(element.getAttribute("class")))); }</code><technical_language>omit _DEFAULT_TIMEOUT_ parameter creation WebDriverWaitFactory#get() method DEFAULT_TIMEOUT inside</technical_language>

Target:
public void waitNoGitChangeMarkers() { webDriverWaitFactory .get() .until( (ExpectedCondition<Boolean>) webDriver -> getListGitMarkers() .stream() .allMatch(element -> "".equals(element.getAttribute("class")))); }
Source:
<code>public void writeTo(Path directory, Charset charset) throws IOException { checkArgument(Files.notExists(directory) || Files.isDirectory(directory), "path %s exists but is not a directory.", directory); Path outputDirectory = directory; if (!packageName.isEmpty()) { for (String packageComponent : packageName.split("\\.")) { outputDirectory = outputDirectory.resolve(packageComponent); } Files.createDirectories(outputDirectory); } Path outputPath = outputDirectory.resolve(typeSpec.name + ".java"); try (Writer writer = Files.newBufferedWriter(outputPath, <START> charset != null ? charset : Charset.defaultCharset())) { <END> writeTo(writer); } }</code><technical_language>Personal opinion: throw if null, overload explicitly pass default charset in</technical_language>

Target:
public void writeTo(Path directory, Charset charset) throws IOException { checkArgument(Files.notExists(directory) || Files.isDirectory(directory), "path %s exists but is not a directory.", directory); Path outputDirectory = directory; if (!packageName.isEmpty()) { for (String packageComponent : packageName.split("\\.")) { outputDirectory = outputDirectory.resolve(packageComponent); } Files.createDirectories(outputDirectory); } Path outputPath = outputDirectory.resolve(typeSpec.name + ".java"); try (Writer writer = Files.newBufferedWriter(outputPath, charset)) { writeTo(writer); } }
Source:
<code>void heapify(int index) { int leftNodeIndex = getLeftNodeIndex(index); int rightNodeIndex = getRightNodeIndex(index); int smallestElementIndex = index; <START> if (leftNodeIndex < heapNodes.length && heapNodes[leftNodeIndex].element < heapNodes[index].element) <END> smallestElementIndex = leftNodeIndex; if (rightNodeIndex < heapNodes.length && heapNodes[rightNodeIndex].element < heapNodes[smallestElementIndex].element) smallestElementIndex = rightNodeIndex; if (smallestElementIndex != index) { swap(index, smallestElementIndex); heapify(smallestElementIndex); } }</code><technical_language>{ } for line if/else bodies</technical_language>

Target:
void heapify(int index) { int leftNodeIndex = getLeftNodeIndex(index); int rightNodeIndex = getRightNodeIndex(index); int smallestElementIndex = index; if (leftNodeIndex < heapNodes.length && heapNodes[leftNodeIndex].element < heapNodes[index].element) { smallestElementIndex = leftNodeIndex; } if (rightNodeIndex < heapNodes.length && heapNodes[rightNodeIndex].element < heapNodes[smallestElementIndex].element) { smallestElementIndex = rightNodeIndex; } if (smallestElementIndex != index) { swap(index, smallestElementIndex); heapify(smallestElementIndex); } }
Source:
<code>public void shouldAddEnvVarsFromMachineConfigToContainerOnDevInstanceCreationFromRecipe() throws Exception { Map<String, String> envVarsFromConfig = new HashMap<>(); envVarsFromConfig.put("ENV_VAR1", "123"); envVarsFromConfig.put("ENV_VAR2", "234"); <START> provider = new MachineProviderImpl(dockerConnector, <END> dockerConnectorConfiguration, credentialsReader, dockerMachineFactory, dockerInstanceStopDetector, Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), null, workspaceFolderPathProvider, PROJECT_FOLDER_PATH, false, false, Collections.emptySet(), Collections.emptySet(), SNAPSHOT_USE_REGISTRY, MEMORY_SWAP_MULTIPLIER, emptySet()); final boolean isDev = true; CheServiceImpl machine = createService(); machine.setEnvironment(envVarsFromConfig); createInstanceFromRecipe(machine, isDev); ArgumentCaptor<CreateContainerParams> argumentCaptor = ArgumentCaptor.forClass(CreateContainerParams.class); verify(dockerConnector).createContainer(argumentCaptor.capture()); assertTrue(asList(argumentCaptor.getValue() .getContainerConfig() .getEnv()) .containsAll(envVarsFromConfig.entrySet() .stream() .map(entry -> entry.getKey() + "=" + entry.getValue()) .collect(Collectors.toList()))); }</code><technical_language>I code this java new MachineProviderImpl(dockerConnector, dockerConnectorConfiguration, credentialsReader, dockerMachineFactory, dockerInstanceStopDetector, Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), null, workspaceFolderPathProvider, PROJECT_FOLDER_PATH, false, false, Collections.emptySet(), Collections.emptySet(), SNAPSHOT_USE_REGISTRY, MEMORY_SWAP_MULTIPLIER, emptySet()); in tests. logical is some difference is obvious object creation, i understand test name this consideration i is nice code. I suggest create a helpful class produce needed instance of MachineProviderImpl e.g. MachineProviderImplBuilder a method produce default instance of set difference. example: java MachineProviderImplBuilder.initDefault() .setMemorySwapMultiplier(...) .build() In this simplify code for readers constructor parameters</technical_language>

Target:
public void shouldAddEnvVarsFromMachineConfigToContainerOnDevInstanceCreationFromRecipe() throws Exception { Map<String, String> envVarsFromConfig = new HashMap<>(); envVarsFromConfig.put("ENV_VAR1", "123"); envVarsFromConfig.put("ENV_VAR2", "234"); final boolean isDev = true; CheServiceImpl machine = createService(); machine.setEnvironment(envVarsFromConfig); createInstanceFromRecipe(machine, isDev); ArgumentCaptor<CreateContainerParams> argumentCaptor = ArgumentCaptor.forClass(CreateContainerParams.class); verify(dockerConnector).createContainer(argumentCaptor.capture()); assertTrue(asList(argumentCaptor.getValue() .getContainerConfig() .getEnv()) .containsAll(envVarsFromConfig.entrySet() .stream() .map(entry -> entry.getKey() + "=" + entry.getValue()) .collect(Collectors.toList()))); }
Source:
<code>protected void setUp() throws Exception { super.setUp(); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this.getContext()).build(); realm = Realm.getInstance(realmConfiguration); dynamicRealm = DynamicRealm.getInstance(realmConfiguration); <START> realm.executeTransaction(new Realm.Transaction() { <END> @Override public void execute(Realm realm) { realm.createObject(Dog.class); } }); }</code><technical_language>move existing objects populating Dog object</technical_language>

Target:
protected void setUp() throws Exception { super.setUp(); realmConfiguration = new RealmConfiguration.Builder(this.getContext()).build(); realm = Realm.getInstance(realmConfiguration); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { realm.createObject(Dog.class); } }); dynamicRealm = DynamicRealm.getInstance(realmConfiguration); }
Source:
<code>public void addDrugReferenceMap_shouldSetDrugAsTheDrugToWhichAMappingIsBeingAdded() throws Exception { Drug drug1 = new Drug(1); Drug drug2 = new Drug(2); DrugReferenceMap map = new DrugReferenceMap(1); map.setDrug(drug2); drug1.addDrugReferenceMap(map); <START> Assert.assertEquals(true, drug1.equals(drug1.getDrugReferenceMaps().iterator().next())); <END> }</code><technical_language>This is incorrect, comparing drugs</technical_language>

Target:
public void addDrugReferenceMap_shouldSetDrugAsTheDrugToWhichAMappingIsBeingAdded() throws Exception { Drug drug1 = new Drug(); drug1.setUuid(UUID_1); Drug drug2 = new Drug(); drug2.setUuid(UUID_2); DrugReferenceMap map = new DrugReferenceMap(1); map.setDrug(drug2); drug1.addDrugReferenceMap(map); Assert.assertEquals(drug1, drug1.getDrugReferenceMaps().iterator().next().getDrug()); }
Source:
<code>public static ArgumentProperty functionTypeArgumentProperty(Class lambdaInterface) { return new ArgumentProperty(false, Optional.empty(), Optional.of(lambdaInterface)); <START> } <END></code><technical_language>I understand this TODO</technical_language>

Target:
public static ArgumentProperty functionTypeArgumentProperty(Class lambdaInterface) { return new ArgumentProperty(FUNCTION_TYPE, Optional.empty(), Optional.of(lambdaInterface)); }