auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void processProbe() { verify(probe != null); PagesSpatialIndex pagesSpatialIndex = getDone(pagesSpatialIndexFuture); DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); while (probePosition < probe.getPositionCount()) { if (joinPositions == null) { joinPositions = pagesSpatialIndex.findJoinPositions(probePosition, probe, probeGeometryChannel); localUserMemoryContext.setBytes(sizeOf(joinPositions)); nextJoinPositionIndex = 0; matchFound = false; if (yieldSignal.isSet()) { return; } } while (nextJoinPositionIndex < joinPositions.length) { if (pageBuilder.isFull()) { return; } int joinPosition = joinPositions[nextJoinPositionIndex]; if (pagesSpatialIndex.isJoinPositionEligible(joinPosition, probePosition, probe)) { pageBuilder.declarePosition(); appendProbe(); pagesSpatialIndex.appendTo(joinPosition, pageBuilder, probeOutputChannels.size()); matchFound = true; } nextJoinPositionIndex++; if (yieldSignal.isSet()) { return; } } if (!matchFound && joinType == LEFT) { if (pageBuilder.isFull()) { return; } pageBuilder.declarePosition(); appendProbe(); <START> for (int i = 0; i < pagesSpatialIndexFactory.getOutputTypes().size(); i++) { <END> pageBuilder.getBlockBuilder(probeOutputChannels.size() + i).appendNull(); } } joinPositions = null; localUserMemoryContext.setBytes(0); probePosition++; } this.probe = null; this.probePosition = 0; }</code><technical_language>pagesSpatialIndexFactory.getOutputTypes().size() get inlined</technical_language>

Target:
private void processProbe() { verify(probe != null); PagesSpatialIndex pagesSpatialIndex = getDone(pagesSpatialIndexFuture); DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); while (probePosition < probe.getPositionCount()) { if (joinPositions == null) { joinPositions = pagesSpatialIndex.findJoinPositions(probePosition, probe, probeGeometryChannel); localUserMemoryContext.setBytes(sizeOf(joinPositions)); nextJoinPositionIndex = 0; matchFound = false; if (yieldSignal.isSet()) { return; } } while (nextJoinPositionIndex < joinPositions.length) { if (pageBuilder.isFull()) { return; } int joinPosition = joinPositions[nextJoinPositionIndex]; if (pagesSpatialIndex.isJoinPositionEligible(joinPosition, probePosition, probe)) { pageBuilder.declarePosition(); appendProbe(); pagesSpatialIndex.appendTo(joinPosition, pageBuilder, probeOutputChannels.size()); matchFound = true; } nextJoinPositionIndex++; if (yieldSignal.isSet()) { return; } } if (!matchFound && joinType == LEFT) { if (pageBuilder.isFull()) { return; } pageBuilder.declarePosition(); appendProbe(); int buildColumnCount = pagesSpatialIndexFactory.getOutputTypes().size(); for (int i = 0; i < buildColumnCount; i++) { pageBuilder.getBlockBuilder(probeOutputChannels.size() + i).appendNull(); } } joinPositions = null; localUserMemoryContext.setBytes(0); probePosition++; } this.probe = null; this.probePosition = 0; }
Source:
<code>protected void executeCommand() { Guid volumeId = getGlusterVolumeId(); GlusterVolumeSnapshotSchedule fetchedSchedule = getGlusterVolumeSnapshotScheduleDao().getByVolumeId(volumeId); String jobId = fetchedSchedule.getJobId(); getDbSchedulUtil().deleteJob(jobId); GlusterVolumeSnapshotSchedule schedule = getSchedule(); if (schedule.getRecurrence() != null) { Time originalExecutionTime = schedule.getExecutionTime(); try { String newJobId = scheduleJob(); if (newJobId != null) { setSucceeded(true); schedule.setJobId(newJobId); schedule.setExecutionTime(originalExecutionTime); getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, schedule); } else { <START> setSucceeded(false); <END> } } catch (Exception ex) { setSucceeded(false); handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESCHEDULE_FAILED, ex.getMessage()); } } else { getGlusterVolumeSnapshotScheduleDao().removeByVolumeId(volumeId); setSucceeded(true); } }</code><technical_language>this else case. scheduling fails showing error?</technical_language>

Target:
protected void executeCommand() { Guid volumeId = getGlusterVolumeId(); GlusterVolumeSnapshotSchedule fetchedSchedule = getGlusterVolumeSnapshotScheduleDao().getByVolumeId(volumeId); String jobId = fetchedSchedule.getJobId(); getDbSchedulUtil().deleteJob(jobId); GlusterVolumeSnapshotSchedule schedule = getSchedule(); if (schedule.getRecurrence() != null) { Time originalExecutionTime = schedule.getExecutionTime(); try { String newJobId = scheduleJob(); setSucceeded(true); schedule.setJobId(newJobId); schedule.setExecutionTime(originalExecutionTime); getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, schedule); } catch (Exception ex) { setSucceeded(false); handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESCHEDULE_FAILED, ex.getMessage()); } } else { getGlusterVolumeSnapshotScheduleDao().removeByVolumeId(volumeId); setSucceeded(true); } }
Source:
<code>private void addItemCollectionOnTarget(Collection<T> items, T target, String targetItemNotFoundErrorMessage, SerializableBiFunction<Integer, Boolean, Integer> insertItemsIndexProvider) { Objects.requireNonNull(items, NULL_COLLECTION_ERROR_MESSAGE); if (items.isEmpty()) { return; } final ListDataProvider<T> dataProvider = getDataProvider(); final Collection<T> backendItems = dataProvider.getItems(); if (!(backendItems instanceof List)) { throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, backendItems.getClass().getSimpleName())); } if (!contains(target)) { throw new IllegalArgumentException(targetItemNotFoundErrorMessage); } final List<T> itemList = (List<T>) backendItems; final AtomicBoolean containsTargetItem = new AtomicBoolean(false); items.forEach(item -> { if (equals(target, item)) { containsTargetItem.set(true); } else { removeItemIfPresent(item, dataProvider); } }); <START> int targetItemIndex = itemList.indexOf(target); <END> if (containsTargetItem.get()) { itemList.remove(targetItemIndex); } final int indexToInsertItems = insertItemsIndexProvider .apply(targetItemIndex, containsTargetItem.get()); itemList.addAll(indexToInsertItems, items); dataProvider.refreshAll(); }</code><technical_language>This fix solve problem, for limited cases equality of items based equals() method, indexOf find target. other hand, getItemIndex(target) searches filtered collection, is wrong. I need more version of getItemIndex() method (with another name) searches non-filtered collection takes account identifier provider</technical_language>

