auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ContextKey(final String contextKey) { <START> if (contextKey == null) { throw new IllegalArgumentException("contextKey must not be null"); } <END> final String arr[] = contextKey.split(":"); if (arr.length != 2) { throw new IllegalArgumentException("contextKey must be in the format 'context:key'"); } this.context = arr[0]; this.key = arr[1]; }</code><technical_language>suggestion Objects.requireNonNull(contextKey , "contextKey null");</technical_language>

Target:
public ContextKey(final String contextKey) { Objects.requireNonNull(contextKey , "contextKey must not be null"); final String arr[] = contextKey.split(":"); if (arr.length != 2) { throw new IllegalArgumentException("contextKey '" + contextKey + "' must be in the format 'context:key'"); } this.context = arr[0]; this.key = arr[1]; }
Source:
<code>private ValidationResult validateRequiredNetworksAvailable(VDS vds, VM vm, List<VmNetworkInterface> vmNICs, Network displayNetwork, Map<String, Network> networksByName, List<String> hostNetworks, VdsNetworkInterface displayNic) { List<String> missingIfs = new ArrayList<>(); boolean onlyRequiredNetworks = Config.<Boolean> getValue(ConfigValues.OnlyRequiredNetworksMandatoryForVdsSelection); for (final VmNetworkInterface vmIf : vmNICs) { boolean found = false; if (vmIf.getNetworkName() == null) { found = true; } else { for (String networkName : hostNetworks) { if (!networkRequiredOnVds(vmIf, networksByName, onlyRequiredNetworks) || StringUtils.equals(vmIf.getNetworkName(), networkName)) { found = true; break; } } } if (!found) { missingIfs.add(vmIf.getNetworkName()); } } if (!missingIfs.isEmpty()) { String nics = StringUtils.join(missingIfs, ", "); <START> log.debug("host is missing networks required by VM nics {}", <END> vds.getName(), nics); return new ValidationResult(VdcBllMessages.VAR__DETAIL__NETWORK_MISSING, String.format("$networkNames %1$s", nics)); } return validateDisplayNetworkAvailability(vds, onlyRequiredNetworks, displayNic, displayNetwork); }</code><technical_language>Notice this debug level</technical_language>

Target:
private ValidationResult validateRequiredNetworksAvailable(VDS vds, VM vm, List<VmNetworkInterface> vmNICs, Network displayNetwork, Map<String, Network> networksByName, List<String> hostNetworks, VdsNetworkInterface displayNic) { List<String> missingIfs = new ArrayList<>(); boolean onlyRequiredNetworks = Config.<Boolean> getValue(ConfigValues.OnlyRequiredNetworksMandatoryForVdsSelection); for (final VmNetworkInterface vmIf : vmNICs) { boolean found = false; if (vmIf.getNetworkName() == null) { found = true; } else { for (String networkName : hostNetworks) { if (!networkRequiredOnVds(vmIf, networksByName, onlyRequiredNetworks) || StringUtils.equals(vmIf.getNetworkName(), networkName)) { found = true; break; } } } if (!found) { missingIfs.add(vmIf.getNetworkName()); } } if (!missingIfs.isEmpty()) { String nics = StringUtils.join(missingIfs, ", "); log.warn("host is missing networks required by VM nics {}", vds.getName(), nics); return new ValidationResult(VdcBllMessages.VAR__DETAIL__NETWORK_MISSING, String.format("$networkNames %1$s", nics)); } return validateDisplayNetworkAvailability(vds, onlyRequiredNetworks, displayNic, displayNetwork); }
Source:
<code>private void validateConfigsForTaskModifications(String workflowName, String jobName, TaskConfig taskConfig) { WorkflowConfig workflowConfig = TaskUtil.getWorkflowConfig(_accessor, workflowName); String nameSpaceJobName = TaskUtil.getNamespacedJobName(workflowName, jobName); JobConfig jobConfig = TaskUtil.getJobConfig(_accessor, nameSpaceJobName); if (workflowConfig == null) { throw new IllegalArgumentException( String.format("Workflow config for workflow %s does not exist!", workflowName)); } if (jobConfig == null) { throw new IllegalArgumentException( String.format("Job config for job %s does not exist!", nameSpaceJobName)); } if (taskConfig == null) { throw new IllegalArgumentException("TaskConfig is null!"); } if (taskConfig.getId() == null) { throw new HelixException("Task cannot be added or deleted because taskID is null!"); } if (jobConfig.getTargetResource() != null) { throw new HelixException(String.format( "Job %s is a targeted job. New task cannot be added/deleted to/from this job!", nameSpaceJobName)); } if ((taskConfig.getCommand() == null) == (jobConfig.getCommand() == null)) { throw new HelixException(String <START> .format("Command must exist in either job %s or task %s, not both!", jobName, taskConfig.getId())); <END> } }</code><technical_language>This confusing. Originally tells command in job config task config. dd job name task id distract focus. change as: "Command exist in jobconfig (jobname) taskconfig (taskid)" something</technical_language>

Target:
private void validateConfigsForTaskModifications(String workflowName, String jobName, TaskConfig taskConfig) { WorkflowConfig workflowConfig = TaskUtil.getWorkflowConfig(_accessor, workflowName); String nameSpaceJobName = TaskUtil.getNamespacedJobName(workflowName, jobName); JobConfig jobConfig = TaskUtil.getJobConfig(_accessor, nameSpaceJobName); if (workflowConfig == null) { throw new IllegalArgumentException( String.format("Workflow config for workflow %s does not exist!", workflowName)); } if (jobConfig == null) { throw new IllegalArgumentException( String.format("Job config for job %s does not exist!", nameSpaceJobName)); } if (taskConfig == null) { throw new IllegalArgumentException("TaskConfig is null!"); } if (taskConfig.getId() == null) { throw new HelixException("Task cannot be added or deleted because taskID is null!"); } if (jobConfig.getTargetResource() != null) { throw new HelixException(String.format( "Job %s is a targeted job. New task cannot be added/deleted to/from this job!", nameSpaceJobName)); } if ((taskConfig.getCommand() == null) == (jobConfig.getCommand() == null)) { throw new HelixException(String .format("Command must exist in either jobconfig (%s) or taskconfig (%s), not both!", jobName, taskConfig.getId())); } }
Source:
<code>public void setUp() throws Exception { brickPosition = 1; <START> ifBrick = new PhiroIfLogicBeginBrick(); <END> IfLogicElseBrick ifLogicElseBrick = new IfLogicElseBrick(ifBrick); IfLogicEndBrick ifLogicEndBrick = new IfLogicEndBrick(ifLogicElseBrick, ifBrick); ifBrick.setIfElseBrick(ifLogicElseBrick); ifBrick.setIfEndBrick(ifLogicEndBrick); script = BrickTestUtils.createProjectAndGetStartScript("PhiroIfBrickTest"); script.addBrick(ifBrick); script.addBrick(ifLogicElseBrick); script.addBrick(ifLogicEndBrick); baseActivityTestRule.launchActivity(null); }</code><technical_language>pleas a createProject function takes care of this</technical_language>

