auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>boolean doesColumnExist(Connection conn, String tableName, String columnName) throws SQLException { final String tableInfoQueryTemplate = "PRAGMA table_info(%s)"; ResultSet resultSet; Statement statement = conn.createStatement(); boolean columnExists = false; <START> resultSet = statement.executeQuery(String.format(tableInfoQueryTemplate, tableName)); <END> try { while (resultSet.next()) { if (resultSet.getString(2).equals(columnName)) { columnExists = true; break; } } } finally { resultSet.close(); statement.close(); } return columnExists; }</code><technical_language>I this in try-catch block closed</technical_language>

Target:
boolean doesColumnExist(Connection conn, String tableName, String columnName) throws SQLException { final String tableInfoQueryTemplate = "PRAGMA table_info(%s)"; ResultSet resultSet = null; Statement statement = null; boolean columnExists = false; try { statement = conn.createStatement(); resultSet = statement.executeQuery(String.format(tableInfoQueryTemplate, tableName)); while (resultSet.next()) { if (resultSet.getString(2).equals(columnName)) { columnExists = true; break; } } } finally { EamDbUtil.closeResultSet(resultSet); EamDbUtil.closeStatement(statement); } return columnExists; }
Source:
<code>public static TNodeTemplate.Capabilities cloneCapabilities(TNodeTemplate nodeTemplate) { if (nodeTemplate.getCapabilities() == null) { LOGGER.info("Capabilites are null, not cloned any capabilities for " + nodeTemplate.getId()); return null; } <START> TNodeTemplate.Capabilities fixedCapabilities = new TNodeTemplate.Capabilities(); <END> for (int i = 0; i < nodeTemplate.getCapabilities().getCapability().size(); i++) { TCapability tempCapability = new TCapability(); String id = nodeTemplate.getCapabilities().getCapability().get(i).getId() + "_" + idCounterCapabilities; tempCapability.setId(id); tempCapability.setName(nodeTemplate.getCapabilities().getCapability().get(i).getName()); tempCapability.setProperties(nodeTemplate.getCapabilities().getCapability().get(i).getProperties()); tempCapability.setPropertyConstraints(nodeTemplate.getCapabilities().getCapability().get(i).getPropertyConstraints()); tempCapability.setType(nodeTemplate.getCapabilities().getCapability().get(i).getType()); fixedCapabilities.getCapability().add(tempCapability); LOGGER.info("Cloned requirements for " + nodeTemplate.getId()); idCounterCapabilities++; } return fixedCapabilities; }</code><technical_language>Please fix ident</technical_language>

Target:
public static TNodeTemplate.Capabilities cloneCapabilities(TNodeTemplate nodeTemplate) { if (nodeTemplate.getCapabilities() == null) { LOGGER.debug("Capabilites are null, not cloned any capabilities for " + nodeTemplate.getId()); return null; } TNodeTemplate.Capabilities fixedCapabilities = new TNodeTemplate.Capabilities(); for (int i = 0; i < nodeTemplate.getCapabilities().getCapability().size(); i++) { TCapability tempCapability = new TCapability(); String id = nodeTemplate.getCapabilities().getCapability().get(i).getId() + "_" + idCounterCapabilities; tempCapability.setId(id); tempCapability.setName(nodeTemplate.getCapabilities().getCapability().get(i).getName()); tempCapability.setProperties(nodeTemplate.getCapabilities().getCapability().get(i).getProperties()); tempCapability.setPropertyConstraints(nodeTemplate.getCapabilities().getCapability().get(i).getPropertyConstraints()); tempCapability.setType(nodeTemplate.getCapabilities().getCapability().get(i).getType()); fixedCapabilities.getCapability().add(tempCapability); LOGGER.debug("Cloned requirements for " + nodeTemplate.getId()); idCounterCapabilities++; } return fixedCapabilities; }
Source:
<code>private List<Row> updateRows(List<Row> rows) { for (ListIterator<Row> it = rows.listIterator(); it.hasNext();) { final Row original = (Row) it.next(); <START> validateUpdateType(original); <END> final Row updated = update(original); it.set(updated); } return rows; }</code><technical_language>add this here</technical_language>

Target:
private List<Row> updateRows(List<Row> rows) { for (ListIterator<Row> it = rows.listIterator(); it.hasNext();) { final Row original = (Row) it.next(); final Row updated = update(original); it.set(updated); } return rows; }
Source:
<code>public void start(DatastreamEventCollectorFactory collectorFactory) { LOG.info("START: Connector::start. Connector: " + _connector.getConnectorType() + ", Instance: " + _instanceName); _lastError = null; long startTime = System.currentTimeMillis(); try { _connector.start(collectorFactory); } catch (Exception ex) { LOG.error("Failed to call connector API: Connector::start", ex); <START> _lastError = ex.getStackTrace().toString(); <END> } long endTime = System.currentTimeMillis(); LOG.info("END: Connector::start. Connector: " + _connector.getConnectorType() + ", Instance: " + _instanceName + ", duration: " + (endTime - startTime) + " milliseconds"); }</code><technical_language>do include stack trace? error message well</technical_language>

Target:
public void start(DatastreamEventCollectorFactory collectorFactory) { logApiStart("start"); try { _connector.start(collectorFactory); } catch (Exception ex) { logErrorAndException("start", ex); } logApiEnd("start"); }
Source:
<code>public EntityRef create(Iterable<Component> components) { EntityRef entity = create(); String prefabName = null; <START> BlockUri blockUri = null; <END> for (Component component : components) { if (component instanceof EntityInfoComponent) { EntityInfoComponent comp = (EntityInfoComponent) component; prefabName = comp.parentPrefab; if (blockUri != null) break; } else if (component instanceof BlockComponent) { BlockComponent comp = (BlockComponent) component; blockUri = comp.getBlock().getBlockFamily().getURI(); if (prefabName != null) break; } } EntityBeingGenerated event = new EntityBeingGenerated(prefabName, blockUri, components); eventSystem.send(entity, event); components = event.getResultComponents(); for (Component c : components) { store.put(entity.getId(), c); } if (eventSystem != null) { eventSystem.send(entity, OnAddedComponent.newInstance()); eventSystem.send(entity, OnActivatedComponent.newInstance()); } return entity; }</code><technical_language>Is move block uri code of entity manager? entity system incorporate block concerns (this issues I moving core engine a separate library)</technical_language>

