auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public OrderRequestBuilder withAuthorisationDetails(AuthCardDetails authCardDetails) { OrderRequestBuilder orderRequestBuilder = super.withAuthorisationDetails(authCardDetails); <START> authCardDetails.getAddress().ifPresent(address -> northAmericanRegionMapper.getNorthAmericanRegionForCountry(address) .ifPresent(stateOrProvince -> smartpayTemplateData.setStateOrProvince(stateOrProvince.getAbbreviation())) ); <END> return orderRequestBuilder; }</code><technical_language>java authCardDetails.getAddress() .flatMap(northAmericanRegionMapper::getNorthAmericanRegionForCountry) .map(NorthAmericaRegion::getAbbreviation) .ifPresent(smartpayTemplateData::setStateOrProvince);</technical_language>

Target:
public OrderRequestBuilder withAuthorisationDetails(AuthCardDetails authCardDetails) { OrderRequestBuilder orderRequestBuilder = super.withAuthorisationDetails(authCardDetails); authCardDetails.getAddress() .flatMap(northAmericanRegionMapper::getNorthAmericanRegionForCountry) .map(NorthAmericaRegion::getAbbreviation) .ifPresent(smartpayTemplateData::setStateOrProvince); return orderRequestBuilder; }
Source:
<code>public Class<T> getBaseClass() { return baseClass; <START> } <END></code><technical_language>Is a method for modders share recipe types? enum system extender some form of get(ResourceLocation) good</technical_language>

Target:
public Class<? extends T> getBaseClass() { return baseClass; }
Source:
<code>public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData) { <START> return withContext(context -> client.encrypt(algorithm, plaintext, context, iv, authenticationData)).block(); <END> }</code><technical_language>Sync clients withContext. need explicitly add a Context API args. Note Context is supported for APIs return Response<T></technical_language>

Target:
public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData) { return encrypt(algorithm, plaintext, iv, authenticationData, Context.NONE); }
Source:
<code>public UsageEventType(String componentName, String componentVersion, String categoryName, String actionName, String labelDescription, String valueDescription) { if(componentName == null) { throw new IllegalArgumentException("Component name may not be null"); } componentName = componentName.replaceAll("\\s", "-"); if(componentVersion == null) { throw new IllegalArgumentException("Component version may not be null"); } if(actionName == null) { throw new IllegalArgumentException("Action name may not be null"); } actionName = actionName.replaceAll("\\s", "-"); if(categoryName == null) { categoryName = componentName; } categoryName = categoryName.replaceAll("\\s", "-"); this.componentName = componentName; this.componentVersion = componentVersion; this.categoryName = categoryName; this.actionName = actionName; this.labelDescription = labelDescription; this.valueDescription = valueDescription; <START> } <END></code><technical_language>unify 2 constructors? 1st differs this in 1st argument: Plugin component-name. If suggested util-method possible</technical_language>

Target:
public UsageEventType(String componentName, String componentVersion, String categoryName, String actionName, String labelDescription, String valueDescription) { Assert.isLegal(componentName!=null, "Component name may not be null"); Assert.isLegal(componentVersion!=null, "Component version may not be null"); Assert.isLegal(actionName != null, "Action name may not be null"); this.componentName = componentName.replaceAll("\\s", "-");; this.componentVersion = componentVersion; if(categoryName == null) { this.categoryName = this.componentName; } else { this.categoryName = categoryName.replaceAll("\\s", "-"); } this.actionName = actionName.replaceAll("\\s", "-");; this.labelDescription = labelDescription; this.valueDescription = valueDescription; }
Source:
<code>public PythonFunctionRegistrar(final ConnectionInfo connectionInfo) throws DbException { Preconditions.checkArgument( connectionInfo.getDbms().equals(MyriaConstants.STORAGE_SYSTEM_POSTGRESQL), "Profiling only supported with Postgres JDBC connection"); <START> <END> accessMethod = (JdbcAccessMethod) AccessMethod.of(connectionInfo.getDbms(), connectionInfo, false); accessMethod.createUnloggedTableIfNotExists( MyriaConstants.PYUDF_RELATION, MyriaConstants.PYUDF_SCHEMA); udfs = new TupleBatchBuffer(MyriaConstants.PYUDF_SCHEMA); }</code><technical_language>want "Python functions..."</technical_language>

Target:
public PythonFunctionRegistrar(final ConnectionInfo connectionInfo) throws DbException { Preconditions.checkArgument( connectionInfo.getDbms().equals(MyriaConstants.STORAGE_SYSTEM_POSTGRESQL), "Python functions only supported with Postgres JDBC connection"); this.connectionInfo = connectionInfo; connect(); accessMethod.createUnloggedTableIfNotExists( MyriaConstants.PYUDF_RELATION, MyriaConstants.PYUDF_SCHEMA); pyFunctions = new TupleBatchBuffer(MyriaConstants.PYUDF_SCHEMA); }
Source:
<code>public DataSerializableFactory createFactory() { ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN]; constructors[UPDATE_MAP_CONFIG] = arg -> new UpdateMapConfigOperation(); constructors[UPDATE_PERMISSION_CONFIG_OPERATION] = arg -> new UpdatePermissionConfigOperation(); <START> constructors[PERMISSION_CONFIG_DTO] = arg -> new PermissionConfigDTO(); <END> constructors[SET_LICENSE] = arg -> new SetLicenseOperation(); constructors[CHANGE_CLUSTER_STATE] = arg -> new ChangeClusterStateOperation(); return new ArrayDataSerializableFactory(constructors); }</code><technical_language>do PermissionConfigDTO if remove MapConfigDTO? I assume removed client protocol changes care of serialization etc. Is for permissions</technical_language>