Target:
public void setUp() throws Exception { createProject(); baseActivityTestRule.launchActivity(null); }
Source:
<code>public DataSet map(ResultSet r, StatementContext ctx) throws SQLException { return new DataSet( r.getInt("dataSetId"), r.getString("objectId"), r.getString("name"), r.getTimestamp("createdate"), r.getInt("create_user_id"), r.getTimestamp("update_date"), <START> r.getInt("update_user_id"), <END> r.getBoolean("active"), r.getInt("alias")); }</code><technical_language>new columns, if included in queries this mapper, NPEs. hasColumn method in RowMapperHelper I check get value</technical_language>

Target:
public DataSet map(ResultSet r, StatementContext ctx) throws SQLException { DataSet dataset = new DataSet(); dataset.setDataSetId(r.getInt("dataSetId")); dataset.setObjectId(r.getString("objectId")); dataset.setName(r.getString("name")); if (hasColumn(r, "createdate")) { dataset.setCreateDate(r.getDate("createdate")); } if (hasColumn(r, "create_user_id")) { int userId = r.getInt("create_user_id"); if (userId > 0) { dataset.setCreateUserId(userId); } } if (hasColumn(r, "update_date")) { dataset.setUpdateDate(r.getTimestamp("update_date")); } if (hasColumn(r, "update_user_id")) { int userId = r.getInt("update_user_id"); if (userId > 0) { dataset.setUpdateUserId(userId); } } dataset.setActive(r.getBoolean("active")); dataset.setAlias(r.getInt("alias")); return dataset; }
Source:
<code>public RequestRepresentation unclaim( UserAuthenticationToken user, <START> @PathVariable String id, <END> @RequestBody RequestRepresentation request) { log.info("PUT /requests/" + id + "/unclaim"); Task task = requestService.getCurrentPalgaTaskByRequestId(id); taskService.unclaim(task.getId()); requestFormService.invalidateCacheEntry(id); HistoricProcessInstance instance = requestService.getProcessInstance(id); RequestRepresentation updatedRequest = new RequestRepresentation(); requestFormService.transferData(instance, updatedRequest, user.getUser()); return updatedRequest; }</code><technical_language>I reason fetching process instance action, is throws error if exist, get current task. error is "Process found" instead of "Task found"</technical_language>

Target:
public RequestRepresentation unclaim( UserAuthenticationToken user, @PathVariable String id, @RequestBody RequestRepresentation request) { log.info("PUT /requests/" + id + "/unclaim"); HistoricProcessInstance instance = requestService.getProcessInstance(id); Task task = requestService.getCurrentPalgaTaskByRequestId(id); taskService.unclaim(task.getId()); requestFormService.invalidateCacheEntry(id); instance = requestService.getProcessInstance(id); RequestRepresentation updatedRequest = new RequestRepresentation(); requestFormService.transferData(instance, updatedRequest, user.getUser()); return updatedRequest; }
Source:
<code>private static void copyDirectory(final File source, final File target, CommandContext ctx, ASModuleHandler handler) throws CommandLineException { try { copyDirectory(source, target); } catch (IOException ex) { Exception removalException = null; try { handler.removeModule(ctx.getParsedCommandLine(), ctx); } catch (Exception ee) { removalException = ee; } <START> String msg = "An error occured while copying directory " <END> + source.getAbsolutePath() + " to " + target.getAbsolutePath() + " :" + ex; if (removalException == null) { msg = "Module not added. " + msg; } else { msg = msg + ". Attempt to remove the module has failed: " + removalException; } throw new CommandLineException(msg); } }</code><technical_language>s/occured/occurred</technical_language>

Target:
private static void copyDirectory(final File source, final File target, CommandContext ctx, ASModuleHandler handler) throws CommandLineException { try { copyDirectory(source, target); } catch (IOException ex) { Exception removalException = null; try { handler.removeModule(ctx.getParsedCommandLine(), ctx); } catch (Exception ee) { removalException = ee; } String msg = "An error occurred while copying directory " + source.getAbsolutePath() + " to " + target.getAbsolutePath() + " :" + ex; if (removalException == null) { msg = "Module not added. " + msg; } else { msg = msg + ". Attempt to remove the module has failed: " + removalException; } throw new CommandLineException(msg); } }
Source:
<code>private void triggerOverwriteExistingFiles() { if (overwriteExistingFilesCheckBox.isSelected()) { requestConfirmation(); } <START> onChangeOverwriteExistingFilesCallbacks.forEach(callback -> callback.accept(overwriteExistingFilesCheckBox.isSelected())); <END> }</code><technical_language>call callbacks if user confirms wants check overwrite conf</technical_language>

Target:
private void triggerOverwriteExistingFiles() { onChangeOverwriteExistingFilesCallbacks.forEach(callback -> callback.accept(overwriteFilesField.isSelected())); }
Source:
<code>public void testGetValueInsertFactColumn() throws Exception { final ActionInsertFactCol52 column = new ActionInsertFactCol52(); column.setFactField(FIELD_NAME); column.setFactType(FACT_TYPE); column.setValueList("a,1,1.1, ,-1"); when(oracle.getFieldType(FACT_TYPE, <START> FIELD_NAME)).thenReturn("Integer"); <END> String[] valueList = utilities.getValueList(column); assertEquals(2, valueList.length); assertEquals("1", valueList[0]); assertEquals("-1", valueList[1]); }</code><technical_language>I try DataType.TYPE_NUMERIC_INTEGER "internal" data-types DataModelOracle a "magic string"</technical_language>