Target:
public EntityRef create(Iterable<Component> components) { EntityRef entity = createAndSendEvent(components); if (eventSystem != null) { eventSystem.send(entity, OnAddedComponent.newInstance()); eventSystem.send(entity, OnActivatedComponent.newInstance()); } return entity; }
Source:
<code>private void ensureDateActivatedIsSet(Order order) { isDrugOrder = DrugOrder.class.isAssignableFrom(getActualType(order)); <START> concept = order.getConcept(); <END> }</code><technical_language>this is for ensureConceptIsSet</technical_language>

Target:
private void ensureDateActivatedIsSet(Order order) { if (order.getDateActivated() == null) { order.setDateActivated(new Date()); } }
Source:
<code>public CsvParserConfig(CsvPreference preferences) { this.preferences = preferences; this.oneLineRecord = false; this.quotedEmptyIsNull = false; <START> this.skipCarriageReturn = true; <END> }</code><technical_language>License header is missing</technical_language>

Target:
public CsvParserConfig(CsvPreference preferences) { this.preferences = preferences; this.oneLineRecord = false; this.quotedEmptyIsNull = false; this.preserveLineEndings = true; }
Source:
<code>public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.VM.name().toLowerCase(), (getVmName() == null) ? "" : getVmName()); jobProperties.put(VdcObjectType.VdsGroups.name().toLowerCase(), getVdsGroupName()); <START> jobProperties.put(VdcObjectType.StoragePool.name(), getStoragePoolName()); <END> } return jobProperties; }</code><technical_language>StorageHandlingCommandBase has: jobProperties.put(VdcObjectType.StoragePool.name().toLowerCase(), getStoragePoolName()); jobProperties.put(VdcObjectType.Storage.name().toLowerCase(), getStorageDomainName()); jobProperties.put(VdcObjectType.VDS.name().toLowerCase(), getVdsName()); rely remove super.getJobMessageProperties call above, right redundant. Personally I prefer (getting rid of super...)</technical_language>

Target:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.VM.name().toLowerCase(), (getVmName() == null) ? "" : getVmName()); jobProperties.put(VdcObjectType.VdsGroups.name().toLowerCase(), getVdsGroupName()); } return jobProperties; }
Source:
<code>private String createResults() { QueryResults queryResults = new QueryResults( "20160128_214710_00012_rk68b", server.url("/query.html?20160128_214710_00012_rk68b").uri(), null, null, ImmutableList.of(new Column("_col0", BigintType.BIGINT)), ImmutableList.of(ImmutableList.of(123)), StatementStats.builder().setState("FINISHED").build(), null, null, <START> null, <END> null); return QUERY_RESULTS_CODEC.toJson(queryResults); }</code><technical_language>please squash this commit</technical_language>

Target:
private String createResults() { QueryResults queryResults = new QueryResults( "20160128_214710_00012_rk68b", server.url("/query.html?20160128_214710_00012_rk68b").uri(), null, null, ImmutableList.of(new Column("_col0", BigintType.BIGINT)), ImmutableList.of(ImmutableList.of(123)), StatementStats.builder().setState("FINISHED").build(), null, ImmutableList.of(), null, null); return QUERY_RESULTS_CODEC.toJson(queryResults); }
Source:
<code>public boolean isConnectSucceeded(final Map<String, String> returnValue, List<StorageServerConnections> connections) { boolean result = true; List<String> failedConnectionsList = LinqUtils.filter(returnValue.keySet(), new Predicate<String>() { @Override public boolean eval(String a) { return !"0".equals(returnValue.get(a)); } }); for (String failedConnection : failedConnectionsList) { List<LUNs> failedLuns = DbFacade.getInstance().getLunDao() .getAllForStorageServerConnection(failedConnection); if (!failedLuns.isEmpty()) { for (LUNs lun : failedLuns) { List<String> strings = LinqUtils.transformToList( DbFacade.getInstance() .getStorageServerConnectionLunMapDao() .getAll(lun.getLUN_id()), new Function<LUN_storage_server_connection_map, String>() { @Override public String eval(LUN_storage_server_connection_map a) { return a.getstorage_server_connection(); } }); if (CollectionUtils.subtract(strings, failedConnectionsList).size() == 0) { <START> log.info("The lun with id '{}' was reported as problematic !", lun.getphysical_volume_id()); <END> for (String connectionFailed : failedConnectionsList) { String connectionField = addToAuditLogErrorMessage(connectionFailed, returnValue.get(connectionFailed), connections, lun); printLog(log, connectionField, returnValue.get(connectionFailed)); } return false; } } } else { result = false; printLog(log, failedConnection, returnValue.get(failedConnection)); } } return result; }</code><technical_language>s/ !//</technical_language>