Target:
private void addItemCollectionOnTarget(Collection<T> items, T target, String targetItemNotFoundErrorMessage, SerializableBiFunction<Integer, Boolean, Integer> insertItemsIndexProvider) { Objects.requireNonNull(items, NULL_COLLECTION_ERROR_MESSAGE); if (items.isEmpty()) { return; } final ListDataProvider<T> dataProvider = getDataProvider(); final Collection<T> backendItems = dataProvider.getItems(); if (!(backendItems instanceof List)) { throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, backendItems.getClass().getSimpleName())); } if (!contains(target)) { throw new IllegalArgumentException(targetItemNotFoundErrorMessage); } final List<T> itemList = (List<T>) backendItems; final AtomicBoolean containsTargetItem = new AtomicBoolean(false); items.forEach(item -> { if (equals(target, item)) { containsTargetItem.set(true); } else { removeItemIfPresent(item, dataProvider); } }); int targetItemIndex = getItemIndex(target, itemList.stream()); if (containsTargetItem.get()) { itemList.remove(targetItemIndex); } final int indexToInsertItems = insertItemsIndexProvider .apply(targetItemIndex, containsTargetItem.get()); itemList.addAll(indexToInsertItems, items); dataProvider.refreshAll(); }
Source:
<code>public String toString() { return <START> "ArrayTimeRangeCondition: size=" + fTimeArray.length + ", min=" + min() + ", max =" + max(); END> }</code><technical_language>n["+fTimeArray.length+"]("+min()+'\u2025'+max()+')';</technical_language>

Target:
public String toString() { return "ArrayTimeRangeCondition[" + fTimeArray.length + "](" + min() + '\u2025' + max() + ')'; }
Source:
<code>public Page<ModuleMetadata> findAllByContainerId(Pageable pageable, String containerId) { <START> Assert.hasLength(containerId, "containerId is required"); <END> return pagingUtility.getPagedData(pageable, findAllByContainerId(containerId)); }</code><technical_language>Assert.hasText() more appropriate</technical_language>

Target:
public Page<ModuleMetadata> findAllByContainerId(Pageable pageable, String containerId) { Assert.hasText(containerId, "containerId is required"); return pagingUtility.getPagedData(pageable, findAllByContainerId(containerId)); }
Source:
<code>private boolean <START> shouldBeLoggedThroughPopup(Throwable <END> exception) { boolean value = false; value = exception instanceof LockedInstanceException || exception instanceof SecurityException; if (value) { value = exception.getMessage() != null && exception.getMessage() != StringUtil.EMPTY_STRING; } return value; }</code><technical_language>of test "exception.getMessage()"? this is message of exception is displayed result of getErrorMessage(Throwable) method ..</technical_language>

Target:
private boolean shouldBeLoggedThroughPopup(Throwable exception) { boolean shouldBeLogged = false; shouldBeLogged = exception instanceof LockedInstanceException || exception instanceof SecurityException; if (shouldBeLogged) { String message = getErrorMessage(exception); shouldBeLogged = message != null && !message.isEmpty(); } return shouldBeLogged; }
Source:
<code>public static FileSystem create(FileSystemContext context) { if (LOG.isDebugEnabled() && !CONF_LOGGED.getAndSet(true)) { AlluxioConfiguration conf = context.getClusterConf(); List<PropertyKey> keys = new ArrayList<>(conf.keySet()); keys.sort(Comparator.comparing(PropertyKey::getName)); for (PropertyKey key : keys) { String value = conf.getOrDefault(key, null); Source source = conf.getSource(key); LOG.debug("{}={} ({})", key.getName(), value, source); } } Class fsClass = context.getClusterConf().getClass(PropertyKey.USER_FILESYSTEM_CLASS); Class[] ctorArgClasses = new Class[] {FileSystemContext.class}; Object[] ctorArgs = new Object[] {context}; FileSystem fs = (FileSystem) CommonUtils.createNewClassInstance(fsClass, ctorArgClasses, ctorArgs); boolean dataCache = context.getClusterConf().getBoolean(PropertyKey.USER_LOCAL_CACHE_ENABLED); boolean metadataCache = context.getClusterConf().getBoolean(PropertyKey.USER_METADATA_CACHE_ENABLED); if (dataCache) { return metadataCache ? new MetadataCachingLocalCacheFileSystem(fs, context) <START> : new LocalCacheFileSystem(fs); <END> } else { return metadataCache ? new MetadataCachingBaseFileSystem(fs, context) : fs; } }</code><technical_language>Instead of a separate MetadataCachingLocalCacheFileSystem, compose LocalCacheFileSystem(MetadataCachingBaseFileSystem)</technical_language>

Target:
public static FileSystem create(FileSystemContext context) { AlluxioConfiguration conf = context.getClusterConf(); if (LOG.isDebugEnabled() && !CONF_LOGGED.getAndSet(true)) { List<PropertyKey> keys = new ArrayList<>(conf.keySet()); keys.sort(Comparator.comparing(PropertyKey::getName)); for (PropertyKey key : keys) { String value = conf.getOrDefault(key, null); Source source = conf.getSource(key); LOG.debug("{}={} ({})", key.getName(), value, source); } } FileSystem fs = conf.getBoolean(PropertyKey.USER_METADATA_CACHE_ENABLED) ? new MetadataCachingBaseFileSystem(context) : new BaseFileSystem(context); if (conf.getBoolean(PropertyKey.USER_CLIENT_CACHE_ENABLED)) { return new LocalCacheFileSystem(fs, conf); } return fs; }
Source:
<code><START> private static void run(String[] args) throws Exception { <END> if (args.length < 2 || args.length > 4) { throw new ToolsException( " usage: java com.sforce.ws.tools.wsdlc -nc <wsdl-file> <jar-file> <dest-dir>"); } boolean compile = true; String destJarFilename = null; String wsdlUrl = null; String destDir = null; for (String arg : args) { if (arg.equals("-nc")) { compile = false; } else if (wsdlUrl == null) { wsdlUrl = arg; } else if (destJarFilename == null) { destJarFilename = arg; } else if (destDir == null) { destDir = arg; } else { throw new ToolsException(" usage: java com.sforce.ws.tools.wsdlc -nc <wsdl-file> <jar-file> <dest-dir>"); } } String packagePrefix = System.getProperty(PACKAGE_PREFIX); boolean standAlone = Boolean.parseBoolean(System.getProperty(STANDALONE_JAR, "false")); boolean javaTime = Boolean.parseBoolean(System.getProperty(wsdlc.JAVA_TIME, "false")); STGroupDir stGroupDir = new STGroupDir(TEMPLATE_DIR, '$', '$'); run(wsdlUrl, destJarFilename, packagePrefix, javaTime, standAlone, stGroupDir, destDir, compile); }</code><technical_language>curious, choose this private</technical_language>

Target:
static void run(String[] args) throws Exception { if (args.length < 2 || args.length > 4) { throw new ToolsException( " usage: java com.sforce.ws.tools.wsdlc -nc <wsdl-file> <jar-file> <dest-dir>"); } boolean compile = true; String destJarFilename = null; String wsdlUrl = null; String destDir = null; for (String arg : args) { if (arg.equals("-nc")) { compile = false; } else if (wsdlUrl == null) { wsdlUrl = arg; } else if (destJarFilename == null) { destJarFilename = arg; } else if (destDir == null) { destDir = arg; } else { throw new ToolsException(" usage: java com.sforce.ws.tools.wsdlc -nc <wsdl-file> <jar-file> <dest-dir>"); } } String packagePrefix = System.getProperty(PACKAGE_PREFIX); boolean standAlone = Boolean.parseBoolean(System.getProperty(STANDALONE_JAR, "false")); boolean javaTime = Boolean.parseBoolean(System.getProperty(wsdlc.JAVA_TIME, "false")); STGroupDir stGroupDir = new STGroupDir(TEMPLATE_DIR, '$', '$'); run(wsdlUrl, destJarFilename, packagePrefix, javaTime, standAlone, stGroupDir, destDir, compile); }
Source:
<code>CloudBlobStore(PartitionId partitionId, CloudConfig cloudConfig, CloudDestination cloudDestination) { this.partitionId = Objects.requireNonNull(partitionId, "partitionId is required"); this.cloudConfig = Objects.requireNonNull(cloudConfig, "cloudConfig is required"); this.cloudDestination = Objects.requireNonNull(cloudDestination, "cloudDestination is required"); <START> minTtlMillis = cloudConfig.vcrMinTtlDays * TimeUnit.DAYS.toMillis(1); <END> }</code><technical_language>TimeUnit.DAYS.toMillis(cloudConfig.vcrMinTtlDays)</technical_language>

Target:
CloudBlobStore(PartitionId partitionId, CloudConfig cloudConfig, CloudDestination cloudDestination) { this.partitionId = Objects.requireNonNull(partitionId, "partitionId is required"); this.cloudConfig = Objects.requireNonNull(cloudConfig, "cloudConfig is required"); this.cloudDestination = Objects.requireNonNull(cloudDestination, "cloudDestination is required"); minTtlMillis = TimeUnit.DAYS.toMillis(cloudConfig.vcrMinTtlDays); }
Source:
<code>public Path(String path) { int index = path.indexOf('?'); int semi = path.indexOf(';'); if ((semi != -1)) { if (index != -1) { <START> path = path.substring(0, semi) + path.substring(index, path.length()); <END> } else { path = path.substring(0, semi); } } if (index == -1) { _requestURI = path; _queryString = null; } else { _requestURI = path.substring(0, index); _queryString = path.substring(index + 1); } index = _requestURI.lastIndexOf('.'); if ((index == -1) || (index < _requestURI.lastIndexOf('/'))) { _extension = null; } else { _extension = _requestURI.substring(index + 1); } }</code><technical_language>Is a path '?' ';'</technical_language>

Target:
public Path(String path) { int index = path.indexOf('?'); int semi = path.indexOf(';'); if (semi != -1) { if (index > semi) { path = path.substring(0, semi) + path.substring(index, path.length()); } else if (index == -1) { path = path.substring(0, semi); } } if (index == -1) { _requestURI = path; _queryString = null; } else { _requestURI = path.substring(0, index); _queryString = path.substring(index + 1); } index = _requestURI.lastIndexOf('.'); if ((index == -1) || (index < _requestURI.lastIndexOf('/'))) { _extension = null; } else { _extension = _requestURI.substring(index + 1); } }
Source:
<code>private FBO getFbo() { if (defaultDynamicFBO == null) return frameBuffersManager.get(fboName); <START> return defaultDynamicFBO.getFbo(); <END> }</code><technical_language>A ternary statement is fine here</technical_language>

Target:
private FBO getFbo() { return defaultDynamicFBO != null ? defaultDynamicFBO.getFbo() : frameBuffersManager.get(fboName); }
Source:
<code><START> public void testTypedefSyntheticMembers_415495() { <END> final String[] expected= { "" }; assertCompletionResults(fCursorOffset, expected, REPLACEMENT); }</code><technical_language>a good idea run tests submitting Gerrit</technical_language>

Target:
public void testTypedefSyntheticMembers_415495() throws Exception { final String[] expected= {}; assertCompletionResults(fCursorOffset, expected, REPLACEMENT); }
Source:
<code>public void testFindTaskEventsForNotExistingTask() { try { taskClient.findTaskEvents(CONTAINER_ID, -9999l, 0, 10); fail("KieServicesException should be thrown complaining about task not found."); } catch (KieServicesException e) { <START> KieServerAssert.assertResultContainsString(e.getMessage(), "No task found with id"); <END> } }</code><technical_language>good check HTTP status code</technical_language>

Target:
public void testFindTaskEventsForNotExistingTask() { try { taskClient.findTaskEvents(CONTAINER_ID, -9999l, 0, 10); fail("KieServicesException should be thrown complaining about task not found."); } catch (KieServicesException e) { KieServerAssert.assertResultContainsString(e.getMessage(), "No task found with id"); if(configuration.isRest()) { KieServicesHttpException httpEx = (KieServicesHttpException) e; assertEquals("Exception has wrong HTTP Response code.", Integer.valueOf(404), httpEx.getHttpCode()); } } }
Source:
<code>public void mergeProjectsInvalidSameNameTests() { openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext()); onView(withText(R.string.merge)).perform(click()); onRecyclerView().atPosition(0) .performCheckItem(); onRecyclerView().atPosition(1) .performCheckItem(); onView(withId(R.id.confirm)).perform(click()); onView(allOf(withText(""), isDisplayed(), instanceOf(EditText.class))) .perform(replaceText(inValidName)); closeSoftKeyboard(); <START> onView(Matchers.allOf(withId(android.R.id.button1), withText(R.string.ok))) <END> .check(matches(Matchers.allOf(isDisplayed(), not(isEnabled())))); }</code><technical_language>please static imported method (allOf) in onView above</technical_language>