Target:
public void testGetValueInsertFactColumn() throws Exception { final ActionInsertFactCol52 column = new ActionInsertFactCol52(); column.setFactField(FIELD_NAME); column.setFactType(FACT_TYPE); column.setValueList("a,1,1.1, ,-1"); when(oracle.getFieldType(FACT_TYPE, FIELD_NAME)).thenReturn(DataType.TYPE_NUMERIC_INTEGER); String[] valueList = utilities.getValueList(column); assertEquals(2, valueList.length); assertEquals("1", valueList[0]); assertEquals("-1", valueList[1]); }
Source:
<code>final void setIsExtendedLifeTimeToken(final boolean isExtendedLifeTimeToken) { <START> this.mIsExtendedLifeTimeToken = isExtendedLifeTimeToken; <END> }</code><technical_language>isExtendedLifeTimeToken is developer token is returned a result of outage mode. @heidijinxujia expose a get method here? developer stale token is returned for this reason</technical_language>

Target:
final void setIsExtendedLifeTimeToken(final boolean isExtendedLifeTimeToken) { mIsExtendedLifeTimeToken = isExtendedLifeTimeToken; }
Source:
<code>private static void generateMaterialStatistics() { for (Material material : Material.values()) { <START> String name = material.name().toLowerCase() <END> .replace("spade", "shovel") .replace("wood", "wooden"); if (material != GOLD_INGOT && material != GOLD_NUGGET && material != GOLD_BLOCK && material != GOLD_ORE) { name = name.replace("gold", "golden"); } if (material.isBlock()) { set(MINE_BLOCK, material, "mineBlock.minecraft." + name); } if (material.isItem()) { set(USE_ITEM, material, "useItem.minecraft." + name); set(CRAFT_ITEM, material, "craftItem.minecraft." + name); if (material.getMaxDurability() != 0) { set(BREAK_ITEM, material, "breakItem.minecraft." + name); } } set(DROP, material, "drop.minecraft." + name); set(PICKUP, material, "pickup.minecraft." + name); } }</code><technical_language>I this of ItemIds class, a registry for IDs</technical_language>

Target:
private static void generateMaterialStatistics() { for (Material material : Material.values()) { String name = ItemIds.getKeyName(material); if (material.isBlock()) { set(MINE_BLOCK, material, "mineBlock.minecraft." + name); } if (material.isItem()) { set(USE_ITEM, material, "useItem.minecraft." + name); set(CRAFT_ITEM, material, "craftItem.minecraft." + name); if (material.getMaxDurability() != 0) { set(BREAK_ITEM, material, "breakItem.minecraft." + name); } } set(DROP, material, "drop.minecraft." + name); set(PICKUP, material, "pickup.minecraft." + name); } }
Source:
<code>@Test public void testSortExchangeFieldTrimmerWithEmptyCollation() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root = builder.scan("EMP") .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO")) .sortExchange(RelDistributions.hash(Lists.newArrayList(1)), RelCollations.EMPTY) .project(builder.field("EMPNO"), builder.field("ENAME")) .build(); System.out.println(Util.toLinux(RelOptUtil.toString(root))); <START> RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder); <END> RelNode trimmed = fieldTrimmer.trim(root); final String expected = "" + "LogicalSortExchange(distribution=[hash[1]], collation=[[]])\n" + " LogicalProject(EMPNO=[$0], ENAME=[$1])\n" + " LogicalTableScan(table=[[scott, EMP]])\n"; assertThat(trimmed, hasTree(expected)); }</code><technical_language>need print plan. I remove System.out.println(Util.toLinux(RelOptUtil.toString(root)));</technical_language>

Target:
@Test public void testSortExchangeFieldTrimmerWithEmptyCollation() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root = builder.scan("EMP") .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO")) .sortExchange(RelDistributions.hash(Lists.newArrayList(1)), RelCollations.EMPTY) .project(builder.field("EMPNO"), builder.field("ENAME")) .build(); RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder); RelNode trimmed = fieldTrimmer.trim(root); final String expected = "" + "LogicalSortExchange(distribution=[hash[1]], collation=[[]])\n" + " LogicalProject(EMPNO=[$0], ENAME=[$1])\n" + " LogicalTableScan(table=[[scott, EMP]])\n"; assertThat(trimmed, hasTree(expected)); }
Source:
<code>protected void addCacheHeaders(HttpServletResponse response, RequestFilterConfig config) { if (config.isCached()) { String privateOrPublic = config.isPrivate() ? "private" : "public"; response.setHeader("Cache-Control", privateOrPublic + ", max-age=" + config.getCacheTime()); long expires = System.currentTimeMillis() + Long.parseLong(config.getCacheTime()) * 1000; response.setHeader("Expires", HTTP_EXPIRES_DATE_FORMAT.format(expires)); } else if (config.isPrivate()) { <START> response.setHeader("Cache-Control", "private, no-cache, no-store"); <END> } }</code><technical_language>must-revalidate? <LINK_0> should? present</technical_language>

Target:
protected void addCacheHeaders(HttpServletResponse response, RequestFilterConfig config) { if (config.isCached()) { String privateOrPublic = config.isPrivate() ? "private" : "public"; response.setHeader("Cache-Control", privateOrPublic + ", max-age=" + config.getCacheTime()); long expires = System.currentTimeMillis() + Long.parseLong(config.getCacheTime()) * 1000; response.setHeader("Expires", HTTP_EXPIRES_DATE_FORMAT.format(expires)); } else if (config.isPrivate()) { response.setHeader("Cache-Control", "private, no-cache, no-store, must-revalidate"); } }
Source:
<code>public long getRetainedSizeInBytes() { <START> return INSTANCE_SIZE + sizeOf(offsetVector) + sizeOf(outputPositions) + sizeOf(data) + sizeOf(nulls); <END> }</code><technical_language>add lengthVector isNullVector</technical_language>