Target:
public DataSerializableFactory createFactory() { ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN]; constructors[UPDATE_MAP_CONFIG] = arg -> new UpdateMapConfigOperation(); constructors[SET_LICENSE] = arg -> new SetLicenseOperation(); constructors[CHANGE_CLUSTER_STATE] = arg -> new ChangeClusterStateOperation(); constructors[UPDATE_PERMISSION_CONFIG_OPERATION] = arg -> new UpdatePermissionConfigOperation(); return new ArrayDataSerializableFactory(constructors); }
Source:
<code>Map<Token, Set<Host>> computeTokenToReplicaMap(String keyspaceName, Map<Token, Host> tokenToPrimary, List<Token> ring) { int rf = Math.min(replicationFactor, ring.size()); Map<Host, Set<Host>> hostSetMap = new HashMap<Host, Set<Host>>(); Map<Token, Set<Host>> replicaMap = new HashMap<Token, Set<Host>>(tokenToPrimary.size()); for (int i = 0; i < ring.size(); i++) { Host primaryHost = tokenToPrimary.get(getTokenWrapping(i, ring)); Set<Host> replicas = hostSetMap.get(primaryHost); if (replicas == null) { replicas = new LinkedHashSet<Host>(); replicas.add(primaryHost); for (int j = 1; j < ring.size() && replicas.size() < rf; j++) replicas.add(tokenToPrimary.get(getTokenWrapping(i + j, ring))); hostSetMap.put(primaryHost, replicas = ImmutableSet.copyOf(replicas)); } <START> replicaMap.put(ring.get(i), replicas); <END> } return replicaMap; }</code><technical_language>memoize replicas based primaryHost. determines contents of replicas is section of ring token i; multiple tokens assigned host, for start positions get primaryHost, encounter next ring same. tests fail</technical_language>

Target:
Map<Token, Set<Host>> computeTokenToReplicaMap(String keyspaceName, Map<Token, Host> tokenToPrimary, List<Token> ring) { int rf = Math.min(replicationFactor, ring.size()); Map<Token, Set<Host>> replicaMap = new HashMap<Token, Set<Host>>(tokenToPrimary.size()); for (int i = 0; i < ring.size(); i++) { Set<Host> replicas = new LinkedHashSet<Host>(); for (int j = 0; j < ring.size() && replicas.size() < rf; j++) replicas.add(tokenToPrimary.get(getTokenWrapping(i+j, ring))); replicaMap.put(ring.get(i), ImmutableSet.copyOf(replicas)); } return replicaMap; }
Source:
<code>private <START> boolean validateNoActiveImageTransfers(VDS <END> vds) { List<ImageTransfer> transfers = imageTransferDao.getByVdsId(vds.getId()); if (!transfers.isEmpty() && !transfers.stream().allMatch(ImageTransfer::isPaused)) { List<String> replacements = new ArrayList<>(2); replacements.add(ReplacementUtils.createSetVariableString("host", vds.getName())); replacements.addAll(ReplacementUtils.replaceWith("disks", transfers.stream().map(ImageTransfer::getDiskId).collect(Collectors.toList()))); return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_HOST_WITH_RUNNING_IMAGE_TRANSFERS, replacements); } return true; }</code><technical_language>return ValidationResult allow caller failValidation it, I guess in eye of beholder</technical_language>

Target:
private boolean validateNoActiveImageTransfers(VDS vds) { List<ImageTransfer> transfers = imageTransferDao.getByVdsId(vds.getId()); if (!transfers.stream().allMatch(ImageTransfer::isPaused)) { List<String> replacements = new ArrayList<>(3); replacements.add(ReplacementUtils.createSetVariableString("host", vds.getName())); replacements.addAll(ReplacementUtils.replaceWith("disks", transfers.stream() .filter(imageTransfer -> !imageTransfer.isPaused()) .map(ImageTransfer::getDiskId) .sorted() .collect(Collectors.toList()))); return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_HOST_WITH_RUNNING_IMAGE_TRANSFERS, replacements); } return true; }
Source:
<code>public Cluster getMappedCluster(String clusterName, Guid vmId, Map<String, String> clusterMap) { log.info("Mapping cluster '{}' for vm '{}'.", clusterName, vmId); return getRelatedEntity(clusterMap, clusterName, <START> val -> clusterDao.getByName((String) val)); <END> }</code><technical_language>Lets add target mapping</technical_language>

Target:
public Cluster getMappedCluster(String clusterName, Guid vmId, Map<String, String> clusterMap) { Cluster mappedCluster = getRelatedEntity(clusterMap, clusterName, val -> clusterDao.getByName((String) val)); log.info("Mapping cluster '{}' to '{}' for vm '{}'.", mappedCluster, clusterName, vmId); return mappedCluster; }
Source:
<code>public boolean permit(ReqContext context, String operation, Map topology_conf) { LOG.info("[req "+ context.requestID()+ "] Access " + " from: " + (context.remoteAddress() == null? "null" : context.remoteAddress().toString()) <START> + (context.principal() == null? "" : (" principal:"+ context.principal())) <END> +" op:"+operation + (topology_conf == null? "" : (" topoology:"+topology_conf.get(Config.TOPOLOGY_NAME)))); return true; }</code><technical_language>Instead of this a part of authorizer, want push a level a part of code calls Authorizer</technical_language>

Target:
public boolean permit(ReqContext context, String operation, Map topology_conf) { return true; }
Source:
<code>public boolean compare(IResource local, IResourceVariant remote) { if (!local.exists() || remote == null) { return false; } if (local instanceof IFile) { if (remote.isContainer()) { return false; } try { InputStream remoteStream = remote.getStorage( new NullProgressMonitor()).getContents(); InputStream stream = ((IFile) local).getContents(); byte[] remoteBytes = new byte[8096]; byte[] bytes = new byte[8096]; int remoteRead = remoteStream.read(remoteBytes); int read = stream.read(bytes); if (remoteRead != read) { return false; } while (Arrays.equals(bytes, remoteBytes)) { remoteRead = remoteStream.read(remoteBytes); read = stream.read(bytes); if (remoteRead != read) { return false; } else if (read == -1) { return Arrays.equals(bytes, remoteBytes); } } <START> } catch (IOException e) { <END> logException(e); return false; } catch (CoreException e) { logException(e); return false; } } else if (local instanceof IContainer) { if (!remote.isContainer()) { return false; } GitFolderResourceVariant gitVariant = (GitFolderResourceVariant) remote; return local.getFullPath().equals( gitVariant.getResource().getFullPath()); } return false; }</code><technical_language>I close stream, for normal case, for errors (finally)</technical_language>