Target:
public void mergeProjectsInvalidSameNameTests() { openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext()); onView(withText(R.string.merge)).perform(click()); onRecyclerView().atPosition(0) .performCheckItem(); onRecyclerView().atPosition(1) .performCheckItem(); onView(withId(R.id.confirm)).perform(click()); onView(allOf(withText(""), isDisplayed(), instanceOf(EditText.class))) .perform(replaceText(INVALIDNAME)); closeSoftKeyboard(); onView(allOf(withId(android.R.id.button1), withText(R.string.ok))) .check(matches(Matchers.allOf(isDisplayed(), not(isEnabled())))); }
Source:
<code>private List<? extends DiscoverySelector> createDiscoverySelectors(CommandLineOptions options) { if (options.isScanClasspath()) { Preconditions.condition(!options.hasExplicitSelectors(), "Scanning the classpath and using explicit selectors at the same time is not supported"); return createClasspathRootSelectors(options); } if (options.isScanModulepath()) { Preconditions.condition(!options.hasExplicitSelectors(), "Scanning the module-path and using explicit selectors at the same time is not supported"); return Collections.singletonList(DiscoverySelectors.selectModule("ALL-MODULES")); <START> } <END> return createExplicitDiscoverySelectors(options); }</code><technical_language>reference constant here? extra blank line return</technical_language>