Target:
public long getRetainedSizeInBytes() { return INSTANCE_SIZE + sizeOf(offsets) + sizeOf(outputPositions) + sizeOf(data) + sizeOf(nulls) + sizeOf(lengthVector) + sizeOf(isNullVector); }
Source:
<code>public ScanRuntimeProvider getScanRuntimeProvider(Context runtimeProviderContext) { DeserializationSchema<RowData> deserializationSchema = getDeserializationSchema(runtimeProviderContext); FlinkKafkaConsumerBase<RowData> kafkaConsumer = getKafkaConsumer(topic, properties, deserializationSchema); <START> return SourceFunctionProvider.of(kafkaConsumer, true); <END> }</code><technical_language>false, unbounded</technical_language>

Target:
public ScanRuntimeProvider getScanRuntimeProvider(Context runtimeProviderContext) { DeserializationSchema<RowData> deserializationSchema = this.scanFormat.createScanFormat(runtimeProviderContext, this.outputDataType); FlinkKafkaConsumerBase<RowData> kafkaConsumer = getKafkaConsumer(topic, properties, deserializationSchema); return SourceFunctionProvider.of(kafkaConsumer, false); }
Source:
<code>public void unregisterQuery(KieServerConnectionInfo connectionInfo, String dataSetUUID) { Client client = ClientBuilder.newClient(); <START> WebTarget target = requestForQueryDefinition(connectionInfo, dataSetUUID, client); <END> target.request().delete(); }</code><technical_language>need a client.close() end of this method</technical_language>

Target:
public void unregisterQuery(KieServerConnectionInfo connectionInfo, String dataSetUUID) { Client client = ClientBuilder.newClient(); WebTarget target = requestForQueryDefinition(connectionInfo, dataSetUUID, client); target.request().delete(); client.close(); }
Source:
<code>public void testUpdate() { try { var method = VariableStepGameLoop.class.getDeclaredMethod("update", Long.class); method.setAccessible(true); <START> method.invoke(gameLoop, 20L); <END> Assert.assertEquals(0.01f, gameLoop.controller.getBulletPosition(), 0); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { Assert.fail("Fail to modify field access."); } }</code><technical_language>I good practise reflection methods accessible. method public default? if a problem design perspective inherit VariableStepGameLoop in this test override method visibility. issue is present in other tests too</technical_language>

Target:
public void testUpdate() { gameLoop.update(20L); Assert.assertEquals(0.01f, gameLoop.controller.getBulletPosition(), 0); }
Source:
<code>private File nodeDataAsFile( List<InputEntity> nodeData ) throws IOException { File file = directory.file( "nodes.csv" ); try ( Writer writer = fileSystemRule.get().openAsWriter( file, StandardCharsets.UTF_8, false ) ) { <START> println( writer, "id:ID,name,point:Point{WGS-84},date:Date,time:Time,dateTime:DateTime,dateTime2:DateTime,localTime:LocalTime," + <END> "localDateTime:LocalDateTime,duration:Duration,some-labels:LABEL" ); for ( InputEntity node : nodeData ) { String csvLabels = csvLabels( node.labels() ); StringBuilder sb = new StringBuilder( node.id() + "," ); for ( int i = 0; i < node.propertyCount(); i++ ) { sb.append( node.propertyValue( i ) + "," ); } sb.append( csvLabels != null && csvLabels.length() > 0 ? csvLabels : "" ); println( writer, sb.toString() ); } } return file; }</code><technical_language>I a normal point:Point CRS</technical_language>

Target:
private File nodeDataAsFile( List<InputEntity> nodeData ) throws IOException { File file = directory.file( "nodes.csv" ); try ( Writer writer = fileSystemRule.get().openAsWriter( file, StandardCharsets.UTF_8, false ) ) { println( writer, "id:ID,name,pointA:Point{crs:WGS-84},pointB:Point,date:Date,time:Time,dateTime:DateTime,dateTime2:DateTime,localTime:LocalTime," + "localDateTime:LocalDateTime,duration:Duration,some-labels:LABEL" ); for ( InputEntity node : nodeData ) { String csvLabels = csvLabels( node.labels() ); StringBuilder sb = new StringBuilder( node.id() + "," ); for ( int i = 0; i < node.propertyCount(); i++ ) { sb.append( node.propertyValue( i ) + "," ); } sb.append( csvLabels != null && csvLabels.length() > 0 ? csvLabels : "" ); println( writer, sb.toString() ); } } return file; }
Source:
<code>public final void removeSession(String sessionId) { Iterator<Entry<String, SessionInfo>> iterator = sessionInfoList.entrySet().iterator(); while (iterator.hasNext()) { if (iterator.next().getKey().equals(sessionId)) { iterator.remove(); break; } <START> } <END> }</code><technical_language>please explain this plain: sessionInfoList.remove(sessionId)</technical_language>

Target:
public final void removeSession(String sessionId) { Iterator<Entry<String, SessionInfo>> iterator = sessionInfoMap.entrySet().iterator(); while (iterator.hasNext()) { if (iterator.next().getKey().equals(sessionId)) { iterator.remove(); break; } } }
Source:
<code>@Override public void lockInterruptibly() throws InterruptedException { if (hasLocked.get()) return; <START> threadCount.incrementAndGet(); <END> try { lock.lockInterruptibly(); } catch (InterruptedException e) { releaseGlobalLock(); throw e; } if (!holdGlobalLockInterruptibly()) { threadCount.decrementAndGet(); lock.unlock(); throw new InterruptedException(); } hasLocked.set(true); }</code><technical_language>u implemneted methods java util concurrent locks ReentrantLock? For instnce, getQueueLength. u implement getQueueLength() threadCount variable. So, this variable incremented **atomically** holdGlobalLockInterruptibly() lock.lockInterruptibly(). this variable incremented **only** global lock is acquired</technical_language>

Target:
@Override public void lockInterruptibly() throws InterruptedException { if (reentrantCnt.get() > 0) { reentrantCnt.increment(); return; } threadCnt.incrementAndGet(); try { lock.lockInterruptibly(); } catch (InterruptedException e) { threadCnt.decrementAndGet(); throw e; } if (closed) { reentrantCnt.decrement(); lock.unlock(); throw new IllegalStateException("Can't acquire a lock after a close operation."); } try { if (!isGloballyLocked) { globalSync.acquireInterruptibly(); isGloballyLocked = true; nextFinish = MAX_TIME + System.nanoTime(); } } catch (InterruptedException e) { threadCnt.decrementAndGet(); lock.unlock(); throw e; } reentrantCnt.increment(); }
Source:
<code>public void topNQuery(Blackhole blackhole) { query = new TopNQueryBuilder() .dataSource(DATA_SOURCE) .intervals(basicSchemaIntervalSpec) .dimension(new DefaultDimensionSpec("dimUniform", null)) .aggregators(new LongSumAggregatorFactory("sumLongSequential", "sumLongSequential")) .granularity(Granularity.fromString(queryGranularity)) .metric("sumLongSequential") <START> .threshold(20480) <END> .build(); final List<Result<TopNResultValue>> results = runQuery(); for (Result<TopNResultValue> result : results) { blackhole.consume(result); } }</code><technical_language>I I set 20480 in #6629, remember this number from. I threshold number if small parallel merge merging results</technical_language>

Target:
public void topNQuery(Blackhole blackhole) { query = new TopNQueryBuilder() .dataSource(DATA_SOURCE) .intervals(basicSchemaIntervalSpec) .dimension(new DefaultDimensionSpec("dimUniform", null)) .aggregators(new LongSumAggregatorFactory("sumLongSequential", "sumLongSequential")) .granularity(Granularity.fromString(queryGranularity)) .metric("sumLongSequential") .threshold(10_000) .build(); final List<Result<TopNResultValue>> results = runQuery(); for (Result<TopNResultValue> result : results) { blackhole.consume(result); } }
Source:
<code>public void insertMetrics( Collection<IMetric> metrics ) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.CF_METRICS_FULL_NAME ); Map<Locator, ResultSetFuture> futures = new HashMap<Locator, ResultSetFuture>(); try { for( IMetric metric : metrics ) { if (!shouldPersist(metric)) { LOG.trace("Metric shouldn't be persisted, skipping insert", metric.getLocator().toString()); continue; } Locator locator = metric.getLocator(); if( !isLocatorCurrent( locator ) ) { setLocatorCurrent( locator ); if( !DataType.isStringOrBoolean( metric.getMetricValue() ) ) <START> locatorIO.insertLocator( locator ); <END> } futures.put( locator, rawIO.insertAsync( metric ) ); } for( Map.Entry<Locator, ResultSetFuture> f : futures.entrySet() ) { try { ResultSet result = f.getValue().getUninterruptibly(); LOG.trace( "result.size=" + result.all().size() ); } catch ( Exception e ) { Instrumentation.markWriteError(); LOG.error(String.format("error writing metric for locator %s", f.getKey()), e ); } } } finally { ctx.close(); } }</code><technical_language>So, string/boolean metrics do get rolled up</technical_language>