Target:
public boolean compare(IResource local, IResourceVariant remote) { if (!local.exists() || remote == null) { return false; } if (local instanceof IFile) { if (remote.isContainer()) { return false; } InputStream stream = null; InputStream remoteStream = null; try { remoteStream = remote.getStorage( new NullProgressMonitor()).getContents(); stream = ((IFile) local).getContents(); byte[] remoteBytes = new byte[8096]; byte[] bytes = new byte[8096]; int remoteRead = remoteStream.read(remoteBytes); int read = stream.read(bytes); if (remoteRead != read) { return false; } while (Arrays.equals(bytes, remoteBytes)) { remoteRead = remoteStream.read(remoteBytes); read = stream.read(bytes); if (remoteRead != read) { return false; } else if (read == -1) { return Arrays.equals(bytes, remoteBytes); } } } catch (IOException e) { logException(e); return false; } catch (CoreException e) { logException(e); return false; } finally { closeStream(stream); closeStream(remoteStream); } } else if (local instanceof IContainer) { if (!remote.isContainer()) { return false; } GitFolderResourceVariant gitVariant = (GitFolderResourceVariant) remote; return local.getFullPath().equals( gitVariant.getResource().getFullPath()); } return false; }
Source:
<code>public static void validateBootConfig(BootConfig config) { if (config == null) { throw new BootConfigException("No boot config provided."); } if (config.configIsHybrid) { if (BootConfig.isAbsoluteUrl(config.getStartPage())) { throw new BootConfigException("Start page should not be absolute URL."); } if (config.isLocal() && config.getUnauthenticatedStartPage() != null) { SalesforceSDKLogger.w(TAG, UNAUTHENTICATED_START_PAGE + " set for local app, but it will never be used."); } if (!config.isLocal() && config.shouldAuthenticate() && config.getUnauthenticatedStartPage() != null) { SalesforceSDKLogger.w(TAG, UNAUTHENTICATED_START_PAGE + " set for remote app with authentication, but it will never be used."); } if (!config.isLocal() && !config.shouldAuthenticate() <START> && (config.getUnauthenticatedStartPage() == null || config.getUnauthenticatedStartPage().length() == 0)) { <END> throw new BootConfigException(UNAUTHENTICATED_START_PAGE + " required for remote app with deferred authentication."); } if (config.getUnauthenticatedStartPage() != null && config.getUnauthenticatedStartPage().length() > 0 && !BootConfig.isAbsoluteUrl(config.getUnauthenticatedStartPage())) { throw new BootConfigException(UNAUTHENTICATED_START_PAGE + " should be absolute URL."); } } }</code><technical_language>Minor: TextUtils.isEmpty(config.getUnauthenticatedStartPage()) instead if - checks for null empty string</technical_language>

Target:
public static void validateBootConfig(BootConfig config) { if (config == null) { throw new BootConfigException("No boot config provided."); } if (config.configIsHybrid) { if (BootConfig.isAbsoluteUrl(config.getStartPage())) { throw new BootConfigException("Start page should not be absolute URL."); } if (config.isLocal() && config.getUnauthenticatedStartPage() != null) { SalesforceSDKLogger.w(TAG, UNAUTHENTICATED_START_PAGE + " set for local app, but it will never be used."); } if (!config.isLocal() && config.shouldAuthenticate() && config.getUnauthenticatedStartPage() != null) { SalesforceSDKLogger.w(TAG, UNAUTHENTICATED_START_PAGE + " set for remote app with authentication, but it will never be used."); } if (!config.isLocal() && !config.shouldAuthenticate() && TextUtils.isEmpty(config.getUnauthenticatedStartPage())) { throw new BootConfigException(UNAUTHENTICATED_START_PAGE + " required for remote app with deferred authentication."); } if (!TextUtils.isEmpty(config.getUnauthenticatedStartPage()) && !BootConfig.isAbsoluteUrl(config.getUnauthenticatedStartPage())) { throw new BootConfigException(UNAUTHENTICATED_START_PAGE + " should be absolute URL."); } } }
Source:
<code>public Sendgrid parseMimeMessageToSendgrid(MimeMessage message) throws MessagingException, JSONException, IOException { Sendgrid email = new Sendgrid(Config.SENDGRID_USERNAME, Config.SENDGRID_PASSWORD); for (int i = 0; i < message.getRecipients(Message.RecipientType.TO).length; i++) { email.addTo(message.getRecipients(Message.RecipientType.TO)[i].toString()); } String from = message.getFrom()[0].toString(); String html = message.getContent().toString(); if (from.contains("<") && from.contains(">")) { from = from.substring(from.indexOf("<") + 1, from.indexOf(">")); <START> } <END> email.setFrom(from) .setSubject(message.getSubject()) .setHtml(html) .setText(Jsoup.parse(html).text()); if (message.getRecipients(Message.RecipientType.BCC) != null && message.getRecipients(Message.RecipientType.BCC).length > 0) { email.setBcc(message.getRecipients(Message.RecipientType.BCC)[0].toString()); } if (message.getReplyTo() != null && message.getReplyTo().length > 0) { email.setReplyTo(message.getReplyTo()[0].toString()); } return email; }</code><technical_language>This branch extracted a static method? I noticed code appearing in a test class below</technical_language>

Target:
public Sendgrid parseMimeMessageToSendgrid(MimeMessage message) throws MessagingException, JSONException, IOException { Sendgrid email = new Sendgrid(Config.SENDGRID_USERNAME, Config.SENDGRID_PASSWORD); for (int i = 0; i < message.getRecipients(Message.RecipientType.TO).length; i++) { email.addTo(message.getRecipients(Message.RecipientType.TO)[i].toString()); } String from = extractSenderEmail(message.getFrom()[0].toString()); String html = message.getContent().toString(); email.setFrom(from) .setSubject(message.getSubject()) .setHtml(html) .setText(Jsoup.parse(html).text()); if (message.getRecipients(Message.RecipientType.BCC) != null && message.getRecipients(Message.RecipientType.BCC).length > 0) { email.setBcc(message.getRecipients(Message.RecipientType.BCC)[0].toString()); } if (message.getReplyTo() != null && message.getReplyTo().length > 0) { email.setReplyTo(message.getReplyTo()[0].toString()); } return email; }
Source:
<code><START> private void close() { <END> if (timeoutBeforeNextMessageOperation != null && !timeoutBeforeNextMessageOperation.isDisposed()) { timeoutBeforeNextMessageOperation.dispose(); } }</code><technical_language>implement Closeable this private close</technical_language>