Target:
public boolean isConnectSucceeded(final Map<String, String> returnValue, List<StorageServerConnections> connections) { boolean result = true; List<String> failedConnectionsList = LinqUtils.filter(returnValue.keySet(), new Predicate<String>() { @Override public boolean eval(String a) { return !"0".equals(returnValue.get(a)); } }); for (String failedConnection : failedConnectionsList) { List<LUNs> failedLuns = DbFacade.getInstance().getLunDao() .getAllForStorageServerConnection(failedConnection); if (!failedLuns.isEmpty()) { for (LUNs lun : failedLuns) { List<String> strings = LinqUtils.transformToList( DbFacade.getInstance() .getStorageServerConnectionLunMapDao() .getAll(lun.getLUN_id()), new Function<LUN_storage_server_connection_map, String>() { @Override public String eval(LUN_storage_server_connection_map a) { return a.getstorage_server_connection(); } }); if (CollectionUtils.subtract(strings, failedConnectionsList).size() == 0) { log.info("The lun with id '{}' was reported as problematic", lun.getphysical_volume_id()); for (String connectionFailed : failedConnectionsList) { String connectionField = addToAuditLogErrorMessage(connectionFailed, returnValue.get(connectionFailed), connections, lun); printLog(log, connectionField, returnValue.get(connectionFailed)); } return false; } } } else { result = false; printLog(log, failedConnection, returnValue.get(failedConnection)); } } return result; }
Source:
<code>private Boolean buildFile(String path) { File csvFile = new File(path); <START> if(csvFile.exists() && !csvFile.isDirectory()) { <END> Long currentTime = System.currentTimeMillis(); Long fileCreationTime = csvFile.lastModified(); if ((currentTime - fileCreationTime ) > 3600000) { return true; } return false; } else if (!csvFile.exists()) { return true; } else { return false; } }</code><technical_language>space if (</technical_language>

Target:
private Boolean buildFile(String path) { File csvFile = new File(path); if (csvFile.exists() && !csvFile.isDirectory()) { Long currentTime = System.currentTimeMillis(); Long fileCreationTime = csvFile.lastModified(); if ((currentTime - fileCreationTime ) > SECONDS_IN_ONE_HOUR) { return true; } return false; } else if (!csvFile.exists()) { return true; } else { return false; } }
Source:
<code>private ComputerLauncher determineLauncher(final VSphere vSphere, final String cloneName) throws VSphereException { if (launcher instanceof JNLPLauncher) { return launcher; } if (launcher instanceof CommandLauncher) { return launcher; } if (launcher instanceof SSHLauncher) { final SSHLauncher sshLauncher = (SSHLauncher) launcher; LOGGER.log(Level.FINER, "Slave {0} uses SSHLauncher - obtaining IP address...", cloneName); final String ip = vSphere.getIp(vSphere.getVmByName(cloneName), 1000); LOGGER.log(Level.FINER, "Slave {0} has IP address {1}", new Object[] { cloneName, ip }); final SSHLauncher launcherWithIPAddress = new SSHLauncher(ip, sshLauncher.getPort(), sshLauncher.getCredentialsId(), sshLauncher.getJvmOptions(), sshLauncher.getJavaPath(), sshLauncher.getPrefixStartSlaveCmd(), sshLauncher.getSuffixStartSlaveCmd(), sshLauncher.getLaunchTimeoutSeconds(), sshLauncher.getMaxNumRetries(), sshLauncher.getRetryWaitTime(), sshLauncher.getSshHostKeyVerificationStrategy()); <START> } <END> throw new IllegalStateException("Unsupported launcher (" + launcher + ") in template configuration"); }</code><technical_language>I must've missed this time around, this right - a SSHLauncher connect slave Jenkins</technical_language>

Target:
private ComputerLauncher determineLauncher(final VSphere vSphere, final String cloneName) throws VSphereException { if (launcher instanceof JNLPLauncher) { return launcher; } if (launcher instanceof CommandLauncher) { return launcher; } if (launcher instanceof SSHLauncher) { final SSHLauncher sshLauncher = (SSHLauncher) launcher; LOGGER.log(Level.FINER, "Slave {0} uses SSHLauncher - obtaining IP address...", cloneName); final String ip = vSphere.getIp(vSphere.getVmByName(cloneName), 1000); LOGGER.log(Level.FINER, "Slave {0} has IP address {1}", new Object[] { cloneName, ip }); final SSHLauncher launcherWithIPAddress = new SSHLauncher(ip, sshLauncher.getPort(), sshLauncher.getCredentialsId(), sshLauncher.getJvmOptions(), sshLauncher.getJavaPath(), sshLauncher.getPrefixStartSlaveCmd(), sshLauncher.getSuffixStartSlaveCmd(), sshLauncher.getLaunchTimeoutSeconds(), sshLauncher.getMaxNumRetries(), sshLauncher.getRetryWaitTime(), sshLauncher.getSshHostKeyVerificationStrategy()); return launcherWithIPAddress; } throw new IllegalStateException("Unsupported launcher (" + launcher + ") in template configuration"); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_crash_warning); Button closeButton = (Button)findViewById(R.id.CloseWarning); closeButton.setText(Localization.get("crash.warning.button")); closeButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { setResult(RESULT_OK); finish(); } }); Intent intent = getIntent(); <START> setWarningText(intent); <END> setHowToProceedText(intent); }</code><technical_language>methods performed separately/one other? If sense combine method</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); loadSaveInstanceState(savedInstanceState); setContentView(R.layout.activity_crash_warning); setupUi(); }
Source:
<code>public void testRemoveAll(){ final AtomicBoolean removed = new AtomicBoolean(false); final AtomicBoolean added = new AtomicBoolean(false); final AtomicInteger callCount = new AtomicInteger(0); final ObservableArrayList<String> list = new ObservableArrayList<>(); Assert.assertTrue(list.isEmpty()); Assert.assertEquals(list.size(), 0); addOnChangeListener(removed, added, callCount, list); list.addAll("1", "2", "3", "4", "5", "6", "7" ,"8" , "9", "10"); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(list.size(), 10); Assert.assertTrue(added.get()); <START> <END> list.removeAll(Arrays.asList("1", "2", "3", "4", "5")); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(list.size(), 5); assertSameContent(list, Arrays.asList("6", "7" ,"8" , "9", "10")); Assert.assertTrue(removed.get()); Assert.assertEquals(2, callCount.get()); list.clear(); }</code><technical_language>set Added false & check removed is false</technical_language>