Target:
private List<? extends DiscoverySelector> createDiscoverySelectors(CommandLineOptions options) { if (options.isScanClasspath()) { Preconditions.condition(!options.hasExplicitSelectors(), "Scanning the classpath and using explicit selectors at the same time is not supported"); return createClasspathRootSelectors(options); } if (options.isScanModulepath()) { Preconditions.condition(!options.hasExplicitSelectors(), "Scanning the module-path and using explicit selectors at the same time is not supported"); return Collections.singletonList(DiscoverySelectors.selectModule(ModuleUtils.ALL_MODULES)); } return createExplicitDiscoverySelectors(options); }
Source:
<code>private List<AwsServiceEndpointView> createInterfaceServiceEndpointsIfNeeded(NetworkCreationRequest networkCreationRequest, List<SubnetRequest> subnets) { <START> if (USE_SERVICE_ENDPOINT.equals(networkCreationRequest.getEndpointType()) && CollectionUtils.isNotEmpty(interfaceServices)) { <END> List<AwsServiceEndpointView> interfaceServiceEndpoints = createInterfaceServiceEndpoints(networkCreationRequest, subnets); LOGGER.debug("The following interface service endpoints will be created in the new vpc: {}", interfaceServiceEndpoints); return interfaceServiceEndpoints; } else { LOGGER.debug("No interface service endpoints will be created in the new vpc. serviceEndpointCreation: {}, interfaceServices: {}", networkCreationRequest.getEndpointType(), interfaceServices); return List.of(); } }</code><technical_language>please compare enums ==</technical_language>