Target:
public void close() { if (!nextMessageSubscriber.isDisposed()) { nextMessageSubscriber.dispose(); } }
Source:
<code>TxnContext touch(@Nonnull Table<K, V, M> table, @Nonnull final K key) { if (!table.getNamespace().equals(namespace)) { throw new IllegalArgumentException("TxnContext can't apply table from namespace " + table.getNamespace() + " to transaction on namespace " + namespace); } tablesInTxn.add(table); operations.add(() -> { CorfuRecord<V, M> touchedObject = table.get(key); if (touchedObject != null) { <START> table.put(key, touchedObject.getPayload(), touchedObject.getMetadata()); <END> } else { txAbort(); log.error("TX Abort touch on non-existing object: in "+ table.getFullyQualifiedTableName()); throw new UnsupportedOperationException( "Attempt to touch() a non-existing object in " + table.getFullyQualifiedTableName()); } table.getMetrics().numTouches.incrementAndGet(); }); return this; }</code><technical_language>is usecase for it</technical_language>

Target:
TxnContext touch(@Nonnull Table<K, V, M> table, @Nonnull final K key) { validateTableWrittenIsInNamespace(table); operations.add(() -> { CorfuRecord<V, M> touchedObject = table.get(key); if (touchedObject != null) { table.put(key, touchedObject.getPayload(), touchedObject.getMetadata()); } else { txAbort(); log.error("TX Abort touch on non-existing object: in "+ table.getFullyQualifiedTableName()); throw new UnsupportedOperationException( "Attempt to touch() a non-existing object in " + table.getFullyQualifiedTableName()); } table.getMetrics().incNumTouches(); }); return this; }
Source:
<code><START> public SelectionKey keyForId(String id) { <END> SelectionKey key = this.keys.get(id); if (key == null) { throw new IllegalStateException( "Attempt to write to socket for which there is no open connection. Connection id " + id + " existing connections " + keys.keySet().toString()); } return key; }</code><technical_language>This public</technical_language>

Target:
private SelectionKey keyForId(String id) { SelectionKey key = this.keyMap.get(id); if (key == null) { throw new IllegalStateException( "Attempt to write to socket for which there is no open connection. Connection id " + id + " existing connections " + keyMap.keySet().toString()); } return key; }
Source:
<code><START> public final String getChr() { <END> return getContig(); }</code><technical_language>this method final</technical_language>

Target:
public String getChr() { return getContig(); }
Source:
<code><START> private void addSObjectField(XmlObject xmlObject, Schema fieldSchema, String fieldName, Object value) { <END> fieldSchema = AvroUtils.unwrapIfNullable(fieldSchema); String javaClassFlag = fieldSchema.getProp(SchemaConstants.JAVA_CLASS_FLAG); if (LogicalTypes.timestampMillis() == fieldSchema.getLogicalType() || "java.util.Date".equals(javaClassFlag)) { xmlObject.setField(fieldName, SalesforceRuntime.convertDateToCalendar(new Date((Long) value))); } else { if (fieldSchema.getType() == Schema.Type.BYTES) { if ((value instanceof String) || (value instanceof byte[])) { byte[] base64Data = null; if (value instanceof byte[]) { base64Data = (byte[]) value; } else { base64Data = ((String) value).getBytes(); } if (Base64.isBase64(new String(base64Data))) { value = Base64.decode(base64Data); } } } else if ("java.math.BigDecimal".equals(javaClassFlag)) { value = new BigDecimal((String) value); } Schema.Field se = moduleSchema.getField(fieldName); if (se != null && value instanceof String) { xmlObject.setField(fieldName, SalesforceAvroRegistry.get().getConverterFromString(se).convertToAvro((String) value)); } else { xmlObject.setField(fieldName, value); } } }</code><technical_language>This method requires refactoring</technical_language>

Target:
private void addSObjectField(XmlObject xmlObject, Schema fieldSchema, String fieldName, Object value) { Schema basicSchema = AvroUtils.unwrapIfNullable(fieldSchema); if (LogicalTypeUtils.isLogicalTimestampMillis(basicSchema) || AvroUtils.isSameType(basicSchema, AvroUtils._date())) { xmlObject.setField(fieldName, SalesforceRuntime.convertDateToCalendar(new Date((Long) value))); } else { if (basicSchema.getType() == Schema.Type.BYTES) { byte[] base64Data = null; if (value instanceof String) { base64Data = ((String) value).getBytes(); } if (value instanceof byte[]) { base64Data = (byte[]) value; } if (Base64.isBase64(new String(base64Data))) { value = Base64.decode(base64Data); } } else if (AvroUtils.isSameType(basicSchema, AvroUtils._decimal())) { value = new BigDecimal((String) value); } Schema.Field se = moduleSchema.getField(fieldName); if (se != null && value instanceof String) { xmlObject.setField(fieldName, SalesforceAvroRegistry.get().getConverterFromString(se).convertToAvro((String) value)); } else { xmlObject.setField(fieldName, value); } } }
Source:
<code>public static void toFile(Node node, File file, int indent, Map<String, String> namespaces) throws IOException { OutputStream out = null; <START> try { <END> Transformer transformer = TransformerFactory.newInstance().newTransformer(); if (indent > -1) { transformer.setOutputProperty(OutputKeys.INDENT, TRANSFORMER_INDENT_TRUE); transformer.setOutputProperty(TRANSFORMER_INDENT_VALUE, Integer.toString(indent)); } out = new FileOutputStream(file); transformer.transform(new DOMSource(toDocument(node, namespaces)), new StreamResult(out)); out.flush(); } catch (TransformerException e) { String message = e.getMessage(); throw new RuntimeException(message != null ? message : e.getClass().getSimpleName(), e); } finally { if (out != null) { out.close(); } } }</code><technical_language>Please a try-with-resources statement instead of closing streams yourself</technical_language>