Target:
public void testRemoveAll(){ final AtomicBoolean removed = new AtomicBoolean(false); final AtomicBoolean added = new AtomicBoolean(false); final AtomicInteger callCount = new AtomicInteger(0); final ObservableArrayList<String> list = new ObservableArrayList<>(); Assert.assertTrue(list.isEmpty()); Assert.assertEquals(list.size(), 0); addOnChangeListener(removed, added, callCount, list); list.addAll("1", "2", "3", "4", "5", "6", "7" ,"8" , "9", "10"); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(list.size(), 10); Assert.assertTrue(added.get()); Assert.assertFalse(removed.get()); list.removeAll(Arrays.asList("1", "2", "3", "4", "5")); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(list.size(), 5); assertSameContent(list, Arrays.asList("6", "7" ,"8" , "9", "10")); Assert.assertTrue(removed.get()); Assert.assertFalse(added.get()); Assert.assertEquals(2, callCount.get()); list.clear(); }
Source:
<code>public Map<String, Metric.Builder> processRunMetrics(HashMap<String, Metric> rawMetrics) { Map<String, Metric.Builder> aggregateMetrics = new HashMap<String, Metric.Builder>(); for (String key : <START> aggregate.keySet()) <END> { Collection<Metric> metrics = aggregate.get(key); Collection<Measurements> measures = metrics.stream().map(Metric::getMeasurements).collect(Collectors.toList()); List<String> rawValues = measures.stream() .map(Measurements::getSingleString) .map( m -> { List<String> splitVals = Arrays.asList(m.split(",", 0)); if (splitVals.size() == 1 && "".equals(splitVals.get(0))) { return Collections.<String>emptyList(); } return splitVals; }) .flatMap(Collection::stream) .map(String::trim) .collect(Collectors.toList()); if (rawValues.isEmpty()) { continue; } boolean areAllDoubles = rawValues .stream() .allMatch( val -> { try { Double.parseDouble(val); return true; } catch (NumberFormatException e) { return false; } }); if (areAllDoubles) { Collection<Double> values = rawValues.stream().map(Double::parseDouble).collect(Collectors.toList()); HashMap<String, Double> stats = getStats(values); for (String statKey : stats.keySet()) { Metric.Builder metricBuilder = Metric.newBuilder(); metricBuilder .getMeasurementsBuilder() .setSingleString(String.format("%2.2f", stats.get(statKey))); aggregateMetrics.put( String.join(STATS_KEY_SEPARATOR, key, statKey), metricBuilder); } } else { CLog.i("Metric %s is not numeric", key); } } return aggregateMetrics; }</code><technical_language>This aggregate test runs. subsequent runs get metrics continuation of calculation is weird. consider runs independent units, meaning of aggregating runs</technical_language>

Target:
public Map<String, Metric.Builder> processRunMetrics(HashMap<String, Metric> rawMetrics) { return new HashMap<String, Metric.Builder>(); }
Source:
<code>private ConditionalFlutation prewrite(ConditionalFlutation cm, Bytes row, Column col, Bytes val, Bytes primaryRow, Column primaryColumn, boolean isTriggerRow) { IteratorSetting iterConf = new IteratorSetting(10, PrewriteIterator.class); PrewriteIterator.setSnaptime(iterConf, startTs); boolean isTrigger = isTriggerRow && col.equals(notification.getColumn()); if (isTrigger) { PrewriteIterator.enableAckCheck(iterConf, notification.getTimestamp()); } Condition cond = new FluoCondition(env, col).setIterators(iterConf); if (cm == null) { cm = new ConditionalFlutation(env, row, cond); } else { cm.addCondition(cond); } if (val != null && val != DELETE) { cm.put(col, ColumnConstants.DATA_PREFIX | startTs, val.toArray()); } cm.put(col, ColumnConstants.LOCK_PREFIX | startTs, LockValue.encode(primaryRow, primaryColumn, val != null, val == DELETE, isTriggerRow, getTransactorID())); <START> cm.put(col, ColumnConstants.LOCK_PREFIX | startTs, LockValue.encode(primaryRow, primaryColumn, <END> val != null, val == DELETE, isTriggerRow, getTransactorID())); return cm; }</code><technical_language>is a reason this statement is called twice</technical_language>

Target:
private ConditionalFlutation prewrite(ConditionalFlutation cm, Bytes row, Column col, Bytes val, Bytes primaryRow, Column primaryColumn, boolean isTriggerRow) { IteratorSetting iterConf = new IteratorSetting(10, PrewriteIterator.class); PrewriteIterator.setSnaptime(iterConf, startTs); boolean isTrigger = isTriggerRow && col.equals(notification.getColumn()); if (isTrigger) { PrewriteIterator.enableAckCheck(iterConf, notification.getTimestamp()); } Condition cond = new FluoCondition(env, col).setIterators(iterConf); if (cm == null) { cm = new ConditionalFlutation(env, row, cond); } else { cm.addCondition(cond); } if (val != null && val != DELETE) { cm.put(col, ColumnConstants.DATA_PREFIX | startTs, val.toArray()); } cm.put(col, ColumnConstants.LOCK_PREFIX | startTs, LockValue.encode(primaryRow, primaryColumn, val != null, val == DELETE, isTriggerRow, getTransactorID())); return cm; }
Source:
<code>public AzkabanNode toAzkabanNode(final NodeBean nodeBean) { if (nodeBean.getType().equals(Constants.FLOW_NODE_TYPE)) { return new AzkabanFlow.AzkabanFlowBuilder() .setName(nodeBean.getName()) .setProps(nodeBean.getProps()) .setDependsOn(nodeBean.getDependsOn()) .setNodes( nodeBean.getNodes().stream().map(this::toAzkabanNode).collect(Collectors.toList())) <START> .setFlowTrigger(toFlowTrigger(nodeBean.getTrigger())) <END> .build(); } else { return new AzkabanJob.AzkabanJobBuilder() .setName(nodeBean.getName()) .setProps(nodeBean.getProps()) .setType(nodeBean.getType()) .setDependsOn(nodeBean.getDependsOn()) .build(); } }</code><technical_language>Nit: In fact, if build pattern, need explicitly call this method "set{blabla}", method other build called set</technical_language>

Target:
public AzkabanNode toAzkabanNode(final NodeBean nodeBean) { if (nodeBean.getType().equals(Constants.FLOW_NODE_TYPE)) { return new AzkabanFlow.AzkabanFlowBuilder() .name(nodeBean.getName()) .props(nodeBean.getProps()) .dependsOn(nodeBean.getDependsOn()) .nodes(nodeBean.getNodes().stream().map(this::toAzkabanNode).collect(Collectors.toList())) .flowTrigger(toFlowTrigger(nodeBean.getTrigger())) .build(); } else { return new AzkabanJob.AzkabanJobBuilder() .name(nodeBean.getName()) .props(nodeBean.getProps()) .type(nodeBean.getType()) .dependsOn(nodeBean.getDependsOn()) .build(); } }
Source:
<code>protected void fillFileBox(RemoteWebElement fileBoxElement, String fileName) { if (fileName.isEmpty()) { fileBoxElement.clear(); } else { fileBoxElement.setFileDetector(new UselessFileDetector()); <START> String newFilePath = new File(fileName).getAbsolutePath(); <END> fileBoxElement.sendKeys(newFilePath); } }</code><technical_language>new? "old" here</technical_language>