Target:
public void insertMetrics( Collection<IMetric> metrics ) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.CF_METRICS_FULL_NAME ); Map<Locator, ResultSetFuture> futures = new HashMap<Locator, ResultSetFuture>(); try { for( IMetric metric : metrics ) { if (!shouldPersist(metric)) { LOG.trace( String.format( "Metric %s shouldn't be persisted, skipping insert", metric.getLocator().toString() ) ); continue; } Locator locator = metric.getLocator(); if( !isLocatorCurrent( locator ) ) { setLocatorCurrent( locator ); if( !DataType.isStringOrBoolean( metric.getMetricValue() ) ) locatorIO.insertLocator( locator ); } futures.put( locator, rawIO.insertAsync( metric ) ); } for( Map.Entry<Locator, ResultSetFuture> f : futures.entrySet() ) { try { ResultSet result = f.getValue().getUninterruptibly(); LOG.trace( "result.size=" + result.all().size() ); Instrumentation.markFullResMetricWritten(); } catch ( Exception e ) { Instrumentation.markWriteError(); LOG.error(String.format("error writing metric for locator %s", f.getKey()), e ); } } } finally { ctx.stop(); } }
Source:
<code>public <T> List<T> getItems(Class<T> type) { List<T> r = new ArrayList<>(); <START> for (TopLevelItem i : getItems(type::isInstance)) <END> r.add(type.cast(i)); return r; }</code><technical_language>suggestion for (TopLevelItem i : getItems(type::isInstance)) {</technical_language>

Target:
public <T> List<T> getItems(Class<T> type) { List<T> r = new ArrayList<>(); for (TopLevelItem i : getItems(type::isInstance)) { r.add(type.cast(i)); } return r; }
Source:
<code><START> public List<UserDetailDto> getUsersByProjectUUID(final String projectUUID) { <END> final List<UserDetailDto> result = new ArrayList<>(); final ModelMapper mapper = UserMapper.getInstance(); final List<UserDto> users = this.workbenchDataManager.getUsersByProjectUUID(projectUUID); for (final UserDto userDto : users) { final UserDetailDto userInfo = mapper.map(userDto, UserDetailDto.class); result.add(userInfo); } return result; }</code><technical_language>I find tests for this new function</technical_language>

Target:
public List<UserDetailDto> getUsersByProjectUUID(final String projectUUID) { final List<UserDetailDto> result = new ArrayList<>(); final ModelMapper mapper = UserMapper.getInstance(); Preconditions.checkNotNull(projectUUID, "The projectUUID must not be empty"); try { List<UserDto> users = this.workbenchDataManager.getUsersByProjectUuid(projectUUID); Preconditions.checkArgument(!users.isEmpty(), "don't exists users for this projectUUID"); for (final UserDto userDto : users) { final UserDetailDto userInfo = mapper.map(userDto, UserDetailDto.class); result.add(userInfo); } } catch (MiddlewareQueryException e) { LOG.info("Error on workbenchDataManager.getUsersByProjectUuid", e); Preconditions.checkState(false, "An internal error occurred while trying to get the users"); } return result; }
Source:
<code>public void removeDeviceModel(@Identification final String organisationIdentification, @Valid final String manufacturer, final String modelCode) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.REMOVE_DEVICE_MODELS); <START> final Manufacturer dbManufacturer = this.manufacturerRepository.findByManufacturerId(manufacturer); <END> final DeviceModel removedDeviceModel = this.deviceModelRepository.findByManufacturerIdAndModelCode(dbManufacturer, modelCode); if (removedDeviceModel == null) { LOGGER.info("DeviceModel not found."); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICEMODEL, ComponentType.WS_CORE, new ExistingEntityException(Manufacturer.class, modelCode)); } else { this.deviceModelRepository.delete(removedDeviceModel); } }</code><technical_language>Consistency other methods: dataseManufacturer is in other methods, suggestion here: databaseManufacturer</technical_language>