Target:
public static void toFile(Node node, File file, int indent, Map<String, String> namespaces) throws IOException { try (OutputStream out = new FileOutputStream(file)) { toStream(node, out, indent, namespaces, Optional.empty()); out.flush(); } }
Source:
<code>public AmazonBucketIngester(ImportServiceFactory importServiceFactory, FileRepositoryCollectionFactory fileRepositoryCollectionFactory, FileMetaFactory fileMetaFactory, FileStore fileStore, AmazonBucketClient amazonBucketClient) { this.importServiceFactory = requireNonNull(importServiceFactory); this.fileRepositoryCollectionFactory = requireNonNull(fileRepositoryCollectionFactory); this.fileMetaFactory = requireNonNull(fileMetaFactory); <START> this.fileStore = fileStore; <END> this.amazonBucketClient = amazonBucketClient; }</code><technical_language>requireNonNull</technical_language>

Target:
public AmazonBucketIngester(ImportServiceFactory importServiceFactory, FileRepositoryCollectionFactory fileRepositoryCollectionFactory, FileMetaFactory fileMetaFactory, FileStore fileStore, AmazonBucketClient amazonBucketClient) { this.importServiceFactory = requireNonNull(importServiceFactory); this.fileRepositoryCollectionFactory = requireNonNull(fileRepositoryCollectionFactory); this.fileMetaFactory = requireNonNull(fileMetaFactory); this.fileStore = requireNonNull(fileStore); this.amazonBucketClient = requireNonNull(amazonBucketClient); }
Source:
<code>private SimRobot(){ super(); nodeList.add(new HighTrustGPSLocalizer()); nodeList.add(new SimulatedImuNode(100)); nodeList.add(new SimulatedGPSNode(500)); nodeList.add(new SimulatedRBSMNode()); try { ArrayList<GpsMeasurement> wayPoints = WayPointUtil.createWayPointsFromWaypointList(RobobuggyConfigFile.getWaypointSourceLogFile()); nodeList.add(new WayPointFollowerPlanner(wayPoints)); } catch (FileNotFoundException e) { e.printStackTrace(); } SimulatedBuggy simBuggy = SimulatedBuggy.getInstance(); simBuggy.setY(LocalizerUtil.convertLatToMeters(40.441705)); simBuggy.setX(LocalizerUtil.convertLonToMeters(-79.941585)); simBuggy.setTh(-110); <START> try { <END> Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } simBuggy.setDx(10); nodeList.add(new LoggingNode(NodeChannel.GUI_LOGGING_BUTTON, RobobuggyConfigFile.LOG_FILE_LOCATION, NodeChannel.getLoggingChannels())); RobobuggyJFrame mainWindow = new RobobuggyJFrame("MainWindow",1.0,1.0); Gui.getInstance().addWindow(mainWindow); RobobuggyGUITabs tabs = new RobobuggyGUITabs(); mainWindow.addComponent(tabs, 0.0, 0.0, 1.0, 1.0); tabs.addTab(new MainGuiWindow(), "Home"); tabs.addTab(new AutonomousPanel(),"Autonomous"); tabs.addTab(new SimulationPanel(),"Simulation"); tabs.addTab(new PathPanel(),"Path Panel"); tabs.addTab(new ConfigurationPanel(), "Configuration"); }</code><technical_language>waiting a for</technical_language>

Target:
private SimRobot(){ super(); nodeList.add(new HighTrustGPSLocalizer()); nodeList.add(new SimulatedImuNode(100)); nodeList.add(new SimulatedGPSNode(500)); nodeList.add(new SimulatedRBSMNode()); try { ArrayList<GpsMeasurement> wayPoints = WayPointUtil.createWayPointsFromWaypointList(RobobuggyConfigFile.getWaypointSourceLogFile()); nodeList.add(new WayPointFollowerPlanner(wayPoints)); } catch (FileNotFoundException e) { e.printStackTrace(); } SimulatedBuggy simBuggy = SimulatedBuggy.getInstance(); simBuggy.setY(LocalizerUtil.convertLatToMeters(40.441705)); simBuggy.setX(LocalizerUtil.convertLonToMeters(-79.941585)); simBuggy.setTh(-110); simBuggy.setDx(10); nodeList.add(new LoggingNode(NodeChannel.GUI_LOGGING_BUTTON, RobobuggyConfigFile.LOG_FILE_LOCATION, NodeChannel.getLoggingChannels())); RobobuggyJFrame mainWindow = new RobobuggyJFrame("MainWindow",1.0,1.0); Gui.getInstance().addWindow(mainWindow); RobobuggyGUITabs tabs = new RobobuggyGUITabs(); mainWindow.addComponent(tabs, 0.0, 0.0, 1.0, 1.0); tabs.addTab(new MainGuiWindow(), "Home"); tabs.addTab(new AutonomousPanel(),"Autonomous"); tabs.addTab(new SimulationPanel(),"Simulation"); tabs.addTab(new PathPanel(),"Path Panel"); tabs.addTab(new ConfigurationPanel(), "Configuration"); }
Source:
<code>public void initializeProcessList() { Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String originLink = params.get("linkId"); if (Objects.equals(originLink, "newProcess")) { NeuenVorgangAnlegen(); } else if (Objects.equals(originLink, "templates")) { FilterVorlagen(); } else if (Objects.equals(originLink, "allProcesses")) { FilterAktuelleProzesse(); } else { <START> System.err.println("ERROR: did not recognize link ID '"+originLink+"'."); <END> } setFilter(""); }</code><technical_language>Do System.err.println - a log statement for</technical_language>

Target:
public void initializeProcessList() { Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String originLink = params.get("linkId"); if (Objects.equals(originLink, "newProcess")) { NeuenVorgangAnlegen(); } else if (Objects.equals(originLink, "templates")) { FilterVorlagen(); } else if (Objects.equals(originLink, "allProcesses")) { FilterAktuelleProzesse(); } else { logger.error("ERROR: did not recognize link ID '" + originLink + "'."); } setFilter(""); }
Source:
<code>public static <START> Change.Source<? extends Change.Batch> buildKafkaPoller( <END> String kafkaServers, Collection<String> clusterNames, Uris uris, int batchSize, Date startTime) { Map<String, Class<? extends ChangeEvent>> topicsToClass = clusterNamesAwareTopics(clusterNames); ImmutableSet<String> topics = ImmutableSet.copyOf(topicsToClass.keySet()); return new KafkaPoller(buildKafkaConsumer(kafkaServers, topicsToClass, batchSize), uris, startTime, batchSize, topics); }</code><technical_language>buildKafkaPoller() return type KafkaPoller Change.Source<? extends Change.Batch> (minor simplification)</technical_language>