Target:
protected void fillFileBox(RemoteWebElement fileBoxElement, String fileName) { if (fileName.isEmpty()) { fileBoxElement.clear(); } else { fileBoxElement.setFileDetector(new UselessFileDetector()); String filePath = new File(fileName).getAbsolutePath(); fileBoxElement.sendKeys(filePath); } }
Source:
<code>public static VmInterfaceType getDefaultNicType(Collection<VmInterfaceType> items) { <START> return items.contains(VmInterfaceType.pv) ? VmInterfaceType.pv : items.iterator().next(); <END> }</code><technical_language>logic in BaseEditVmInterfaceModel: nicTypes = nicTypes == null ? new ArrayList<VmInterfaceType>() : nicTypes; items expected empty ArrayList. In case items.iterator().next() fail NoSuchElementException</technical_language>

Target:
public static VmInterfaceType getDefaultNicType(Collection<VmInterfaceType> items) { if (items == null || items.isEmpty()) { return null; } else if (items.contains(VmInterfaceType.pv)) { return VmInterfaceType.pv; } else { return items.iterator().next(); } }
Source:
<code>private void testMergeCacheConfig(int firstIdx, int secondIdx) throws Exception { prepareTestGrid(); <START> { <END> IgniteEx ig = startGrid(firstIdx); startGrid(secondIdx); ig.cluster().state(ClusterState.ACTIVE); awaitPartitionMapExchange(); performQueryingIntegrityCheck(ig); stopAllGrids(); } { IgniteEx ig = startGrids(2); ig.cluster().state(ClusterState.ACTIVE); awaitPartitionMapExchange(); performQueryingIntegrityCheck(ig); } }</code><technical_language>Please, avoid nested code blocks. This reduces code readability. split this test. Note, afterTest perform stopAllGrids already</technical_language>

Target:
private void testMergeCacheConfig(int firstIdx, int secondIdx) throws Exception { prepareTestGrid(); IgniteEx ig = startGrid(firstIdx); startGrid(secondIdx); ig.cluster().state(ClusterState.ACTIVE); awaitPartitionMapExchange(); performQueryingIntegrityCheck(ig); stopAllGrids(); ig = startGrids(2); ig.cluster().state(ClusterState.ACTIVE); awaitPartitionMapExchange(); performQueryingIntegrityCheck(ig); }
Source:
<code>public void startServers() throws Exception { <START> System.out.println("In @Before method"); <END> CLUSTER.getClusterControl().startAllServers(); CLUSTER.getClusterControl().waitForActive(); CLUSTER.getClusterControl().waitForRunningPassivesInStandby(); final CacheManagerBuilder<PersistentCacheManager> clusteredCacheManagerBuilder = CacheManagerBuilder.newCacheManagerBuilder() .with(ClusteringServiceConfigurationBuilder.cluster(CLUSTER.getConnectionURI().resolve("/cm-replication")) .timeouts(TimeoutsBuilder.timeouts() .read(Duration.ofMinutes(1)) .write(Duration.ofMinutes(1))) .autoCreate(server -> server.defaultServerResource("primary-server-resource"))); cacheManager = clusteredCacheManagerBuilder.build(true); CacheConfiguration<Long, String> config = CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, ResourcePoolsBuilder.newResourcePoolsBuilder().heap(100, EntryUnit.ENTRIES) .with(ClusteredResourcePoolBuilder.clusteredDedicated("primary-server-resource", 1, MemoryUnit.MB))) .withService(ClusteredStoreConfigurationBuilder.withConsistency(cacheConsistency)) .build(); cacheOne = cacheManager.createCache(testName.getMethodName() + "-1", config); cacheTwo = cacheManager.createCache(testName.getMethodName() + "-2", config); }</code><technical_language>do want</technical_language>

Target:
public void startServers() throws Exception { CLUSTER.getClusterControl().startAllServers(); CLUSTER.getClusterControl().waitForActive(); CLUSTER.getClusterControl().waitForRunningPassivesInStandby(); final CacheManagerBuilder<PersistentCacheManager> clusteredCacheManagerBuilder = CacheManagerBuilder.newCacheManagerBuilder() .with(ClusteringServiceConfigurationBuilder.cluster(CLUSTER.getConnectionURI().resolve("/cm-replication")) .timeouts(TimeoutsBuilder.timeouts() .read(Duration.ofMinutes(1)) .write(Duration.ofMinutes(1))) .autoCreate(server -> server.defaultServerResource("primary-server-resource"))); cacheManager = clusteredCacheManagerBuilder.build(true); CacheConfiguration<Long, String> config = CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, ResourcePoolsBuilder.newResourcePoolsBuilder().heap(100, EntryUnit.ENTRIES) .with(ClusteredResourcePoolBuilder.clusteredDedicated("primary-server-resource", 1, MemoryUnit.MB))) .withService(ClusteredStoreConfigurationBuilder.withConsistency(cacheConsistency)) .build(); cacheOne = cacheManager.createCache(testName.getMethodName() + "-1", config); cacheTwo = cacheManager.createCache(testName.getMethodName() + "-2", config); }
Source:
<code>protected final void layoutChildren() { <START> final double width = rectangle.getWidth(); <END> final double height = rectangle.getHeight(); clip.setWidth(width); clip.setHeight(height); clip.setLayoutX(0); clip.setLayoutY(-height / 2); if (resizeWidth == -1) { rectangle.setWidth(text.getLayoutBounds().getWidth()); } else { rectangle.setWidth(resizeWidth); } text.setLayoutX(width / 2 - text.getLayoutBounds().getWidth() / 2); text.setLayoutY(height / 2); }</code><technical_language>Minor inconsistency: final local variables. local variables final of them</technical_language>