Target:
public void removeDeviceModel(@Identification final String organisationIdentification, @Valid final String manufacturer, final String modelCode) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.REMOVE_DEVICE_MODELS); final Manufacturer dataseManufacturer = this.manufacturerRepository.findByManufacturerId(manufacturer); final DeviceModel removedDeviceModel = this.deviceModelRepository.findByManufacturerIdAndModelCode(dataseManufacturer, modelCode); if (removedDeviceModel == null) { LOGGER.info("DeviceModel not found."); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICEMODEL, ComponentType.WS_CORE, new ExistingEntityException(Manufacturer.class, modelCode)); } else { this.deviceModelRepository.delete(removedDeviceModel); } }
Source:
<code>public void testMakeCellRenderContextOneRow() { final double headerRowsHeight = 100.0; final BaseGridRow row = new BaseGridRow(); final List<GridColumn<?>> allColumns = new ArrayList<>(); <START> final List<Double> allRowHeights = new ArrayList<>(Collections.singletonList(row.getHeight())); <END> final GridColumn<?> uiColumn1 = mockGridColumn(25.0); final GridColumn<?> uiColumn2 = mockGridColumn(60.0); final GridColumn<?> uiColumn3 = mockGridColumn(100.0); allColumns.add(uiColumn1); allColumns.add(uiColumn2); allColumns.add(uiColumn3); gridWidget.getModel().appendRow(row); doReturn(allColumns).when(ri).getAllColumns(); doReturn(headerRowsHeight).when(ri).getHeaderRowsHeight(); doReturn(allRowHeights).when(ri).getAllRowHeights(); doReturn(uiColumn2).when(ci).getColumn(); doReturn(25.0).when(ci).getOffsetX(); doReturn(1).when(ci).getUiColumnIndex(); final GridBodyCellEditContext context = CellContextUtilities.makeCellRenderContext(gridWidget, ri, ci, 0); assertNotNull(context); assertThat(context.getAbsoluteCellX()) .as("Should be column offset") .isEqualTo(25.0); assertThat(context.getAbsoluteCellY()) .as("Should be headers height") .isEqualTo(headerRowsHeight); }</code><technical_language>Please Collections.singletonList(row.getHeight()), I do change number of elements in allRowHeights test</technical_language>

Target:
public void testMakeCellRenderContextOneRow() { final double headerRowsHeight = 100.0; final BaseGridRow row = new BaseGridRow(); final List<GridColumn<?>> allColumns = new ArrayList<>(); final List<Double> allRowHeights = Collections.singletonList(row.getHeight()); final GridColumn<?> uiColumn1 = mockGridColumn(25.0); final GridColumn<?> uiColumn2 = mockGridColumn(60.0); final GridColumn<?> uiColumn3 = mockGridColumn(100.0); allColumns.add(uiColumn1); allColumns.add(uiColumn2); allColumns.add(uiColumn3); gridWidget.getModel().appendRow(row); doReturn(allColumns).when(ri).getAllColumns(); doReturn(headerRowsHeight).when(ri).getHeaderRowsHeight(); doReturn(allRowHeights).when(ri).getAllRowHeights(); doReturn(uiColumn2).when(ci).getColumn(); doReturn(25.0).when(ci).getOffsetX(); doReturn(1).when(ci).getUiColumnIndex(); final GridBodyCellEditContext context = CellContextUtilities.makeCellRenderContext(gridWidget, ri, ci, 0); assertNotNull(context); assertThat(context.getAbsoluteCellX()) .as("Should be column offset") .isEqualTo(25.0); assertThat(context.getAbsoluteCellY()) .as("Should be headers height") .isEqualTo(headerRowsHeight); }
Source:
<code>protected void executeCommand() { if (!oldNumaNodeIds.isEmpty()) { getVmNumaNodeDao().massRemoveNumaNodeByNumaNodeId(oldNumaNodeIds); } List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); Guid vdsId = <START> getVm().getDedicatedVmForVdsList().get(0); <END> List<VdsNumaNode> vdsNumaNodes = new ArrayList<>(); if (vdsId != null) { vdsNumaNodes = getVdsNumaNodeDao().getAllVdsNumaNodeByVdsId(vdsId); } List<VmNumaNode> nodes = new ArrayList<>(); for (VmNumaNode vmNumaNode : vmNumaNodes) { vmNumaNode.setId(Guid.newGuid()); for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { if (pair.getSecond() != null && pair.getSecond().getSecond() != null) { int index = pair.getSecond().getSecond(); if (pair.getSecond().getFirst()) { for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { pair.setFirst(vdsNumaNode.getId()); break; } } } } } nodes.add(vmNumaNode); } getVmNumaNodeDao().massSaveNumaNode(nodes, null, getVm().getId()); setSucceeded(true); }</code><technical_language>NPE? guarded CanDo</technical_language>