Target:
public static KafkaPoller buildKafkaPoller( String kafkaServers, Collection<String> clusterNames, Uris uris, int batchSize, Date startTime) { Map<String, Class<? extends ChangeEvent>> topicsToClass = clusterNamesAwareTopics(clusterNames); ImmutableSet<String> topics = ImmutableSet.copyOf(topicsToClass.keySet()); return new KafkaPoller(buildKafkaConsumer(kafkaServers, topicsToClass, batchSize), uris, startTime, batchSize, topics); }
Source:
<code>public Double getValue(ResultSet rs, long fid) throws ParameterException { try { if(rs.getRow() != fid) { rs.absolute((int)fid); } Object value = this.getFieldValue(rs, fid); if (value instanceof Double) { return (Double)value; } else { return null; } } catch (SQLException e) { <START> throw new ParameterException(I18N.tr("Could not fetch feature attribute \"") + getColumnName() + "\"", e); <END> } }</code><technical_language>java throw new ParameterException(I18N.tr("Could fetch feature attribute \"{0}\"", getColumnName()), e);</technical_language>

Target:
public Double getValue(ResultSet rs, long fid) throws ParameterException { try { if(rs.getRow() != fid) { rs.absolute((int)fid); } Object value = this.getFieldValue(rs, fid); if (value instanceof Double) { return (Double)value; } else { return null; } } catch (SQLException e) { throw new ParameterException(I18N.tr("Could not fetch feature attribute \"{0}\"", getColumnName()), e); } }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } HandleInstanceError that = (HandleInstanceError) o; <START> return _errorMessage.equals(that._errorMessage); <END> }</code><technical_language>Objects.equals()? clear if _errorMessage null</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } HandleInstanceError that = (HandleInstanceError) o; return Objects.equals(_errorMessage, that._errorMessage); }
Source:
<code><START> public void setQuery(String query) { <END> this.query = query; }</code><technical_language>move this setter top of methods. getXXXxxxToken beginTree</technical_language>

Target:
public void setQuery(String query) { this.query = query; if (!query.isEmpty()) { try { final XPathEvaluator xpathEvaluator = new XPathEvaluator(Configuration.newConfiguration()); xpathExpression = xpathEvaluator.createExpression(query); } catch (XPathException ex) { throw new IllegalStateException("Creating Xpath expression failed: " + query, ex); } } }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (dropDuplicates ? 1231 : 1237); result = prime * result + ObjectUtils.nullSafeHashCode(indexFields); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + (sparse ? 1231 : 1237); result = prime * result + (unique ? 1231 : 1237); <START> result = prime * result + ((language == null) ? 0 : language.hashCode()); <END> return result; }</code><technical_language>ObjectUtils.nullSafeHashCode(..) above</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (dropDuplicates ? 1231 : 1237); result = prime * result + ObjectUtils.nullSafeHashCode(indexFields); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + (sparse ? 1231 : 1237); result = prime * result + (unique ? 1231 : 1237); result = prime * result + ObjectUtils.nullSafeHashCode(language); return result; }
Source:
<code>protected void onContextMenu(ContextMenuEvent event) { final int eventX = event.getNativeEvent().getClientX(); final int eventY = event.getNativeEvent().getClientY(); event.preventDefault(); event.stopPropagation(); Scheduler.get().scheduleDeferred(() -> { if (hasActionButtons()) { updateContextMenu(menu, actionButtonList); menuContainer.addStyleName(OPEN); clickButton.getElement().setAttribute(ARIA_EXPANDED, Boolean.TRUE.toString()); menuContainer.getElement().getStyle().setPosition(Position.ABSOLUTE); menuContainer.getElement().getStyle().setTop(Window.getScrollTop() + eventY, Unit.PX); <START> menuContainer.getElement().getStyle().setLeft(eventX, Unit.PX); <END> } }); }</code><technical_language>extract menuContainer.xxx methods some styleMenuContainer method? Also, do need styling applied context menu show? (If not, do one-time initWidget method.)</technical_language>

Target:
protected void onContextMenu(ContextMenuEvent event) { final int eventX = event.getNativeEvent().getClientX(); final int eventY = event.getNativeEvent().getClientY(); event.preventDefault(); event.stopPropagation(); Scheduler.get().scheduleDeferred(() -> { if (hasActionButtons()) { updateContextMenu(menu, actionButtonList); styleAndPositionMenuContainer(eventX, eventY); } }); }
Source:
<code>protected void executeRuntimeStep(OperationContext context, ModelNode operation) { <START> String name = this.nameExtractor.apply(operation); <END> Operation<C> executable = this.executables.get(name); try { ModelNode result = this.executor.execute(context, operation, executable); if (result != null) { context.getResult().set(result); } } catch (OperationFailedException e) { context.getFailureDescription().set(e.getLocalizedMessage()); } context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); }</code><technical_language>Replace with: String name = Operations.getName(operation);</technical_language>

Target:
protected void executeRuntimeStep(OperationContext context, ModelNode operation) { String name = Operations.getName(operation); Operation<C> executable = this.executables.get(name); try { ModelNode result = this.executor.execute(context, operation, executable); if (result != null) { context.getResult().set(result); } } catch (OperationFailedException e) { context.getFailureDescription().set(e.getLocalizedMessage()); } context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); }
Source:
<code>private static String getMessage(String[] strings) { if (strings.length < 1) return "info: Hello World!"; <START> return Stream.of(strings).collect(Collectors.joining(" ")); <END> }</code><technical_language>I Streams too, String#join more appropriate, it? (and Java 8 too!)</technical_language>