Target:
protected final void layoutChildren() { double width = rectangle.getWidth(); double height = rectangle.getHeight(); clip.setWidth(width); clip.setHeight(height); clip.setLayoutX(0); clip.setLayoutY(-height / 2); if (resizeWidth == -1) { rectangle.setWidth(text.getLayoutBounds().getWidth()); } else { rectangle.setWidth(resizeWidth); } text.setLayoutX(width / 2 - text.getLayoutBounds().getWidth() / 2); text.setLayoutY(height / 2); }
Source:
<code>public Action onFragment( final DirectBuffer srcBuffer, final int srcOffset, final int srcLength, final Header header) { final int messageLength = srcLength - FRAME_LENGTH; final int messageOffset = srcOffset + FRAME_LENGTH; messageHeaderDecoder.wrap(srcBuffer, srcOffset); messageDecoder.wrap( srcBuffer, srcOffset + MessageHeaderDecoder.ENCODED_LENGTH, messageHeaderDecoder.blockLength(), messageHeaderDecoder.version()); asciiBuffer.wrap(srcBuffer, messageOffset, messageLength); headerDecoder.decode(asciiBuffer, 0, messageLength); <START> final long messageType = messageDecoder.sbeSchemaVersion() > 2 ? <END> messageDecoder.messageType() : messageDecoder.deprecatedMessageType(); if (messageType == HEARTBEAT_MESSAGE_TYPE) { if (heartbeatRangeSequenceNumberStart == OUT_OF_RANGE) { heartbeatRangeSequenceNumberStart = headerDecoder.msgSeqNum(); } return CONTINUE; } else { if (heartbeatRangeSequenceNumberStart != OUT_OF_RANGE) { if (!sendGapFill()) { return ABORT; } } return processNormalMessage(srcBuffer, srcOffset, srcLength, messageLength, messageOffset); } }</code><technical_language>a named constant for schema version a magic number please</technical_language>

Target:
public Action onFragment( final DirectBuffer srcBuffer, final int srcOffset, final int srcLength, final Header header) { final int messageLength = srcLength - FRAME_LENGTH; final int messageOffset = srcOffset + FRAME_LENGTH; messageHeaderDecoder.wrap(srcBuffer, srcOffset); messageDecoder.wrap( srcBuffer, srcOffset + MessageHeaderDecoder.ENCODED_LENGTH, messageHeaderDecoder.blockLength(), messageHeaderDecoder.version()); asciiBuffer.wrap(srcBuffer, messageOffset, messageLength); headerDecoder.decode(asciiBuffer, 0, messageLength); final long messageType = MessageTypeExtractor.getMessageType(messageDecoder); if (messageType == HEARTBEAT_MESSAGE_TYPE) { if (heartbeatRangeSequenceNumberStart == OUT_OF_RANGE) { heartbeatRangeSequenceNumberStart = headerDecoder.msgSeqNum(); } return CONTINUE; } else { if (heartbeatRangeSequenceNumberStart != OUT_OF_RANGE) { if (!sendGapFill()) { return ABORT; } } return processNormalMessage(srcBuffer, srcOffset, srcLength, messageLength, messageOffset); } }
Source:
<code>private void register() { if ( this.clientReg != null ) { return; } <START> this.clientReg = context.registerService( EsClient.class, client, new Hashtable<>() ); <END> this.isRegistered = true; }</code><technical_language>pass empty Hashtable. pass null. legacy class is in is a nanoseconds faster :)</technical_language>

Target:
private synchronized void register() { if ( this.clientReg != null ) { return; } this.clientReg = context.registerService( EsClient.class, client, null ); }
Source:
<code>public Object deliverMessage(final Method method, final Object[] args) throws Throwable { boolean callBeforeAfter = false; switch (state) { case NONE: try { beforeDelivery(method); } catch (final ApplicationServerInternalException e) { throw (EJBException) new EJBException().initCause(e.getCause()); } callBeforeAfter = true; state = State.METHOD_CALLED; break; case BEFORE_CALLED: state = State.METHOD_CALLED; break; case RELEASED: throw new IllegalStateException("Message endpoint factory has been released"); case METHOD_CALLED: case SYSTEM_EXCEPTION: throw new IllegalStateException("The last message delivery must be completed with an afterDeliver before another message can be delivered"); } Throwable throwable = null; Object value = null; try { value = container.invoke(instance, method, null, wrapMessageForAmq5(args)); } catch (final SystemException se) { throwable = se.getRootCause() != null ? se.getRootCause() : se; state = State.SYSTEM_EXCEPTION; } catch (final ApplicationException ae) { throwable = ae.getRootCause() != null ? ae.getRootCause() : ae; } finally { if (callBeforeAfter) { try { afterDelivery(); } catch (final ApplicationServerInternalException e) { throwable = throwable == null ? e.getCause() : throwable; } catch (final UnavailableException e) { throwable = throwable == null ? e : throwable; } } } if (throwable != null) { <START> throwable.printStackTrace(); <END> if (isValidException(method, throwable)) { throw throwable; } else { throw new EJBException().initCause(throwable); } } return value; }</code><technical_language>logging instead</technical_language>

Target:
public Object deliverMessage(final Method method, final Object[] args) throws Throwable { boolean callBeforeAfter = false; switch (state) { case NONE: try { beforeDelivery(method); } catch (final ApplicationServerInternalException e) { throw (EJBException) new EJBException().initCause(e.getCause()); } callBeforeAfter = true; state = State.METHOD_CALLED; break; case BEFORE_CALLED: state = State.METHOD_CALLED; break; case RELEASED: throw new IllegalStateException("Message endpoint factory has been released"); case METHOD_CALLED: case SYSTEM_EXCEPTION: throw new IllegalStateException("The last message delivery must be completed with an afterDeliver before another message can be delivered"); } Throwable throwable = null; Object value = null; try { value = container.invoke(instance, method, null, wrapMessageForAmq5(args)); } catch (final SystemException se) { throwable = se.getRootCause() != null ? se.getRootCause() : se; state = State.SYSTEM_EXCEPTION; } catch (final ApplicationException ae) { throwable = ae.getRootCause() != null ? ae.getRootCause() : ae; } finally { if (callBeforeAfter) { try { afterDelivery(); } catch (final ApplicationServerInternalException e) { throwable = throwable == null ? e.getCause() : throwable; } catch (final UnavailableException e) { throwable = throwable == null ? e : throwable; } } } if (throwable != null) { if (isValidException(method, throwable)) { throw throwable; } else { throw new EJBException().initCause(throwable); } } return value; }
Source:
<code>public void blockServiceOnDestination(PerunSession sess, Service service, int destinationId) throws InternalErrorException, PrivilegeException, DestinationNotExistsException, ServiceAlreadyBannedException, FacilityNotExistsException { <START> Destination destination = getDestinationById(sess, destinationId); <END> List<Facility> destinationFacilities = perunBl.getFacilitiesManager().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNADMIN)) { throw new PrivilegeException(sess, "blockServiceOnDestination"); } getServicesManagerBl().blockServiceOnDestination(sess, service, destinationId); }</code><technical_language>call BL layer methods, entry, caller get PrivilegeException name of method called</technical_language>