Target:
private List<AwsServiceEndpointView> createInterfaceServiceEndpointsIfNeeded(NetworkCreationRequest networkCreationRequest, List<SubnetRequest> subnets) { if (USE_SERVICE_ENDPOINT == networkCreationRequest.getEndpointType() && CollectionUtils.isNotEmpty(interfaceServices)) { List<AwsServiceEndpointView> interfaceServiceEndpoints = createInterfaceServiceEndpoints(networkCreationRequest, subnets); LOGGER.debug("The following interface service endpoints will be created in the new vpc: {}", interfaceServiceEndpoints); return interfaceServiceEndpoints; } else { LOGGER.debug("No interface service endpoints will be created in the new vpc. serviceEndpointCreation: {}, interfaceServices: {}", networkCreationRequest.getEndpointType(), interfaceServices); return List.of(); } }
Source:
<code>public void testGetPartitionsSample() { HivePartition p1 = partition("p1=string1/p2=1234"); HivePartition p2 = partition("p1=string2/p2=2345"); HivePartition p3 = partition("p1=string3/p2=3456"); HivePartition p4 = partition("p1=string4/p2=4567"); HivePartition p5 = partition("p1=string5/p2=5678"); assertEquals(getPartitionsSample(ImmutableList.of(p1), 1), ImmutableList.of(p1)); assertEquals(getPartitionsSample(ImmutableList.of(p1), 2), ImmutableList.of(p1)); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2), 2), ImmutableList.of(p1, p2)); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2, p3), 2), ImmutableList.of(p1, p3)); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2, p3, p4), 1), getPartitionsSample(ImmutableList.of(p1, p2, p3, p4), 1)); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2, p3, p4), 3), getPartitionsSample(ImmutableList.of(p1, p2, p3, p4), 3)); assertThat(getPartitionsSample(ImmutableList.of(p1, p2, p3, p4), 3)).contains(p1, p4); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2, p3, p4, p5), 3).size(), 3); <START> assertThat(getPartitionsSample(ImmutableList.of(p1, p2, p3, p4, p5), 3)).contains(p1, p4, p5); <END> }</code><technical_language>@arhimondr deterministic sampling, this check upgraded equality check</technical_language>

Target:
public void testGetPartitionsSample() { HivePartition p1 = partition("p1=string1/p2=1234"); HivePartition p2 = partition("p1=string2/p2=2345"); HivePartition p3 = partition("p1=string3/p2=3456"); HivePartition p4 = partition("p1=string4/p2=4567"); HivePartition p5 = partition("p1=string5/p2=5678"); assertEquals(getPartitionsSample(ImmutableList.of(p1), 1), ImmutableList.of(p1)); assertEquals(getPartitionsSample(ImmutableList.of(p1), 2), ImmutableList.of(p1)); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2), 2), ImmutableList.of(p1, p2)); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2, p3), 2), ImmutableList.of(p1, p3)); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2, p3, p4), 1), getPartitionsSample(ImmutableList.of(p1, p2, p3, p4), 1)); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2, p3, p4), 3), getPartitionsSample(ImmutableList.of(p1, p2, p3, p4), 3)); assertEquals(getPartitionsSample(ImmutableList.of(p1, p2, p3, p4, p5), 3), ImmutableList.of(p1, p5, p4)); }
Source:
<code>public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptyTopEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_CANCELLING, <START> ""); <END> }</code><technical_language>suggestion EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptyTopEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_CANCELLING, EMPTY_VALUE); }
Source:
<code>public void removeChannel(WriteOnlyClient client) { Iterator<PhysicalNode> iterator = physicalNodes.iterator(); <START> while (iterator.hasNext()) { <END> if (iterator.next().getClient() == client) { iterator.remove(); break; } } }</code><technical_language>I is wrong existing remove a channel other extra hash lookup. Java 8 upgrade, changed physicalNodes.removeIf(pn -> pn.getClient().equals(client));</technical_language>

Target:
public void removeChannel(WriteOnlyClient client) { physicalNodes.removeIf(node -> (node.getClient().equals(client))); }
Source:
<code>public void contains() throws IOException { Assert.assertFalse(this.client.getConfig().getMap().containsKey(this.testKey)); this.client.getConfig().put(this.testKey, this.testKeyValue); <START> Assert.assertTrue(this.client.getConfig().getMap().containsKey(this.testKey)); <END> }</code><technical_language>assertTrues missed intentionally converted</technical_language>

Target:
public void contains() throws IOException { assertThat(this.client.getConfig().getMap().keySet(), not(Matchers.contains(this.testKey))); this.client.getConfig().put(this.testKey, this.testKeyValue); assertThat(this.client.getConfig().getMap().keySet(), not(Matchers.contains(this.testKey))); }
Source:
<code>private void reportLeak() { <START> if (isLeakReportingEnabled()) { <END> clearRefQueue(); return; } for (;;) { @SuppressWarnings("unchecked") DefaultResourceLeak ref = (DefaultResourceLeak) refQueue.poll(); if (ref == null) { break; } if (!ref.dispose()) { continue; } String records = ref.toString(); if (reportedLeaks.putIfAbsent(records, Boolean.TRUE) == null) { if (records.isEmpty()) { reportUntracedLeak(resourceType); } else { reportTracedLeak(resourceType, records); } } } }</code><technical_language>This if (! isLeakReportingEnabled())</technical_language>