Target:
private static String getMessage(String[] strings) { if (strings.length < 1) return "info: Hello World!"; return String.join(" ", strings); }
Source:
<code>public void expunge(Integer noOfChargesToExpungeQueryParam) { if (expungeConfig.isExpungeChargesEnabled()) { int noOfChargesToExpunge = getNumberOfChargesToExpunge(noOfChargesToExpungeQueryParam); int noOfChargesProcessed = 0; while (noOfChargesProcessed < noOfChargesToExpunge) { Optional<ChargeEntity> mayBeChargeEntity = chargeDao.findChargeToExpunge(expungeConfig.getMinimumAgeOfChargeInDays(), expungeConfig.getExcludeChargesParityCheckedWithInDays() ); mayBeChargeEntity.ifPresent(chargeEntity -> { if (hasFinalisedState(chargeEntity) && parityCheckService.parityCheckChargeForExpunger(chargeEntity)) { chargeDao.expungeCharge(chargeEntity.getId()); logger.info("Charge expunged from connector {}", kv(PAYMENT_EXTERNAL_ID, chargeEntity.getExternalId())); } else { <START> chargeDao.updateChargeParityCheckDate(chargeEntity.getId(), ZonedDateTime.now(UTC)); <END> logger.info("Charge does not meet expunging criteria from connector {}", kv(PAYMENT_EXTERNAL_ID, chargeEntity.getExternalId())); } }); if (mayBeChargeEntity.isEmpty()) { break; } noOfChargesProcessed++; } } else { logger.info("Charge expunging feature is disabled. No charges have been expunged"); } }</code><technical_language>paritycheck fails charge is updated date parity check status events emitted ledger <LINK_0> ParityCheckService updated logic extracted update charge & emit events need find a distinguish logs charge for expunging expunge retry. This for alerting fix ParityChecker / Ledger manually investigate charges</technical_language>

Target:
public void expunge(Integer noOfChargesToExpungeQueryParam) { if (!expungeConfig.isExpungeChargesEnabled()) { logger.info("Charge expunging feature is disabled. No charges have been expunged"); } else { int noOfChargesToExpunge = getNumberOfChargesToExpunge(noOfChargesToExpungeQueryParam); int minimumAgeOfChargeInDays = expungeConfig.getMinimumAgeOfChargeInDays(); int createdWithinLast = expungeConfig.getExcludeChargesParityCheckedWithInDays(); IntStream.range(0, noOfChargesToExpunge).forEach(number -> { chargeDao.findChargeToExpunge(minimumAgeOfChargeInDays, createdWithinLast) .ifPresent(this::parityCheckAndExpungeIfMet); }); } }
Source:
<code>public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { getPreferenceManager().setSharedPreferencesName(ADMIN_PREFERENCES); setPreferencesFromResource(R.xml.main_menu_access_preferences, rootKey); <START> ((CollectAbstractActivity) getActivity()).initToolbar(getPreferenceScreen().getTitle()); <END> findPreference(KEY_EDIT_SAVED).setEnabled((Boolean) AdminSharedPreferences.getInstance().get(ALLOW_OTHER_WAYS_OF_EDITING_FORM)); }</code><technical_language>Conditional cast for child Fragments well</technical_language>

Target:
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { getPreferenceManager().setSharedPreferencesName(ADMIN_PREFERENCES); setPreferencesFromResource(R.xml.main_menu_access_preferences, rootKey); findPreference(KEY_EDIT_SAVED).setEnabled((Boolean) AdminSharedPreferences.getInstance().get(ALLOW_OTHER_WAYS_OF_EDITING_FORM)); }
Source:
<code>public List<URI> getDependencies(URI uri) { Set<URI> dependencies = new LinkedHashSet<URI>(); <START> dependencies.add(uri); <END> for (IConfigurationElement element : modelExtensions) { if (ModelsReader.MODEL_ELEMENT_NAME.equals(element.getName())) { String extension = element.getAttribute(EXTENSION_ATTRIBUTE); if (extension != null && !"".equals(extension.trim())) { URI dependencyURI = uri.trimFileExtension().appendFileExtension(extension); if (URIConverter.INSTANCE.exists(dependencyURI, null)) { dependencies.add(dependencyURI); } } } } return new ArrayList<URI>(dependencies); }</code><technical_language>Is necessary uri is a dependency of uri? if this easily forget if necessary add uri itself. Is a reason do (e.g., want allow extensions exclude uri)? easier include uri in extension point reader class default</technical_language>

Target:
public List<URI> getDependencies(URI uri) { Set<URI> dependencies = new LinkedHashSet<URI>(); for (String fileExtension : fileExtensions) { URI dependencyURI = uri.trimFileExtension().appendFileExtension(fileExtension); if (URIConverter.INSTANCE.exists(dependencyURI, null)) { dependencies.add(dependencyURI); } } return new ArrayList<URI>(dependencies); }
Source:
<code>public void setUp() throws Exception { locator = cluster.startLocatorVM(0); locatorPort = locator.getPort(); <START> client = cluster.startClientVM(4, <END> c -> c.withPoolSubscription(true).withLocatorConnection((locatorPort))); }</code><technical_language>index 4 is out of bound. VM index ranges 0 3, new ClusterStartupRule(4) in line 97</technical_language>

Target:
public void setUp() throws Exception { locator = cluster.startLocatorVM(0); locatorPort = locator.getPort(); }
Source:
<code>private List<AccountInfo> suggestAccount(VisibilityControl visibilityControl) throws OrmException { String a = query; String b = a + MAX_SUFFIX; Map<Account.Id, AccountInfo> r = new LinkedHashMap<>(); Map<Account.Id, String> queryEmail = new HashMap<>(); for (Account p : dbProvider.get().accounts() .suggestByFullName(a, b, limit)) { if (p.isActive()) { addSuggestion(r, p.getId(), visibilityControl); } } if (r.size() < limit) { for (Account p : dbProvider.get().accounts() .suggestByPreferredEmail(a, b, limit - r.size())) { if (p.isActive()) { addSuggestion(r, p.getId(), visibilityControl); } } } if (r.size() < limit) { for (AccountExternalId e : dbProvider.get().accountExternalIds() .suggestByEmailAddress(a, b, limit - r.size())) { if (!r.containsKey(e.getAccountId())) { Account p = accountCache.get(e.getAccountId()).getAccount(); if (p.isActive()) { queryEmail.put(e.getAccountId(), e.getEmailAddress()); addSuggestion(r, p.getId(), visibilityControl); } } } } accountLoader.fill(); for (Map.Entry<Account.Id, String> p : queryEmail.entrySet()) { <START> r.get(p.getKey()).email <END> = p.getValue(); } return Lists.newArrayList(r.values()); }</code><technical_language>This null. E.g. if a mail address matched account added result account is visible calling user. Due this SuggestReviewersIT.suggestReviewersSameGroupVisibility SuggestReviewersIt.suggestReviewersViewAllAccounts failing</technical_language>