Target:
public void blockServiceOnDestination(PerunSession sess, Service service, int destinationId) throws InternalErrorException, PrivilegeException, DestinationNotExistsException, ServiceAlreadyBannedException, FacilityNotExistsException { Destination destination = getServicesManagerBl().getDestinationById(sess, destinationId); List<Facility> destinationFacilities = perunBl.getFacilitiesManagerBl().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNADMIN)) { throw new PrivilegeException(sess, "blockServiceOnDestination"); } getServicesManagerBl().blockServiceOnDestination(sess, service, destinationId); }
Source:
<code>static void set(TenantId tenantId) { <START> checkNotDefaultArg(tenantId); <END> threadLocal.set(tenantId); }</code><technical_language>"Tenant ID default"</technical_language>

Target:
static void set(TenantId tenantId) { checkNotDefaultArg(tenantId, "A tenant ID must not be a default value."); threadLocal.set(tenantId); }
Source:
<code>public void testConcurrentMoveToSameDest() throws Exception { final int N = 5; final Fqn X = Fqn.fromString("/x"), Y = Fqn.fromString("/y"); Node<Object, Object> rootNode = treeCache.getRoot(); Node<Object, Object> nodeA = rootNode.addChild(A); nodeA.addChild(X); Node<Object, Object> nodeB = rootNode.addChild(B); nodeB.addChild(Y); Node<Object, Object> nodeC = rootNode.addChild(C); Callable<Object>[] movers = new Callable[N]; for (int i = 0; i < N; i++) { final Fqn source = i % 2 == 0 ? Fqn.fromRelativeFqn(A, X) : Fqn.fromRelativeFqn(B, Y); movers[i] = new Callable<Object>() { public Object call() throws Exception { try { treeCache.move(source, C); } catch (Exception e) { } return null; } }; } <START> runConcurrently(movers[0], movers[1], Arrays.copyOfRange(movers, 2, movers.length)); <END> log.info("Tree: " + TreeStructureSupport.printTree(treeCache, true)); assertNoLocks(); assertTrue(nodeA.getChildrenNames().contains("x") ^ nodeC.getChildrenNames().contains("x")); assertTrue(nodeB.getChildrenNames().contains("y") ^ nodeC.getChildrenNames().contains("y")); }</code><technical_language>necessary, runConcurrently(movers) work</technical_language>

Target:
public void testConcurrentMoveToSameDest() throws Exception { final int N = 5; final Fqn X = Fqn.fromString("/x"), Y = Fqn.fromString("/y"); Node<Object, Object> rootNode = treeCache.getRoot(); Node<Object, Object> nodeA = rootNode.addChild(A); nodeA.addChild(X); Node<Object, Object> nodeB = rootNode.addChild(B); nodeB.addChild(Y); Node<Object, Object> nodeC = rootNode.addChild(C); Callable<Object>[] movers = new Callable[N]; for (int i = 0; i < N; i++) { final Fqn source = i % 2 == 0 ? Fqn.fromRelativeFqn(A, X) : Fqn.fromRelativeFqn(B, Y); movers[i] = new Callable<Object>() { public Object call() throws Exception { try { treeCache.move(source, C); } catch (Exception e) { } return null; } }; } runConcurrently(movers); log.info("Tree: " + TreeStructureSupport.printTree(treeCache, true)); assertNoLocks(); assertTrue(nodeA.getChildrenNames().contains("x") ^ nodeC.getChildrenNames().contains("x")); assertTrue(nodeB.getChildrenNames().contains("y") ^ nodeC.getChildrenNames().contains("y")); }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); sb.append("COMPLETE_TRANSACTION (FROM COORD: "); sb.append(CoreUtils.hsIdToString(m_coordinatorHSId)); sb.append(") FOR TXN "); sb.append(TxnEgo.txnIdToString(m_txnId) + "(" + m_txnId + ")"); sb.append("\n SP HANDLE: "); sb.append(TxnEgo.txnIdToString(getSpHandle())); sb.append("\n FLAGS: ").append(m_flags); if (isNPartTxn()) sb.append("\n ").append(" N Partition TXN"); sb.append("\n TIMESTAMP: "); MpRestartSequenceGenerator.restartSeqIdToString(m_timestamp, sb); sb.append("\n TRUNCATION HANDLE:" + TxnEgo.txnIdToString(getTruncationHandle())); sb.append("\n HASH: " + String.valueOf(m_hash)); if (isRollback()) sb.append("\n THIS IS AN ROLLBACK REQUEST"); if (requiresAck()) sb.append("\n THIS MESSAGE REQUIRES AN ACK"); if (isRestart()) { sb.append("\n THIS IS A TRANSACTION RESTART"); } if (!isForReplica()) { sb.append("\n SEND TO LEADER"); } if(!isRestartable()) { <START> sb.append("\n THIS IS NOT RESTARTaable"); <END> } return sb.toString(); }</code><technical_language>Correct typo</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("COMPLETE_TRANSACTION (FROM COORD: "); sb.append(CoreUtils.hsIdToString(m_coordinatorHSId)); sb.append(") FOR TXN "); sb.append(TxnEgo.txnIdToString(m_txnId) + "(" + m_txnId + ")"); sb.append("\n SP HANDLE: "); sb.append(TxnEgo.txnIdToString(getSpHandle())); sb.append("\n FLAGS: ").append(m_flags); if (isNPartTxn()) sb.append("\n ").append(" N Partition TXN"); sb.append("\n TIMESTAMP: "); MpRestartSequenceGenerator.restartSeqIdToString(m_timestamp, sb); sb.append("\n TRUNCATION HANDLE:" + TxnEgo.txnIdToString(getTruncationHandle())); sb.append("\n HASH: " + String.valueOf(m_hash)); if (isRollback()) sb.append("\n THIS IS AN ROLLBACK REQUEST"); if (requiresAck()) sb.append("\n THIS MESSAGE REQUIRES AN ACK"); if (isRestart()) { sb.append("\n THIS IS A TRANSACTION RESTART"); } if (!isForReplica()) { sb.append("\n SEND TO LEADER"); } if(!isRestartable()) { sb.append("\n THIS IS NOT RESTARTABLE"); } return sb.toString(); }
Source:
<code>public static Scheduler initMainThreadScheduler(Callable<Scheduler> scheduler) { <START> ObjectHelper.requireNonNull(scheduler, "Scheduler Callable can't be null"); <END> Function<Callable<Scheduler>, Scheduler> f = onInitMainThreadHandler; if (f == null) { return callRequireNonNull(scheduler); } return applyRequireNonNull(f, scheduler); }</code><technical_language>do a null check</technical_language>