Target:
private void reportLeak() { if (!isLeakReportingEnabled()) { clearRefQueue(); return; } for (;;) { @SuppressWarnings("unchecked") DefaultResourceLeak ref = (DefaultResourceLeak) refQueue.poll(); if (ref == null) { break; } if (!ref.dispose()) { continue; } String records = ref.toString(); if (reportedLeaks.putIfAbsent(records, Boolean.TRUE) == null) { if (records.isEmpty()) { reportUntracedLeak(resourceType); } else { reportTracedLeak(resourceType, records); } } } }
Source:
<code>public Request checkUpgradeSession(Request request) throws IOException, KeeperException { if ((request.type != OpCode.create && request.type != OpCode.create2 && request.type != OpCode.multi) || !upgradeableSessionTracker.isLocalSession(request.sessionId)) { return null; } if (OpCode.multi == request.type) { MultiTransactionRecord multiTransactionRecord = new MultiTransactionRecord(); request.request.rewind(); ByteBufferInputStream.byteBuffer2Record(request.request, multiTransactionRecord); request.request.rewind(); boolean containsEphemeralCreate = false; for (Op op : multiTransactionRecord) { if (op.getType() == OpCode.create || op.getType() == OpCode.create2) { CreateRequest createRequest = (CreateRequest)op.toRequestRecord(); CreateMode createMode = CreateMode.fromFlag(createRequest.getFlags()); if (createMode.isEphemeral()) { <START> containsEphemeralCreate = true; <END> } } } if (!containsEphemeralCreate) { return null; } } else { CreateRequest createRequest = new CreateRequest(); request.request.rewind(); ByteBufferInputStream.byteBuffer2Record(request.request, createRequest); request.request.rewind(); CreateMode createMode = CreateMode.fromFlag(createRequest.getFlags()); if (!createMode.isEphemeral()) { return null; } } if (!self.isLocalSessionsUpgradingEnabled()) { throw new KeeperException.EphemeralOnLocalSessionException(); } return makeUpgradeRequest(request.sessionId); }</code><technical_language>I break loop - is need check rest of ops long is ephemeral / create upgrade session</technical_language>

Target:
public Request checkUpgradeSession(Request request) throws IOException, KeeperException { if ((request.type != OpCode.create && request.type != OpCode.create2 && request.type != OpCode.multi) || !upgradeableSessionTracker.isLocalSession(request.sessionId)) { return null; } if (OpCode.multi == request.type) { MultiTransactionRecord multiTransactionRecord = new MultiTransactionRecord(); request.request.rewind(); ByteBufferInputStream.byteBuffer2Record(request.request, multiTransactionRecord); request.request.rewind(); boolean containsEphemeralCreate = false; for (Op op : multiTransactionRecord) { if (op.getType() == OpCode.create || op.getType() == OpCode.create2) { CreateRequest createRequest = (CreateRequest)op.toRequestRecord(); CreateMode createMode = CreateMode.fromFlag(createRequest.getFlags()); if (createMode.isEphemeral()) { containsEphemeralCreate = true; break; } } } if (!containsEphemeralCreate) { return null; } } else { CreateRequest createRequest = new CreateRequest(); request.request.rewind(); ByteBufferInputStream.byteBuffer2Record(request.request, createRequest); request.request.rewind(); CreateMode createMode = CreateMode.fromFlag(createRequest.getFlags()); if (!createMode.isEphemeral()) { return null; } } if (!self.isLocalSessionsUpgradingEnabled()) { throw new KeeperException.EphemeralOnLocalSessionException(); } return makeUpgradeRequest(request.sessionId); }
Source:
<code>public List<EmploymentSummary> getEmploymentSummaryList(String userOrcid) { <START> List<OrgAffiliationRelationEntity> employmentEntities = orgAffiliationRelationDao.getByUserAndType(userOrcid, AffiliationType.EMPLOYMENT); <END> return jpaJaxbEmploymentAdapter.toEmploymentSummary(employmentEntities); }</code><technical_language>1. some of 2.0 managers, **cacheable** annotation is removed, some times is moved DAO, some other times (like this _orgAffiliationRelationDao.getByUserAndType(userOrcid, AffiliationType.EMPLOYMENT)_) is removed, this generate impact databases, please iterate 2.0 managers verify removing existing caches, and, change 3.0 managers consistent, so, managers cache in (both manager DAO) 1.1: I remember a discussion years in want cache manager level, I remember reasons why, want manager level care of DAO layer fetch fresh DB? @wjrsimpson do remember that? is ok if this do audit caches DAO layer move managers? if so, do do in another PR</technical_language>

Target:
public List<EmploymentSummary> getEmploymentSummaryList(String userOrcid) { List<OrgAffiliationRelationEntity> employmentEntities = orgAffiliationRelationDao.getEmploymentSummaries(userOrcid, getLastModified(userOrcid)); return jpaJaxbEmploymentAdapter.toEmploymentSummary(employmentEntities); }
Source:
<code>void moveToFinally() throws CommandLineException { <START> if(finallyList == null) { <END> finallyList = new ArrayList<>(); } switch(state) { case IN_TRY: state = IN_FINALLY; break; case IN_CATCH: state = IN_FINALLY; break; case IN_FINALLY: throw new CommandLineException("Already in finally"); default: throw new IllegalStateException("Unexpected block id: " + state); } }</code><technical_language>move list initialisation in switch (IN_TRY IN_CATCH). so, need check for null initialise list needed. get rid-off a call break merge 2 cases</technical_language>