Target:
private List<AccountInfo> suggestAccount(VisibilityControl visibilityControl) throws OrmException { String a = query; String b = a + MAX_SUFFIX; Map<Account.Id, AccountInfo> r = new LinkedHashMap<>(); Map<Account.Id, String> queryEmail = new HashMap<>(); for (Account p : dbProvider.get().accounts() .suggestByFullName(a, b, limit)) { if (p.isActive()) { addSuggestion(r, p.getId(), visibilityControl); } } if (r.size() < limit) { for (Account p : dbProvider.get().accounts() .suggestByPreferredEmail(a, b, limit - r.size())) { if (p.isActive()) { addSuggestion(r, p.getId(), visibilityControl); } } } if (r.size() < limit) { for (AccountExternalId e : dbProvider.get().accountExternalIds() .suggestByEmailAddress(a, b, limit - r.size())) { if (!r.containsKey(e.getAccountId())) { Account p = accountCache.get(e.getAccountId()).getAccount(); if (p.isActive()) { if (addSuggestion(r, p.getId(), visibilityControl)) { queryEmail.put(e.getAccountId(), e.getEmailAddress()); } } } } } accountLoader.fill(); for (Map.Entry<Account.Id, String> p : queryEmail.entrySet()) { AccountInfo info = r.get(p.getKey()); if (info != null) { info.email = p.getValue(); } } return new ArrayList<>(r.values()); }
Source:
<code>public void beginTrainingWithOptions() { String trainingSetSource = "{training-set-SAS-URL}"; TrainModelOptions trainModelOptions = new TrainModelOptions().setIncludeSubFolders(false).setPrefix( "Invoice"); formTrainingAsyncClient.beginTraining(trainingSetSource, true, trainModelOptions, Duration.ofSeconds(5) <START> ).subscribe(recognizePollingOperation -> { <END> recognizePollingOperation.getFinalResult().subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEach(customFormSubModel -> customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form Type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); }); }); END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean-trainModelOptions-Duration }</code><technical_language>this odd, closed in line .subscribe( this line</technical_language>

Target:
public void beginTrainingWithOptions() { String trainingFilesUrl = "{training-set-SAS-URL}"; TrainModelOptions trainModelOptions = new TrainModelOptions().setIncludeSubFolders(false).setPrefix("Invoice"); formTrainingAsyncClient.beginTraining(trainingFilesUrl, true, trainModelOptions, Duration.ofSeconds(5)).subscribe(recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubModels().forEach(customFormSubModel -> customFormSubModel.getFieldMap().forEach((key, customFormModelField) -> System.out.printf("Form Type: %s Field Text: %s Field Accuracy: %s%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); }); }); END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean-trainModelOptions-Duration }
Source:
<code>public void deleteByCutOffDate_shouldDeleteOlderTokens() { <START> long days_till_expiry = -7; <END> long days_longer_than_expiry = -8; ZonedDateTime cut_off_date = ZonedDateTime.now(ZoneId.of("UTC")).plusDays(days_till_expiry); ZonedDateTime today = ZonedDateTime.now(ZoneId.of("UTC")); ZonedDateTime eight_days_old = ZonedDateTime.now(ZoneId.of("UTC")).plusDays(days_longer_than_expiry); String present_day_tokenId = "token1"; String eight_days_old_tokenId = "token2"; ChargeEntity ChargeTestEntity = new ChargeEntity(); ChargeTestEntity.setId(defaultTestCharge.getChargeId()); TokenEntity present_day_token = TokenEntity.generateNewTokenFor(ChargeTestEntity); present_day_token.setCreatedDate(today); present_day_token.setToken(present_day_tokenId); tokenDao.persist(present_day_token); TokenEntity eight_day_old_token = TokenEntity.generateNewTokenFor(ChargeTestEntity); eight_day_old_token.setCreatedDate(eight_days_old); eight_day_old_token.setToken(eight_days_old_tokenId); tokenDao.persist(eight_day_old_token); tokenDao.deleteTokensOlderThanSpecifiedDate(cut_off_date); assertThat(tokenDao.findByTokenId(eight_days_old_tokenId), is(Optional.empty())); TokenEntity present_token = tokenDao.findByTokenId(present_day_tokenId).get(); assertThat(present_token.getId(), is(notNullValue())); assertThat(present_token.getToken(), is(present_day_tokenId)); assertThat(present_token.getCreatedDate(), is(today)); }</code><technical_language>above, camel case negative numbers</technical_language>

Target:
public void deleteByCutOffDate_shouldDeleteOlderTokens() { long daysTillExpiry = 7; long daysLongerThanExpiry = 8; ZonedDateTime cutOffDate = ZonedDateTime.now(ZoneId.of("UTC")).minusDays(daysTillExpiry); ZonedDateTime today = ZonedDateTime.now(ZoneId.of("UTC")); ZonedDateTime eightDaysOld = ZonedDateTime.now(ZoneId.of("UTC")).minusDays(daysLongerThanExpiry); String presentDayTokenId = "token1"; String eightDaysOldTokenId = "token2"; ChargeEntity ChargeTestEntity = new ChargeEntity(); ChargeTestEntity.setId(defaultTestCharge.getChargeId()); TokenEntity presentDayToken = TokenEntity.generateNewTokenFor(ChargeTestEntity); presentDayToken.setCreatedDate(today); presentDayToken.setToken(presentDayTokenId); tokenDao.persist(presentDayToken); TokenEntity eightDayOldToken = TokenEntity.generateNewTokenFor(ChargeTestEntity); eightDayOldToken.setCreatedDate(eightDaysOld); eightDayOldToken.setToken(eightDaysOldTokenId); tokenDao.persist(eightDayOldToken); tokenDao.deleteTokensOlderThanSpecifiedDate(cutOffDate); assertThat(tokenDao.findByTokenId(eightDaysOldTokenId), is(Optional.empty())); TokenEntity presentToken = tokenDao.findByTokenId(presentDayTokenId).get(); assertThat(presentToken.getId(), is(notNullValue())); assertThat(presentToken.getToken(), is(presentDayTokenId)); assertThat(presentToken.getCreatedDate(), is(today)); }