Target:
protected void executeCommand() { if (!oldNumaNodeIds.isEmpty()) { getVmNumaNodeDao().massRemoveNumaNodeByNumaNodeId(oldNumaNodeIds); } List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); List<VdsNumaNode> vdsNumaNodes = getVdsNumaNodes(); List<VmNumaNode> nodes = new ArrayList<>(); for (VmNumaNode vmNumaNode : vmNumaNodes) { vmNumaNode.setId(Guid.newGuid()); for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { if (pair.getSecond() != null && pair.getSecond().getSecond() != null) { int index = pair.getSecond().getSecond(); if (pair.getSecond().getFirst()) { for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { pair.setFirst(vdsNumaNode.getId()); break; } } } } } nodes.add(vmNumaNode); } getVmNumaNodeDao().massSaveNumaNode(nodes, null, getVm().getId()); setSucceeded(true); }
Source:
<code>public static ValidationResult setAndValidateCpuProfileForUser(VmBase vmBase, Version version, Guid userId) { if (!FeatureSupported.cpuQoS(version)) { return ValidationResult.VALID; } if (vmBase.getCpuProfileId() == null) { return assignAnyCpuProfile(vmBase); } Optional<CpuProfile> <START> chosenCpuProfileWithPermissions = <END> getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId(), userId, true).stream() .filter( cp -> cp.getId().equals(vmBase.getCpuProfileId()) ).findFirst(); if (chosenCpuProfileWithPermissions.isPresent()) { vmBase.setCpuProfileId(chosenCpuProfileWithPermissions.get().getId()); return ValidationResult.VALID; } CpuProfile chosenCpuProfile = getCpuProfileDao().get(vmBase.getCpuProfileId()); if(chosenCpuProfile == null) { return new ValidationResult(EngineMessage.ACTION_TYPE_NO_CPU_PROFILE_WITH_THAT_ID, String.format("$cpuProfileId %s", vmBase.getCpuProfileId())); } return new ValidationResult(EngineMessage.ACTION_TYPE_NO_PERMISSION_TO_ASSIGN_CPU_PROFILE, String.format("$cpuProfileId %s", vmBase.getCpuProfileId()), String.format("$cpuProfileName %s", chosenCpuProfile.getName())); }</code><technical_language>moved selection of fallback profile out of this method give this variable a shorter name. 'selectCpuProfile' 'chosenCpuProfile'</technical_language>