Target:
void moveToFinally() throws CommandLineException { switch(state) { case IN_TRY: case IN_CATCH: finallyList = new ArrayList<>(); state = IN_FINALLY; break; case IN_FINALLY: throw new CommandLineException("Already in finally"); default: throw new IllegalStateException("Unexpected block id: " + state); } }
Source:
<code>public byte[][] split(byte[] input) { <START> int len = input.length + (256 - input.length % 256); <END> int nFragments = len / Fragment.MAX_LENGTH; if (len % Fragment.MAX_LENGTH > 0) nFragments++; byte[][] split = new byte[nFragments][]; for(int i= 0; i< nFragments; ++i) { int start = Fragment.MAX_LENGTH * i; int end = Math.min(input.length, start + Fragment.MAX_LENGTH); int length = end - start; byte[] b = new byte[length]; System.arraycopy(input, start, b, 0, length); split[i] = b; } return split; }</code><technical_language>if input.length is a multiple of 256? wont this add extra 256 bytes</technical_language>

Target:
public byte[][] split(byte[] input) { int padding = 0; int mod = input.length % 256; if (mod != 0 || input.length == 0) padding = 256 - mod; int len = input.length + padding; int nFragments = len / Fragment.MAX_LENGTH; if (len % Fragment.MAX_LENGTH > 0) nFragments++; byte[][] split = new byte[nFragments][]; for(int i= 0; i< nFragments; ++i) { int start = Fragment.MAX_LENGTH * i; int end = Math.min(input.length, start + Fragment.MAX_LENGTH); int length = end - start; byte[] b = new byte[length]; System.arraycopy(input, start, b, 0, length); split[i] = b; } return split; }
Source:
<code>public void updateImagePath(List<Process> processes) { for (Process proz : processes) { try { FileformatInterface myRdf = serviceManager.getProcessService().readMetadataFile(proz); MetadataTypeInterface mdt = UghHelper.getMetadataType(proz, "pathimagefiles"); List<? extends MetadataInterface> allImagePaths = myRdf.getDigitalDocument().getPhysicalDocStruct() .getAllMetadataByType(mdt); if (allImagePaths.size() > 0) { for (MetadataInterface md : allImagePaths) { myRdf.getDigitalDocument().getPhysicalDocStruct().getAllMetadata().remove(md); } } MetadataInterface newmd = UghImplementation.INSTANCE.createMetadata(mdt); if (SystemUtils.IS_OS_WINDOWS) { newmd.setStringValue("file:/" + serviceManager.getFileService().getImagesDirectory(proz) + proz.getTitle() + DIRECTORY_SUFFIX); } else { newmd.setStringValue("file://" + serviceManager.getFileService().getImagesDirectory(proz) + proz.getTitle() + DIRECTORY_SUFFIX); } myRdf.getDigitalDocument().getPhysicalDocStruct().addMetadata(newmd); serviceManager.getFileService().writeMetadataFile(myRdf, proz); Helper.setMeldung("kitodoScriptfield", "ImagePath updated: ", proz.getTitle()); <START> } catch (org.kitodo.api.ugh.exceptions.DocStructHasNoTypeException | UghHelperException <END> | MetadataTypeNotAllowedException e) { Helper.setFehlerMeldung(e.getMessage()); } catch (Exception e) { Helper.setFehlerMeldung("kitodoScriptfield", "Error while updating imagepath", e); } } Helper.setMeldung("kitodoScriptfield", "", "updateImagePath finished"); }</code><technical_language>Please do full name of exception if short name work too</technical_language>

Target:
public void updateImagePath(List<Process> processes) { for (Process proz : processes) { try { FileformatInterface myRdf = serviceManager.getProcessService().readMetadataFile(proz); MetadataTypeInterface mdt = UghHelper.getMetadataType(proz, "pathimagefiles"); List<? extends MetadataInterface> allImagePaths = myRdf.getDigitalDocument().getPhysicalDocStruct() .getAllMetadataByType(mdt); if (allImagePaths.size() > 0) { for (MetadataInterface md : allImagePaths) { myRdf.getDigitalDocument().getPhysicalDocStruct().getAllMetadata().remove(md); } } MetadataInterface newmd = UghImplementation.INSTANCE.createMetadata(mdt); if (SystemUtils.IS_OS_WINDOWS) { newmd.setStringValue("file:/" + serviceManager.getFileService().getImagesDirectory(proz) + proz.getTitle() + DIRECTORY_SUFFIX); } else { newmd.setStringValue("file://" + serviceManager.getFileService().getImagesDirectory(proz) + proz.getTitle() + DIRECTORY_SUFFIX); } myRdf.getDigitalDocument().getPhysicalDocStruct().addMetadata(newmd); serviceManager.getFileService().writeMetadataFile(myRdf, proz); Helper.setMeldung("kitodoScriptfield", "ImagePath updated: ", proz.getTitle()); } catch (DocStructHasNoTypeException | UghHelperException | MetadataTypeNotAllowedException e) { Helper.setFehlerMeldung(e.getMessage()); } catch (Exception e) { Helper.setFehlerMeldung("kitodoScriptfield", "Error while updating imagepath", e); } } Helper.setMeldung("kitodoScriptfield", "", "updateImagePath finished"); }
Source:
<code>protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder c = getDefaultStandaloneCacheConfig(true); c.locking().isolationLevel(IsolationLevel.READ_COMMITTED); <START> EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(false); <END> multimapCache = EmbeddedMultimapCacheManagerFactory.get("test", cm, c.build()); return cm; }</code><technical_language>test pessimistic optimistic transactions, pessimistic RC RR isolation levels. multi-node tests reveal more issues single-node ones, I (testing owner non-owner variant)</technical_language>

Target:
protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder c = getDefaultStandaloneCacheConfig(true); c.locking().isolationLevel(IsolationLevel.READ_COMMITTED); EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(false); MultimapCacheManager multimapCacheManager = EmbeddedMultimapCacheManagerFactory.from(cm); multimapCacheManager.defineConfiguration("test", c.build()); multimapCache = multimapCacheManager.get("test"); return cm; }
Source:
<code>public void startLog() { <START> (new RangerLoadBegin(sourceDbName, targetDbName, estimatedNumPolicies)).log(LogTag.RANGER_LOAD_START); <END> }</code><technical_language>nit: Remove extra brackets</technical_language>