Target:
public static Scheduler initMainThreadScheduler(Callable<Scheduler> scheduler) { if (scheduler == null) { throw new NullPointerException("scheduler == null"); } Function<Callable<Scheduler>, Scheduler> f = onInitMainThreadHandler; if (f == null) { return callRequireNonNull(scheduler); } return applyRequireNonNull(f, scheduler); }
Source:
<code>public void configure() throws ConfigurationException { try { KeyringConfigCallback callback = KeyringConfigCallbacks.withUnprotectedKeys(); if(secretPassword != null) callback = KeyringConfigCallbacks.withPassword(secretPassword); keyringConfig = KeyringConfigs.forGpgExportedKeys(callback); if(publicKey != null) <START> for(String s : publicKey) <END> keyringConfig.addPublicKey(IOUtils.toByteArray(new FileInputStream(s))); if(secretKey != null ) keyringConfig.addSecretKey(IOUtils.toByteArray(new FileInputStream(secretKey))); } catch (IOException | PGPException e) { throw new ConfigurationException("Unknown exception has occurred.", e); } }</code><technical_language>nest operations (if/for) traverse more 1 layer deep, more readable brackets..</technical_language>

Target:
public void configure() throws ConfigurationException { try { KeyringConfigCallback callback = KeyringConfigCallbacks.withUnprotectedKeys(); if (secretPassword != null) callback = KeyringConfigCallbacks.withPassword(secretPassword); keyringConfig = KeyringConfigs.forGpgExportedKeys(callback); if (publicKeys != null) { for (String s : publicKeys) { URL url = ClassUtils.getResourceURL(Thread.currentThread().getContextClassLoader(), s); keyringConfig.addPublicKey(IOUtils.toByteArray(url.openStream())); } } if (secretKey != null) { URL url = ClassUtils.getResourceURL(Thread.currentThread().getContextClassLoader(), secretKey); keyringConfig.addSecretKey(IOUtils.toByteArray(url.openStream())); } } catch (IOException | PGPException e) { throw new ConfigurationException("Unknown exception has occurred.", e); } }
Source:
<code>public Reason getReason(int start) { String reason = StringUtils.join(args, " ", start, args.length); List<String> notes = new ArrayList<>(); String[] matches = null; if (plugin.getConfig().isCreateNoteReasons()) { matches = StringUtils.substringsBetween(reason, "(", ")"); } if (matches != null) notes = Arrays.asList(matches); for (int i = start; i < args.length; i++) { if (!args[i].startsWith("#")) continue; String key = args[i].replace("#", ""); String replace = plugin.getReasonsConfig().getReason(key); if (replace != null) reason = reason.replace("#" + key, replace); <START> else if(plugin.getConfig().isBlockInvalidReasons()) invalidReason = true; <END> } for (String note : notes) { reason = reason.replace("(" + note + ")", ""); } reason = reason.trim(); return new Reason(reason, notes); }</code><technical_language>this wrapped in braces instead? I.e. suggestion if (replace != null) { reason = reason.replace("#" + key, replace); } else if(plugin.getConfig().isBlockInvalidReasons()) { invalidReason = true; }</technical_language>

Target:
public Reason getReason(int start) { String reason = StringUtils.join(args, " ", start, args.length); List<String> notes = new ArrayList<>(); String[] matches = null; if (plugin.getConfig().isCreateNoteReasons()) { matches = StringUtils.substringsBetween(reason, "(", ")"); } if (matches != null) notes = Arrays.asList(matches); for (int i = start; i < args.length; i++) { if (!args[i].startsWith("#")) continue; String key = args[i].replace("#", ""); String replace = plugin.getReasonsConfig().getReason(key); if (replace != null) reason = reason.replace("#" + key, replace); if (replace != null) { reason = reason.replace("#" + key, replace); } else if(plugin.getConfig().isBlockInvalidReasons()) { invalidReason = true; } } for (String note : notes) { reason = reason.replace("(" + note + ")", ""); } reason = reason.trim(); return new Reason(reason, notes); }
Source:
<code>public void shouldSuccessfully_authorise3ds() throws Exception { <START> app.getDatabaseTestHelper().enable3dsForGatewayAccount(Long.parseLong(accountId)); <END> String chargeId = createNewChargeWith(AUTHORISATION_3DS_REQUIRED, RandomIdGenerator.newId()); Map<String, String> payload = ImmutableMap.of("auth_3d_result", "AUTHORISED"); givenSetup() .body(new ObjectMapper().writeValueAsString(payload)) .post(authorise3dsChargeUrlFor(chargeId)) .then() .statusCode(200); assertFrontendChargeStatusIs(chargeId, AUTHORISATION_SUCCESS.getValue()); }</code><technical_language>name this in a distinction shouldSuccessfully_authoriseForAChargeRequiring3ds clearer? shouldAuthorise_whenRequires3dsAnd3dsAuthenticationSuccessful something</technical_language>

Target:
public void shouldSuccessfully_authorise3ds() throws Exception { app.getDatabaseTestHelper().enable3dsForGatewayAccount(Long.parseLong(accountId)); String chargeId = createNewChargeWith(AUTHORISATION_3DS_REQUIRED, RandomIdGenerator.newId()); Map<String, String> payload = ImmutableMap.of("auth_3ds_result", AUTHORISED.name()); givenSetup() .body(new ObjectMapper().writeValueAsString(payload)) .post(authorise3dsChargeUrlFor(chargeId)) .then() .statusCode(200); assertFrontendChargeStatusIs(chargeId, AUTHORISATION_SUCCESS.getValue()); }