Target:
public static ValidationResult setAndValidateCpuProfileForUser(VmBase vmBase, Version version, Guid userId) { if (!FeatureSupported.cpuQoS(version)) { return ValidationResult.VALID; } if (vmBase.getCpuProfileId() == null) { return assignFirstCpuProfile(vmBase); } Optional<CpuProfile> authorizedCpuProfile = getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId(), userId, true).stream() .filter( cp -> cp.getId().equals(vmBase.getCpuProfileId()) ).findFirst(); if (authorizedCpuProfile.isPresent()) { vmBase.setCpuProfileId(authorizedCpuProfile.get().getId()); return ValidationResult.VALID; } CpuProfile chosenCpuProfile = getCpuProfileDao().get(vmBase.getCpuProfileId()); if(chosenCpuProfile == null) { return new ValidationResult(EngineMessage.ACTION_TYPE_NO_CPU_PROFILE_WITH_THAT_ID, String.format("$cpuProfileId %s", vmBase.getCpuProfileId())); } return new ValidationResult(EngineMessage.ACTION_TYPE_NO_PERMISSION_TO_ASSIGN_CPU_PROFILE, String.format("$cpuProfileId %s", vmBase.getCpuProfileId()), String.format("$cpuProfileName %s", chosenCpuProfile.getName())); }
Source:
<code>@Override public void savepoint(String name, boolean overwrite) throws IllegalArgumentException { if (implicit()) <START> throw new IllegalStateException("Savepoints must be used inside explicit transactions."); <END> enter(); try { tx.savepoint(name, overwrite); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { leave(); } }</code><technical_language>"Savepoints explicit transactions." sounds</technical_language>

Target:
@Override public void savepoint(String name, boolean overwrite) throws IllegalArgumentException { if (implicit()) throw new IllegalStateException("Savepoints can be used only inside explicit transactions."); if (name == null) throw new IllegalArgumentException("Savepoint name can't be null."); enter(); try { cctx.savepoint(tx, name, overwrite); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { leave(); } }
Source:
<code>public String getValue(int id) { if (id < 0) { throw new IllegalArgumentException("id must be greater than or equal to 0"); } String retVal; <START> final long start = Instant.now().getMillis(); <END> do { retVal = falseIdsReverse.get(id); if(Instant.now().isAfter(start + MAXIMUM_FACTS_RETRY_TIME)){ throw Throwables.propagate(new TimeoutException("Timeout waiting for falseIds to populate")); } } while (null == retVal); return retVal; }</code><technical_language>Is a reason this is System.currentTimeMillis()</technical_language>

Target:
public String getValue(int id) { if (isClosed.get()) { return null; } Preconditions.checkArgument(id >= 0, "id must be greater than or equal to 0"); return falseIdsReverse.get(id); }
Source:
<code>public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { Browser browser = new Browser(shell, SWT.NONE); browser.dispose(); browser = new Browser(shell, SWT.BORDER); browser.dispose(); browser = new Browser(null, SWT.NONE); <START> fail("No exception thrown for parent == null"); <END> }</code><technical_language>need for fail. Junit auto fail test if expected exception is thrown</technical_language>

Target:
public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { Browser browser = new Browser(shell, SWT.NONE); browser.dispose(); browser = new Browser(shell, SWT.BORDER); browser.dispose(); browser = new Browser(null, SWT.NONE); }
Source:
<code>public CpuUsageXYViewer(Composite parent) { super(parent, Messages.CpuUsageXYViewer_Title, Messages.CpuUsageXYViewer_TimeXAxis, Messages.CpuUsageXYViewer_CpuYAxis); setResolution(RESOLUTION); <START> getSwtChart().getTitle().setVisible(true); <END> getSwtChart().getLegend().setVisible(false); }</code><technical_language>false here? title is displayed</technical_language>

Target:
public CpuUsageXYViewer(Composite parent) { super(parent, Messages.CpuUsageXYViewer_Title, Messages.CpuUsageXYViewer_TimeXAxis, Messages.CpuUsageXYViewer_CpuYAxis); setResolution(RESOLUTION); getSwtChart().getTitle().setVisible(false); getSwtChart().getLegend().setVisible(false); }
Source:
<code>DecisionTableColumnPlugin findPluginByIdentifier(final String selectedItemText) { <START> for (DecisionTableColumnPlugin plugin : this.pluginManagedInstance) { <END> if (plugin.getIdentifier().equals(selectedItemText)) { return plugin; } } throw new UnsupportedOperationException("The plugin " + selectedItemText + " does not have an implementation."); }</code><technical_language>this iterate plugins() pluginManagedInstance (IDK if show is instantiating new instances, terrible ManagedInstance possibly avoided?)</technical_language>

Target:
DecisionTableColumnPlugin findPluginByIdentifier(final String selectedItemText) { for (DecisionTableColumnPlugin plugin : plugins()) { if (plugin.getIdentifier().equals(selectedItemText)) { return plugin; } } throw new UnsupportedOperationException("The plugin " + selectedItemText + " does not have an implementation."); }
Source:
<code>public ImageSearchPage(final ImageSearchModel model) { super("ImageSearchPage", WizardMessages.getString("ImageSearchPage.title"), SWTImagesFactory.DESC_BANNER_REPOSITORY); setMessage(WizardMessages.getString("ImageSearchPage.title")); <START> setPageComplete(true); <END> this.model = model; }</code><technical_language>Is this necessary ? isPageComplete() is overriden check for a selected image checked</technical_language>

Target:
public ImageSearchPage(final ImageSearchModel model) { super("ImageSearchPage", WizardMessages.getString("ImageSearchPage.title"), SWTImagesFactory.DESC_BANNER_REPOSITORY); setMessage(WizardMessages.getString("ImageSearchPage.title")); this.model = model; }
Source:
<code>public String getNextPageToken() { if (hasNext) { <START> return PaginationToken.pageMetadataToTokenString(nextPageMetadata); <END> } return null; }</code><technical_language>pageMetadataToTokenString tokenize</technical_language>

Target:
public String getNextPageToken() { if (hasNext) { return PaginationToken.tokenize(nextPageMetadata); } return null; }
Source:
<code><START> private IServer getOpenShiftServer(final IResourceUIModel selectedResourceModel) { <END> if (selectedResourceModel == null) { return null; } IResource resource = selectedResourceModel.getResource(); if (resource instanceof IService) { final IService selectedService = (IService) resource; final Connection connection = ConnectionsRegistryUtil.safeGetConnectionFor(selectedService); return openOrCreateServerAdapter(selectedService, null, connection); } else if (resource instanceof IRoute) { final IRoute selectedRoute = (IRoute) resource; final IService relatedService = (IService) selectedRoute.getProject().getResources(ResourceKind.SERVICE).stream() .filter(s -> ResourceFilters.areRelated(selectedRoute, (IService) s)).findFirst() .orElseGet(() -> null); if(relatedService != null) { final Connection connection = ConnectionsRegistryUtil.safeGetConnectionFor(selectedRoute); return openOrCreateServerAdapter(relatedService, selectedRoute, connection); } else { OpenShiftUIActivator.getDefault().getLogger().logWarning("Unable to locate the service '" + selectedRoute.getServiceName() + "' from route '" + selectedRoute.getName() + "'"); } } return null; }</code><technical_language>IResourceUIModel selectedResourceModel is part of model loads resources, collect data model requests for resources restclient model? end, Deployment instance passed wizard instead of IService</technical_language>

Target:
private IServer getOpenShiftServer(final IResourceUIModel selectedResourceModel) { if (selectedResourceModel == null) { return null; } IResource resource = selectedResourceModel.getResource(); if (resource instanceof IService) { final IService selectedService = (IService) resource; final Connection connection = ConnectionsRegistryUtil.safeGetConnectionFor(selectedService); return openOrCreateServerAdapter(selectedService, null, connection); } else if (resource instanceof IRoute) { final IRoute selectedRoute = (IRoute) resource; final IService relatedService = (IService) selectedRoute.getProject().getResources(ResourceKind.SERVICE).stream() .filter(s -> ResourceUtils.areRelated(selectedRoute, (IService) s)) .findFirst() .orElseGet(() -> null); if(relatedService != null) { final Connection connection = ConnectionsRegistryUtil.safeGetConnectionFor(selectedRoute); return openOrCreateServerAdapter(relatedService, selectedRoute, connection); } else { OpenShiftUIActivator.getDefault().getLogger().logWarning("Unable to locate the service '" + selectedRoute.getServiceName() + "' from route '" + selectedRoute.getName() + "'"); } } return null; }
Source:
<code>public void cleanUp() { <START> assertEquals(true, ((PersonalComputerDatabaseStorage)propertyManager.permanentStore).obliterateStorage()); <END> }</code><technical_language>if usual put assert in cleanup. sounds exception if storage successfully obliterated</technical_language>

Target:
public void cleanUp() { assertEquals(true, ((OffRobotDatabaseStorage)propertyManager.permanentStore).obliterateStorage()); }
Source:
<code>public static Block serializeObject(Type type, BlockBuilder builder, Object object) { if (ROW.equals(type.getTypeSignature().getBase())) { return serializeStruct(type, builder, object); } if (MAP.equals(type.getTypeSignature().getBase()) || ARRAY.equals(type.getTypeSignature().getBase())) { throw new IllegalArgumentException("Type not supported: " + type.getDisplayName()); } serializePrimitive(type, builder, object); <START> return null; <END> }</code><technical_language>Return Optional instead of null</technical_language>

Target:
public static Block serializeObject(Type type, BlockBuilder builder, Object object) { if (ROW.equals(type.getTypeSignature().getBase())) { return serializeStruct(type, builder, object); } if (MAP.equals(type.getTypeSignature().getBase()) || ARRAY.equals(type.getTypeSignature().getBase())) { throw new IllegalArgumentException("Type not supported: " + type.getDisplayName()); } return serializePrimitive(type, builder, object); }
Source:
<code>public void syntheticEventInvokedAndReturningSourceTest() { assertTrue(extension.timesInvoked() == 3); Map<Type, Extension> map = extension.getSources(); <START> assertTrue(map.get(Peach.class) instanceof ProcessSyntheticObserverMethodObserver); <END> assertTrue(map.get(Banana.class) instanceof ProcessSyntheticObserverMethodObserver); assertTrue(map.get(Melon.class) instanceof ProcessSyntheticObserverMethodObserver); }</code><technical_language>I assertEquals comparing Class of extension</technical_language>

Target:
public void syntheticEventInvokedAndReturningSourceTest() { assertEquals(extension.timesInvoked(), new Integer(3)); Map<Type, Extension> map = extension.getSources(); assertEquals(map.get(Peach.class).getClass(), ProcessSyntheticObserverMethodObserver.class); assertEquals(map.get(Banana.class).getClass(), ProcessSyntheticObserverMethodObserver.class); assertEquals(map.get(Melon.class).getClass(), ProcessSyntheticObserverMethodObserver.class); }