Target:
public void startLog() { new RangerLoadBegin(sourceDbName, targetDbName, estimatedNumPolicies).log(LogTag.RANGER_LOAD_START); }
Source:
<code>public User getUser(String username) { User user = authentication.getUser(username); return user; <START> } <END></code><technical_language>return authentication.getUser(username);</technical_language>

Target:
public User getUser(String username) { return authentication.getUser(username); }
Source:
<code>public void getNettyServerFactoryWithBadInputTest() throws Exception { Properties properties = new Properties(); VerifiableProperties verifiableProperties = new VerifiableProperties(properties); MetricRegistry metricRegistry = new MetricRegistry(); RestRequestHandler restRequestHandler = new MockRestRequestResponseHandler(); PublicAccessLogger publicAccessLogger = new PublicAccessLogger(new String[]{}, new String[]{}); RestServerState restServerState = new RestServerState("/healthCheck"); SSLFactory sslFactory = new MockSSLFactory(verifiableProperties); <START> for (int i = 0; i < 5; i++) { <END> try { new NettyServerFactory(i == 0 ? verifiableProperties : null, i == 1 ? metricRegistry : null, i == 2 ? restRequestHandler : null, i == 3 ? publicAccessLogger : null, i == 4 ? restServerState : null, sslFactory); fail("Instantiation should have failed because argument " + i + " was null"); } catch (IllegalArgumentException e) { } } properties.setProperty("netty.server.ssl.port", "abcd"); try { new NettyServerFactory(verifiableProperties, metricRegistry, restRequestHandler, publicAccessLogger, restServerState, sslFactory); fail("NettyServerFactory instantiation should have failed because of bad port number value"); } catch (NumberFormatException e) { } }</code><technical_language>write a doConstructionFailureTest() pass arguments testing null? This is a hard read IMO</technical_language>

Target:
public void getNettyServerFactoryWithBadInputTest() { Properties properties = new Properties(); properties.setProperty("netty.server.enable.ssl", "true"); VerifiableProperties verifiableProperties = new VerifiableProperties(properties); MetricRegistry metricRegistry = new MetricRegistry(); doConstructionFailureTest(null, metricRegistry, REST_REQUEST_HANDLER, PUBLIC_ACCESS_LOGGER, REST_SERVER_STATE, SSL_FACTORY); doConstructionFailureTest(verifiableProperties, null, REST_REQUEST_HANDLER, PUBLIC_ACCESS_LOGGER, REST_SERVER_STATE, SSL_FACTORY); doConstructionFailureTest(verifiableProperties, metricRegistry, null, PUBLIC_ACCESS_LOGGER, REST_SERVER_STATE, SSL_FACTORY); doConstructionFailureTest(verifiableProperties, metricRegistry, REST_REQUEST_HANDLER, null, REST_SERVER_STATE, SSL_FACTORY); doConstructionFailureTest(verifiableProperties, metricRegistry, REST_REQUEST_HANDLER, PUBLIC_ACCESS_LOGGER, null, SSL_FACTORY); doConstructionFailureTest(verifiableProperties, metricRegistry, REST_REQUEST_HANDLER, PUBLIC_ACCESS_LOGGER, REST_SERVER_STATE, null); }
Source:
<code>public JsonNode toJson() { ArrayNode arr = getFactory().arrayNode(); arr.add(getFactory().numberNode(from)).add(getFactory().numberNode(to)); <START> return ((ObjectNode) super.toJson()).set("range", arr); <END> }</code><technical_language>need null check here, create a nullNode if from/to is null, instead of a numberNode</technical_language>

Target:
public JsonNode toJson() { ArrayNode arr = getFactory().arrayNode(); if (from == null) { arr.add(getFactory().nullNode()); if (to == null) { arr.add(getFactory().nullNode()); } else { arr.add(getFactory().numberNode(to)); } } else if (from != null) { arr.add(getFactory().numberNode(from)); if (to == null) { arr.add(getFactory().nullNode()); } else { arr.add(getFactory().numberNode(to)); } } return ((ObjectNode) super.toJson()).set("range", arr); }
Source:
<code>public void testHappyPath() throws Exception { CoordinatorEventBlockingQueue eventBlockingQueue = new CoordinatorEventBlockingQueue(); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(false)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(true)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(false)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(true)); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test2")); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); <START> eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); <END> Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderDoAssignmentEvent(false)); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderDoAssignmentEvent(true)); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderPartitionAssignmentEvent("test2")); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); }</code><technical_language>Thinking out loud: assert total number of events _actually_ in queue puts, takes exhaust them</technical_language>

Target:
public void testHappyPath() throws Exception { CoordinatorEventBlockingQueue eventBlockingQueue = new CoordinatorEventBlockingQueue(); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(false)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(true)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(false)); eventBlockingQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent(true)); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); eventBlockingQueue.put(CoordinatorEvent.createLeaderPartitionAssignmentEvent("test2")); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); eventBlockingQueue.put(CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); Assert.assertEquals(eventBlockingQueue.size(), 5); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderDoAssignmentEvent(false)); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderDoAssignmentEvent(true)); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderPartitionAssignmentEvent("test1")); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.createLeaderPartitionAssignmentEvent("test2")); Assert.assertEquals(eventBlockingQueue.take(), CoordinatorEvent.HANDLE_ASSIGNMENT_CHANGE_EVENT); }