auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Override public BinaryClassificationMetricValues scoreAll(Iterator<LabelPair<Double>> iter) { long tp = 0; long tn = 0; long fp = 0; long fn = 0; double rocauc = Double.NaN; long pos = 0; long neg = 0; PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(new Comparator<Pair<Double, Double>>() { @Override public int compare(Pair<Double, Double> o1, Pair<Double, Double> o2) { <START> if (o1.getKey() < o2.getKey()) <END> return -1; if (o1.getKey() > o2.getKey()) return 1; return 0; } }); while (iter.hasNext()) { LabelPair<Double> e = iter.next(); double prediction = e.getPrediction(); double truth = e.getTruth(); if (prediction != negativeClsLb && prediction != positiveClsLb) throw new UnknownClassLabelException(prediction, positiveClsLb, negativeClsLb); if (truth != negativeClsLb && truth != positiveClsLb) throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); if (truth == positiveClsLb && prediction == positiveClsLb) tp++; else if (truth == positiveClsLb && prediction == negativeClsLb) fn++; else if (truth == negativeClsLb && prediction == negativeClsLb) tn++; else if (truth == negativeClsLb && prediction == positiveClsLb) fp++; if(enableROCAUC) { queue.add(new Pair<>(prediction, truth)); if (truth == positiveClsLb) pos++; else if (truth == negativeClsLb) neg++; else throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); } } if (enableROCAUC) rocauc = ROCAUC.calculateROCAUC(queue, pos, neg, positiveClsLb); return new BinaryClassificationMetricValues(tp, tn, fp, fn, rocauc); }</code><technical_language>lambda? Double.compare(o1.getKey(), o2.getKey())</technical_language>

Target:
@Override public BinaryClassificationMetricValues scoreAll(Iterator<LabelPair<Double>> iter) { long tp = 0; long tn = 0; long fp = 0; long fn = 0; double rocauc = Double.NaN; long pos = 0; long neg = 0; PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(Comparator.comparingDouble(Pair::getKey)); while (iter.hasNext()) { LabelPair<Double> e = iter.next(); double prediction = e.getPrediction(); double truth = e.getTruth(); if (prediction != negativeClsLb && prediction != positiveClsLb) throw new UnknownClassLabelException(prediction, positiveClsLb, negativeClsLb); if (truth != negativeClsLb && truth != positiveClsLb) throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); if (truth == positiveClsLb && prediction == positiveClsLb) tp++; else if (truth == positiveClsLb && prediction == negativeClsLb) fn++; else if (truth == negativeClsLb && prediction == negativeClsLb) tn++; else if (truth == negativeClsLb && prediction == positiveClsLb) fp++; if(enableROCAUC) { queue.add(new Pair<>(prediction, truth)); if (truth == positiveClsLb) pos++; else if (truth == negativeClsLb) neg++; else throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); } } if (enableROCAUC) rocauc = ROCAUC.calculateROCAUC(queue, pos, neg, positiveClsLb); return new BinaryClassificationMetricValues(tp, tn, fp, fn, rocauc); }
Source:
<code>public void checkout() throws IOException { if (headCommitTree != null) preScanTwoTrees(); else prescanOneTree(); if (!conflicts.isEmpty()) { if (failOnConflict) { dc.unlock(); throw new IOException(JGitText.get().cannotDeleteFile); } else cleanUpConflicts(); } builder.finish(); File file=null; String last = ""; for (String r : removed) { file = new File(repo.getWorkDir(), r); file.delete(); if (!isSamePrefix(r, last)) removeEmptyParents(file); last = r; } if (file!=null) removeEmptyParents(file); for (String path : updated.keySet()) { file = new File(repo.getWorkDir(), path); file.getParentFile().mkdirs(); file.createNewFile(); DirCacheEntry entry = dc.getEntry(path); checkoutEntry(file, entry, config_filemode()); <START> entry.setLastModified(file.lastModified()); <END> entry.setLength((int) file.length()); } if (!builder.commit()) { dc.unlock(); throw new IOException(JGitText.get().cannotDeleteFile); } }</code><technical_language>this set checkoutEntry? length, I suggest set in checkout Entry</technical_language>

Target:
public boolean checkout() throws IOException { toBeDeleted.clear(); if (headCommitTree != null) preScanTwoTrees(); else prescanOneTree(); if (!conflicts.isEmpty()) { if (failOnConflict) { dc.unlock(); throw new CheckoutConflictException(conflicts.toArray(new String[conflicts.size()])); } else cleanUpConflicts(); } builder.finish(); File file=null; String last = ""; for (String r : removed) { file = new File(repo.getWorkDir(), r); if (!file.delete()) toBeDeleted.add(r); else { if (!isSamePrefix(r, last)) removeEmptyParents(file); last = r; } } if (file != null) removeEmptyParents(file); for (String path : updated.keySet()) { file = new File(repo.getWorkDir(), path); file.getParentFile().mkdirs(); file.createNewFile(); DirCacheEntry entry = dc.getEntry(path); checkoutEntry(file, entry, config_filemode()); } if (!builder.commit()) { dc.unlock(); throw new IndexWriteException(); } return toBeDeleted == null; }
Source:
<code>public static OutputStyle forString(String outputStyle) { if(outputStyle == null) { return TABULAR; } <START> switch(outputStyle) { <END> case HTTP_PARAM_TABULAR: return TABULAR; case HTTP_PARAM_DOCUMENT: case HTTP_PARAM_MAP: return MAP; default: throw new IllegalArgumentException("Unknown outputStyle '" + outputStyle + "'"); } }</code><technical_language>do a .trim().toLowerCase() string more fail-safe</technical_language>

Target:
public static OutputStyle forString(String outputStyle) { if (outputStyle == null) { return TABULAR; } outputStyle = outputStyle.trim().toLowerCase(); switch (outputStyle) { case "": case PARAMETER_VALUE_OUTPUT_STYLE_TABULAR: return TABULAR; case PARAMETER_VALUE_OUTPUT_STYLE_DOCUMENT: case PARAMETER_VALUE_OUTPUT_STYLE_MAP: return MAP; default: throw new IllegalArgumentException("Unknown outputStyle '" + outputStyle + "'"); } }
Source:
<code>public void onEventMainThread(LoginTask task) { if(AppPrefs.getInstance(this).isLoggedIn()) { broadcastLogInSuccess(this); Toast.makeText(this, "success login", Toast.LENGTH_SHORT).show(); startActivity(MainActivity.getLaunchIntent(this)); <START> finish(); <END> } else { Toast.makeText(this, "failed login", Toast.LENGTH_SHORT).show(); } }</code><technical_language>I need this anymore handled broadcast receiver. test</technical_language>

Target:
public void onEventMainThread(LoginTask task) { if(AppPrefs.getInstance(this).isLoggedIn()) { broadcastLogInSuccess(this); Toast.makeText(this, "success login", Toast.LENGTH_SHORT).show(); startActivity(MainActivity.getLaunchIntent(this)); } else { Toast.makeText(this, "failed login", Toast.LENGTH_SHORT).show(); } }
Source:
<code>private boolean copyCollapseOrNoSnapshots() { <START> return !(noCollapseWithSnapshots()); <END> }</code><technical_language>This confusing is some double not. I condition line 25 for positive content, remove noCollapseWithSnapshots completely</technical_language>

Target:
private boolean copyCollapseOrNoSnapshots() { return getParameters().getVm().getSnapshots().size() <= 1 || getParameters().getCopyCollapse(); }
Source:
<code>private LegendRequest addLayer(LayerInfo layerInfo, GetLegendGraphicRequest request) throws FactoryRegistryException, IOException, TransformException, SchemaException { FeatureType featureType=getLayerFeatureType(layerInfo); if(featureType != null) { LegendRequest legend = request.new LegendRequest(featureType); legend.setLayerInfo( layerInfo ); MapLayerInfo mli=new MapLayerInfo(layerInfo); if(mli.getLabel() != null) { legend.setTitle( mli.getLabel() ); } LegendInfo legendInfo = resolveLegendInfo(layerInfo.getLegend(),request); <START> if(legendInfo != null ){ <END> legend.setLegendInfo( legendInfo ); if (legendInfo.getHeight() > 0 && !request.getKvp().containsKey("HEIGHT")) { request.setHeight(legendInfo.getHeight()); } if (legendInfo.getWidth() > 0 && !request.getKvp().containsKey("WIDTH")) { request.setWidth(legendInfo.getWidth()); } } return legend; } else { throw new ServiceException("Cannot get FeatureType for Layer", "MissingFeatureType"); } }</code><technical_language>This block of code is repeated 3 times in places, refactored a method call</technical_language>

Target:
private LegendRequest addLayer(LayerInfo layerInfo, GetLegendGraphicRequest request) throws FactoryRegistryException, IOException, TransformException, SchemaException { FeatureType featureType=getLayerFeatureType(layerInfo); if(featureType != null) { LegendRequest legend = request.new LegendRequest(featureType); legend.setLayerInfo( layerInfo ); MapLayerInfo mli=new MapLayerInfo(layerInfo); if(mli.getLabel() != null) { legend.setTitle( mli.getLabel() ); } LegendInfo legendInfo = resolveLegendInfo(layerInfo.getLegend(),request); if(legendInfo != null ){ configureLegendInfo(request, legend, legendInfo); } return legend; } else { throw new ServiceException("Cannot get FeatureType for Layer", "MissingFeatureType"); } }
Source:
<code>static FileJournalEntry parse(final String entry) { <START> String[] elements = entry.split(","); <END> if (elements.length < 4) { throw new IllegalArgumentException("Invalid journal entry: " + entry); } return new FileJournalEntry(elements[INDEX_TOKEN_ID], elements[INDEX_ISSUE_TIME], elements[INDEX_EXPIRATION], elements[INDEX_MAX_LIFETIME]); }</code><technical_language>I feel ',' (the colon) a constant indicating SEPARATOR toString() too</technical_language>

Target:
static FileJournalEntry parse(final String entry) { String[] elements = entry.split(","); if (elements.length < 4) { throw new IllegalArgumentException("Invalid journal entry: " + entry); } String tokenId = elements[INDEX_TOKEN_ID].trim(); String issueTime = elements[INDEX_ISSUE_TIME].trim(); String expiration = elements[INDEX_EXPIRATION].trim(); String maxLifetime = elements[INDEX_MAX_LIFETIME].trim(); return new FileJournalEntry(tokenId.isEmpty() ? null : tokenId, issueTime.isEmpty() ? null : issueTime, expiration.isEmpty() ? null : expiration, maxLifetime.isEmpty() ? null : maxLifetime); }
Source:
<code>protected String getJenkinsInstanceId() { <START> return JenkinsUtils.getInstanceId(); <END> }</code><technical_language>I _currently_ works out thing, please call DockerTemplateBase.getJenkinsInstanceIdForContainerLabel() instead of JenkinsUtils.getInstanceId() (make more accessible @Restricted(NoExternalUse.class) if necessary). (alternatively, add extra utility function DockerTemplateBase adds this a labelFilter DockerCloud call this utility function instead of accessing CONTAINER_LABEL_JENKINS_INSTANCE_ID) This _one_ place in code is responsible for working out string Jenkins server's "ID" (and/or filter that)</technical_language>

Target:
protected String getJenkinsInstanceId() { return DockerTemplateBase.getJenkinsInstanceIdForContainerLabel(); }
Source:
<code>public void evaluate_shouldGetGenderOfAPatient() throws Exception { Patient patient = Context.getPatientService().getPatient(8); Patient patient1 = Context.getPatientService().getPatient(2); Assert.assertTrue("patient returned null",patient!=null); <START> Assert.assertTrue("patient1 returned null",patient1!=null); <END> String expectedString="F"; String expectedString1="M"; MohGenderRule mohGenderRule = new MohGenderRule(); String foundString= mohGenderRule.evaluate(null,patient.getId(),null).toString(); String foundString1= mohGenderRule.evaluate(null,patient1.getId(),null).toString(); Assert.assertTrue(foundString, expectedString.equals(foundString)); Assert.assertTrue(foundString1, expectedString1.equals(foundString1)); }</code><technical_language>able Assert.assertNotNull("patient returned null", patient) ... try that? I want assertion is communicated properly, true null</technical_language>

Target:
public void evaluate_shouldGetGenderOfAPatient() throws Exception { Patient patient = Context.getPatientService().getPatient(8); Patient patient1 = Context.getPatientService().getPatient(2); Assert.assertNotNull("patient returned null",patient); Assert.assertNotNull("patient1 returned null",patient1); String expectedString="F"; String expectedString1="M"; MohGenderRule mohGenderRule = new MohGenderRule(); String foundString= mohGenderRule.evaluate(null,patient.getId(),null).toString(); String foundString1= mohGenderRule.evaluate(null,patient1.getId(),null).toString(); Assert.assertEquals("Female was not found",expectedString, foundString); Assert.assertEquals("Male was not found",expectedString1, foundString1); }
Source:
<code>Mono<Response<ExtractKeyPhraseResult>> extractKeyPhrasesWithResponse(String text, String language, Context context) { return extractBatchKeyPhrasesWithResponse( <START> Arrays.asList(new TextDocumentInput(Integer.toString(0), text, language)), null, context) <END> .flatMap(response -> { Iterator<ExtractKeyPhraseResult> responseItem = response.getValue().iterator(); return Mono.just(new SimpleResponse<>(response, responseItem.next())); }); }</code><technical_language>"0"</technical_language>

Target:
Mono<Response<ExtractKeyPhraseResult>> extractKeyPhrasesWithResponse(String text, String language, Context context) { Objects.requireNonNull(text, "'text' cannot be null."); return extractBatchKeyPhrasesWithResponse( Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); }
Source:
<code>private static boolean isWebpackRequireEnsureCallback(Node fnc) { checkArgument(fnc.isFunction()); if (fnc.getParent() == null) { return false; } Node callParent = fnc.getParent(); if (!callParent.isCall()) { return false; } <START> if (callParent.getFirstChild() != null <END> && callParent.getFirstChild().isGetProp() && callParent.getFirstFirstChild().isCall() && callParent .getFirstFirstChild() .getFirstChild() .matchesQualifiedName(WEBPACK_REQUIRE + ".e") && callParent.getFirstChild().getSecondChild().isString() && callParent.getFirstChild().getSecondChild().getString().equals("then")) { return true; } return false; }</code><technical_language>This line be: callParent.hasChildren()</technical_language>

Target:
private static boolean isWebpackRequireEnsureCallback(Node fnc) { checkArgument(fnc.isFunction()); if (fnc.getParent() == null) { return false; } Node callParent = fnc.getParent(); if (!callParent.isCall()) { return false; } if (callParent.hasChildren() && callParent.getFirstChild().isGetProp() && callParent.getFirstFirstChild().isCall() && callParent .getFirstFirstChild() .getFirstChild() .matchesQualifiedName(WEBPACK_REQUIRE + ".e") && callParent.getFirstChild().getSecondChild().isString() && callParent.getFirstChild().getSecondChild().getString().equals("then")) { return true; } return false; }
Source:
<code><START> @Override protected ImmutableListValue<Living> constructValue(List<Living> defaultValue) { <END> return new ImmutableSpongeListValue<>(Keys.TARGETS, ImmutableList.copyOf(defaultValue)); }</code><technical_language>annotations lines</technical_language>

Target:
protected ImmutableListValue<Living> constructValue(List<Living> defaultValue) { return new ImmutableSpongeListValue<>(Keys.TARGETS, ImmutableList.copyOf(defaultValue)); }
Source:
<code>void runOnce() { if (transactionManager != null) { try { transactionManager.resetProducerIdIfNeeded(); if (!transactionManager.isTransactional()) { maybeWaitForProducerId(); } else if (transactionManager.hasUnresolvedSequences() && !transactionManager.hasFatalError()) { transactionManager.transitionToFatalError( new KafkaException("The client hasn't received acknowledgment for " + "some previously sent messages and can no longer retry them. It isn't safe to continue.")); } else if (maybeSendAndPollTransactionalRequest()) { return; } if (transactionManager.hasFatalError() || !transactionManager.hasProducerId()) { RuntimeException lastError = transactionManager.lastError(); if (lastError != null) maybeAbortBatches(lastError); client.poll(retryBackoffMs, time.milliseconds()); return; } else if (transactionManager.hasAbortableError()) { <START> if (accumulator.abortUndrainedBatches(transactionManager.lastError())) { <END> return; } } } catch (AuthenticationException e) { log.trace("Authentication exception while processing transactional request: {}", e); transactionManager.authenticationFailed(e); } } long currentTimeMs = time.milliseconds(); long pollTimeout = sendProducerData(currentTimeMs); client.poll(pollTimeout, currentTimeMs); }</code><technical_language>point do eventually cancel commit? is in diff I bet in call trace get it</technical_language>

Target:
void runOnce() { if (transactionManager != null) { try { transactionManager.resetProducerIdIfNeeded(); if (!transactionManager.isTransactional()) { maybeWaitForProducerId(); } else if (transactionManager.hasUnresolvedSequences() && !transactionManager.hasFatalError()) { transactionManager.transitionToFatalError( new KafkaException("The client hasn't received acknowledgment for " + "some previously sent messages and can no longer retry them. It isn't safe to continue.")); } else if (maybeSendAndPollTransactionalRequest()) { return; } if (transactionManager.hasFatalError() || !transactionManager.hasProducerId()) { RuntimeException lastError = transactionManager.lastError(); if (lastError != null) maybeAbortBatches(lastError); client.poll(retryBackoffMs, time.milliseconds()); return; } } catch (AuthenticationException e) { log.trace("Authentication exception while processing transactional request: {}", e); transactionManager.authenticationFailed(e); } } long currentTimeMs = time.milliseconds(); long pollTimeout = sendProducerData(currentTimeMs); client.poll(pollTimeout, currentTimeMs); }
Source:
<code>public void handleUpdate(List<MetadataMappingDescriptor> mappingDescriptors, DocumentModel doc) { for (MetadataMappingDescriptor mappingDescriptor : mappingDescriptors) { Property fileProp = doc.getProperty(mappingDescriptor.getBlobXPath()); Blob blob = fileProp.getValue(Blob.class); if (blob != null) { boolean isDirtyMapping = isDirtyMapping(mappingDescriptor, doc); if (isDirtyMapping) { <START> if(!mappingDescriptor.getReadOnly()) { <END> BlobManager blobManager = Framework.getService(BlobManager.class); BlobProvider blobProvider = blobManager.getBlobProvider(blob); if (blobProvider != null && (!blobProvider.supportsUserUpdate() || blobProvider.getBinaryManager() == null)) { return; } Blob newBlob = writeMetadata(mappingDescriptor.getProcessor(), fileProp.getValue(Blob.class), mappingDescriptor.getId(), doc); fileProp.setValue(newBlob); } } else if (fileProp.isDirty()) { writeMetadata(doc); } } } }</code><technical_language>sense join isDirtyMapping readOnly conditions? loose history code complex</technical_language>

Target:
public void handleUpdate(List<MetadataMappingDescriptor> mappingDescriptors, DocumentModel doc) { for (MetadataMappingDescriptor mappingDescriptor : mappingDescriptors) { Property fileProp = doc.getProperty(mappingDescriptor.getBlobXPath()); Blob blob = fileProp.getValue(Blob.class); if (blob != null) { boolean isDirtyMapping = isDirtyMapping(mappingDescriptor, doc); if (isDirtyMapping) { if (!mappingDescriptor.isReadOnly()) { BlobManager blobManager = Framework.getService(BlobManager.class); BlobProvider blobProvider = blobManager.getBlobProvider(blob); if (blobProvider != null && (!blobProvider.supportsUserUpdate() || blobProvider.getBinaryManager() == null)) { return; } Blob newBlob = writeMetadata(mappingDescriptor.getProcessor(), fileProp.getValue(Blob.class), mappingDescriptor.getId(), doc); fileProp.setValue(newBlob); } } else if (fileProp.isDirty()) { writeMetadata(doc); } } } }
Source:
<code>public void serialize() throws IOException, ClassNotFoundException { IntHashMap<String> map = new IntHashMap<>(); map.put(1, "one"); map.put(2, "two"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(map); byte[] serialized = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(serialized); ObjectInputStream ois = new ObjectInputStream(bais); IntHashMap<String> deserialized = (IntHashMap<String>) ois.readObject(); assertNotNull(deserialized); <START> assertEquals(deserialized.get(1), "one"); <END> assertEquals(deserialized.get(2), "two"); deserialized.put(3, "three"); deserialized.entrySet().iterator(); }</code><technical_language>Is this correct parameter order</technical_language>

Target:
void serialize() throws IOException, ClassNotFoundException { IntHashMap<String> map = new IntHashMap<>(); map.put(1, "one"); map.put(2, "two"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(map); byte[] serialized = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(serialized); ObjectInputStream ois = new ObjectInputStream(bais); IntHashMap<String> deserialized = (IntHashMap<String>)ois.readObject(); assertNotNull(deserialized); assertEquals("one", deserialized.get(1)); assertEquals("two", deserialized.get(2)); deserialized.put(3, "three"); deserialized.entrySet().iterator(); }
Source:
<code>public NetClient(ChannelHandlerContext ctx) { this.channel = ctx.channel(); this.currentState = NetState.HANDSHAKE; this.channel.closeFuture().addListener(new GenericFutureListener<Future<Void>>() { @Override public void operationComplete(Future<Void> future) throws Exception { <START> NetClient.this.disconnect(ChatComponent.empty()); <END> future.removeListener(this); } }); }</code><technical_language>Move a constant please</technical_language>

Target:
public NetClient(ChannelHandlerContext ctx) { this.channel = ctx.channel(); this.currentState = NetState.HANDSHAKE; this.channel.closeFuture().addListener(new GenericFutureListener<Future<Void>>() { @Override public void operationComplete(Future<Void> future) throws Exception { NetClient.this.disconnect(EMPTY); future.removeListener(this); } }); }
Source:
<code>private AuditLogableBase createEvent() { final AuditLogableBase event = new AuditLogableBase(); <START> event.setVds(host); <END> return event; }</code><technical_language>pls replace this event.setVdsName(host.getName()); VdsName is element required logging of events created this methods</technical_language>

Target:
private AuditLogableBase createEvent() { final AuditLogableBase event = new AuditLogableBase(); event.setVdsName(host.getName()); return event; }
Source:
<code>public static String replaceSubstringInBetween(final String str, final String replace, final String open, final String close) { if (str == null || open == null || close == null) { return null; } final int start = str.indexOf(open); if (start != INDEX_NOT_FOUND) { String preceding = ""; if (start > 0) { preceding = str.substring(0, start); } final int end = str.indexOf(close, start + open.length()); if (end != INDEX_NOT_FOUND) { String exceding = ""; <START> if ((end < str.length() - 1) && (end + close.length() < str.length())) { <END> exceding = str.substring(end + close.length(), str.length()); } return preceding + open + replace + close + exceding; } } return null; }</code><technical_language>lost this if is needed. I call str.substring(end) add preceding, open, replace, end</technical_language>

Target:
public static String replaceSubstringInBetween(final String str, final String replace, final String open, final String close) { if (str == null) { return null; } if (open == null || close == null) { return str; } final int start = str.indexOf(open); if (start != INDEX_NOT_FOUND) { String preceding = str.substring(0, start); final int end = str.indexOf(close, start + open.length()); if (end != INDEX_NOT_FOUND) { String exceeding = str.substring(end + close.length(), str.length()); return preceding + open + replace + close + exceeding; } } return str; }
Source:
<code>public String[] getCatalogNames() { Connection connection = getConnection(); DatabaseMetaData metaData = null; ResultSet rs = null; try { metaData = connection.getMetaData(); } catch (SQLException e) { throw JdbcUtils.wrapException(e, "retrieve metadata", JdbcActionType.METADATA); } logger.debug("Retrieving catalogs"); List<String> catalogs = new ArrayList<>(); try { rs = metaData.getCatalogs(); while (rs.next()) { String catalogName = rs.getString(1); logger.debug("Found catalogName: {}", catalogName); catalogs.add(catalogName); } } catch (SQLException e) { logger.error("Error retrieving catalog metadata", e); } finally { if(rs != null){ try { <START> rs.close(); <END> } catch (SQLException e) { e.printStackTrace(); } } close(connection); logger.debug("Retrieved catalogs", catalogs.size()); } return catalogs.toArray(new String[catalogs.size()]); }</code><technical_language>FileHelper.safeClose(rs);</technical_language>

Target:
public String[] getCatalogNames() { Connection connection = getConnection(); DatabaseMetaData metaData = null; ResultSet rs = null; try { metaData = connection.getMetaData(); } catch (SQLException e) { throw JdbcUtils.wrapException(e, "retrieve metadata", JdbcActionType.METADATA); } logger.debug("Retrieving catalogs"); List<String> catalogs = new ArrayList<>(); try { rs = metaData.getCatalogs(); while (rs.next()) { String catalogName = rs.getString(1); logger.debug("Found catalogName: {}", catalogName); catalogs.add(catalogName); } } catch (SQLException e) { logger.error("Error retrieving catalog metadata", e); } finally { FileHelper.safeClose(rs); close(connection); logger.debug("Retrieved catalogs", catalogs.size()); } return catalogs.toArray(new String[catalogs.size()]); }
Source:
<code>public void createCartWithALineItemWithAnExternalPrice() { withProduct(client(), product -> { final int quantity = 5; final int variantId = 1; <START> final Money externalPrice = Money.from(EURO_12); <END> final LineItemDraft lineItemDraft = LineItemDraft.of(product, variantId, quantity) .withExternalPrice(externalPrice); withCartWithLineItems(client(), singletonList(lineItemDraft), cart -> { final LineItem cartLineItem = cart.getLineItems().get(0); assertThat(cartLineItem.getPrice().getValue()).isEqualTo(externalPrice); assertThat(cartLineItem.getPriceMode()).isEqualTo(EXTERNAL_PRICE); return cart; }); }); }</code><technical_language>applying changes above, replace Money.from(...) EURO_12 here</technical_language>

Target:
public void createCartWithALineItemWithAnExternalPrice() { withProduct(client(), product -> { final int quantity = 5; final int variantId = 1; final MonetaryAmount externalPrice = EURO_12; final LineItemDraft lineItemDraft = LineItemDraft.of(product, variantId, quantity) .withExternalPrice(externalPrice); withCartWithLineItems(client(), singletonList(lineItemDraft), cart -> { final LineItem cartLineItem = cart.getLineItems().get(0); assertThat(cartLineItem.getPrice().getValue()).isEqualTo(externalPrice); assertThat(cartLineItem.getPriceMode()).isEqualTo(EXTERNAL_PRICE); return cart; }); }); }
Source:
<code>public void testEncryptDecryptWithEmptyPlaintext() throws GeneralSecurityException { for (int keySize : keySizeInBytes) { DeterministicAead dead = new AesSiv(Random.randBytes(keySize)); for (int triesPlaintext = 0; triesPlaintext < 100; triesPlaintext++) { byte[] plaintext = new byte[0]; byte[] aad = Random.randBytes(Random.randInt(128) + 1); byte[] ciphertext = dead.encryptDeterministically(plaintext, aad); byte[] rebuiltPlaintext = dead.decryptDeterministically(ciphertext, aad); assertEquals(AesUtil.BLOCK_SIZE, ciphertext.length); assertEquals(Hex.encode(plaintext), Hex.encode(rebuiltPlaintext)); <START> byte[] nullAadCiphertext = dead.encryptDeterministically(plaintext, null); <END> byte[] nullAadDecryptedText = dead.encryptDeterministically(plaintext, null); assertEquals(AesUtil.BLOCK_SIZE, nullAadCiphertext.length); assertEquals(Hex.encode(nullAadDecryptedText), Hex.encode(nullAadCiphertext)); } } }</code><technical_language>Please move this a separate unit test. I want test scenarios: - Encrypting non-empty plaintext null AAD - Null AAD is equivalent empty AAD</technical_language>

Target:
public void testEncryptDecryptWithEmptyPlaintext() throws GeneralSecurityException { for (int keySize : keySizeInBytes) { DeterministicAead dead = new AesSiv(Random.randBytes(keySize)); for (int triesPlaintext = 0; triesPlaintext < 100; triesPlaintext++) { byte[] plaintext = new byte[0]; byte[] aad = Random.randBytes(Random.randInt(128) + 1); byte[] ciphertext = dead.encryptDeterministically(plaintext, aad); byte[] rebuiltPlaintext = dead.decryptDeterministically(ciphertext, aad); assertEquals(AesUtil.BLOCK_SIZE, ciphertext.length); assertEquals(Hex.encode(plaintext), Hex.encode(rebuiltPlaintext)); } } }
Source:
<code>public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { <START> if (!StringUtils.equals("POOLTASK", targetType)) { <END> return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); EPerson ePerson = null; try { ePerson = ePersonService.findByEmail(context, (String) authentication.getPrincipal()); if (ePerson == null) { return false; } Integer dsoId = Integer.parseInt(targetId.toString()); PoolTask poolTask = poolTaskService.find(context, dsoId); if (poolTask == null) { return true; } XmlWorkflowItem workflowItem = poolTask.getWorkflowItem(); PoolTask poolTask2 = poolTaskService.findByWorkflowIdAndEPerson(context, workflowItem, ePerson); if (poolTask2 != null && poolTask2.getID() == poolTask.getID()) { return true; } } catch (SQLException | AuthorizeException | IOException e) { log.error(e.getMessage(), e); } return false; }</code><technical_language>here, this a constant (need in actual Constants class though)</technical_language>

Target:
public boolean hasDSpacePermission(Authentication authentication, Serializable targetId, String targetType, DSpaceRestPermission permission) { if (!StringUtils.equalsIgnoreCase(PoolTaskRest.NAME, targetType)) { return false; } Request request = requestService.getCurrentRequest(); Context context = ContextUtil.obtainContext(request.getServletRequest()); EPerson ePerson = null; try { ePerson = ePersonService.findByEmail(context, (String) authentication.getPrincipal()); if (ePerson == null) { return false; } Integer dsoId = Integer.parseInt(targetId.toString()); PoolTask poolTask = poolTaskService.find(context, dsoId); if (poolTask == null) { return true; } XmlWorkflowItem workflowItem = poolTask.getWorkflowItem(); PoolTask poolTask2 = poolTaskService.findByWorkflowIdAndEPerson(context, workflowItem, ePerson); if (poolTask2 != null && poolTask2.getID() == poolTask.getID()) { return true; } } catch (SQLException | AuthorizeException | IOException e) { log.error(e.getMessage(), e); } return false; }
Source:
<code>private void addQuadWithAlpha(MatrixStack.Entry matrixEntryIn, BakedQuad quadIn, Vector4f color, int light, int combinedOverlayIn, IVertexBuilder builder) { int[] vertexData = quadIn.getVertexData(); Vec3i normalInt = quadIn.getFace().getDirectionVec(); Vector3f normal = new Vector3f(normalInt.getX(), normalInt.getY(), normalInt.getZ()); Matrix4f transform = matrixEntryIn.getMatrix(); normal.transform(matrixEntryIn.getNormal()); int intSize = DefaultVertexFormats.BLOCK.getIntegerSize(); int j = vertexData.length/intSize; try(MemoryStack memorystack = MemoryStack.stackPush()) { ByteBuffer bytebuffer = memorystack.malloc(DefaultVertexFormats.BLOCK.getSize()); IntBuffer intbuffer = bytebuffer.asIntBuffer(); for(int i = 0; i < j; ++i) { intbuffer.clear(); intbuffer.put(vertexData, i*intSize, intSize); <START> float x = bytebuffer.getFloat(0); <END> float y = bytebuffer.getFloat(4); float z = bytebuffer.getFloat(8); int lightmapUV = builder.applyBakedLighting(light, bytebuffer); float texU = bytebuffer.getFloat(16); float texV = bytebuffer.getFloat(20); Vector4f vector4f = new Vector4f(x, y, z, 1.0F); vector4f.transform(transform); builder.applyBakedNormals(normal, bytebuffer, matrixEntryIn.getNormal()); builder.addVertex( vector4f.getX(), vector4f.getY(), vector4f.getZ(), color.getX(), color.getY(), color.getZ(), color.getW(), texU, texV, combinedOverlayIn, lightmapUV, normal.getX(), normal.getY(), normal.getZ() ); } } }</code><technical_language>a good idea rely order of elements in vertex format. some [helper functions](<LINK_0> get offsets for position UV format</technical_language>

Target:
private void addQuadWithAlpha(MatrixStack.Entry matrixEntryIn, BakedQuad quadIn, Vector4f color, int light, int combinedOverlayIn, IVertexBuilder builder) { int[] vertexData = quadIn.getVertexData(); Vec3i normalInt = quadIn.getFace().getDirectionVec(); Vector3f normal = new Vector3f(normalInt.getX(), normalInt.getY(), normalInt.getZ()); Matrix4f transform = matrixEntryIn.getMatrix(); normal.transform(matrixEntryIn.getNormal()); int vertexSize = DefaultVertexFormats.BLOCK.getIntegerSize(); int numVertices = vertexData.length/vertexSize; try(MemoryStack memorystack = MemoryStack.stackPush()) { ByteBuffer bytebuffer = memorystack.malloc(DefaultVertexFormats.BLOCK.getSize()); IntBuffer intbuffer = bytebuffer.asIntBuffer(); for(int i = 0; i < numVertices; ++i) { intbuffer.clear(); intbuffer.put(vertexData, i*vertexSize, vertexSize); float x = bytebuffer.getFloat(0); float y = bytebuffer.getFloat(4); float z = bytebuffer.getFloat(8); int lightmapUV = builder.applyBakedLighting(light, bytebuffer); float texU = bytebuffer.getFloat(16); float texV = bytebuffer.getFloat(20); Vector4f vector4f = new Vector4f(x, y, z, 1.0F); vector4f.transform(transform); builder.applyBakedNormals(normal, bytebuffer, matrixEntryIn.getNormal()); builder.addVertex( vector4f.getX(), vector4f.getY(), vector4f.getZ(), color.getX(), color.getY(), color.getZ(), color.getW(), texU, texV, combinedOverlayIn, lightmapUV, normal.getX(), normal.getY(), normal.getZ() ); } } }
Source:
<code>public void slicesOfTwo() { Series series = new Series("35"); <START> List<String> expected = Arrays.asList("3", "5"); <END> List<String> actual = series.slices(2); assertEquals(expected, actual); }</code><technical_language>I this "35" is build is failing</technical_language>

Target:
public void slicesOfTwo() { Series series = new Series("35"); List<String> expected = Collections.singletonList("35"); List<String> actual = series.slices(2); assertEquals(expected, actual); }
Source:
<code>public JobFactory amazonBucketJobFactory() { return new JobFactory() { <START> @Override <END> public Job createJob(JobExecution jobExecution) { final AmazonBucketJobExecution amazonBucketJobExecution = (AmazonBucketJobExecution) jobExecution; final String targetEntityId = amazonBucketJobExecution.getTargetEntityId(); final String jobExecutionID = amazonBucketJobExecution.getIdentifier(); final String bucket = amazonBucketJobExecution.getBucket(); final String key = amazonBucketJobExecution.getKey(); final String profile = amazonBucketJobExecution.getProfile(); final boolean isExpression = amazonBucketJobExecution.isExpression(); return progress -> ingester .ingest(jobExecutionID, targetEntityId, bucket, key, profile, isExpression, progress); } @Override public JobType getJobType() { JobType result = jobTypeFactory.create("BucketIngest"); result.setLabel("Bucket ingest"); result.setDescription("This job downloads a file from a URL and imports it into MOLGENIS."); result.setSchema(""); result.setJobExecutionType(amazonBucketJobExecutionMetaData); return result; } }; }</code><technical_language>separated JobFactory ScheduledJobType separate beans. I put a PR repo</technical_language>

Target:
public JobFactory<AmazonBucketJobExecution> amazonBucketJobFactory() { return new JobFactory<AmazonBucketJobExecution>() { @Override public Job createJob(AmazonBucketJobExecution amazonBucketJobExecution) { final String targetEntityId = amazonBucketJobExecution.getTargetEntityId(); final String jobExecutionID = amazonBucketJobExecution.getIdentifier(); final String bucket = amazonBucketJobExecution.getBucket(); final String key = amazonBucketJobExecution.getKey(); final String profile = amazonBucketJobExecution.getProfile(); final String region = amazonBucketJobExecution.getRegion(); final boolean isExpression = amazonBucketJobExecution.isExpression(); return progress -> ingester .ingest(jobExecutionID, targetEntityId, bucket, key, profile, region, isExpression, progress); } }; }
Source:
<code>public synchronized String getNextReassignmentDestination() { if (!initialized) { activeNodes.forEach(node -> nodeBucketCounts.put(node, 0)); bucketNodes.forEach(bucketNode -> <START> nodeBucketCounts.compute(bucketNode.getNodeIdentifier(), (node, bucketCount) -> (bucketCount == null) ? 1 : bucketCount + 1)); <END> initialized = true; } String assignedNode; if (activeNodes.size() > 1) { assignedNode = randomTwoChoices(); } else { assignedNode = activeNodes.get(0); } nodeBucketCounts.compute(assignedNode, (node, count) -> count + 1); return assignedNode; }</code><technical_language>This simplified java firstNonNull(bucketCount, 0) + 1</technical_language>

Target:
public String getNextReassignmentDestination() { if (!initialized) { for (String node : activeNodes) { nodeBucketCounts.put(node, 0); } for (BucketNode bucketNode : bucketNodes) { nodeBucketCounts.computeIfPresent(bucketNode.getNodeIdentifier(), (node, bucketCount) -> bucketCount + 1); } initialized = true; } String assignedNode; if (activeNodes.size() > 1) { assignedNode = randomTwoChoices(); } else { assignedNode = activeNodes.get(0); } nodeBucketCounts.compute(assignedNode, (node, count) -> count + 1); return assignedNode; }
Source:
<code>private static <T> void collapse(List<ChangeNotification<T>> notifications, Map<T, Integer> markers, List<ChangeNotification<T>> result) { for (int i = notifications.size() - 1; i >= 0; i--) { <START> ChangeNotification<T> next = notifications.get(i); <END> T data = next.getData(); if (markers.keySet().contains(data)) { int idx = markers.get(data); if (next.getKind() == Kind.Add && result.get(idx).getKind() == Kind.Modify) { result.set(idx, next); } } else { markers.put(data, result.size()); result.add(next); } } }</code><technical_language>add a guard ensure data notifications processed</technical_language>

Target:
private static <T> void collapse(List<ChangeNotification<T>> notifications, Map<T, Integer> markers, List<ChangeNotification<T>> result) { for (int i = notifications.size() - 1; i >= 0; i--) { ChangeNotification<T> next = notifications.get(i); if(next.isDataNotification()) { T data = next.getData(); if (markers.keySet().contains(data)) { int idx = markers.get(data); if (next.getKind() == Kind.Add && result.get(idx).getKind() == Kind.Modify) { result.set(idx, next); } } else { markers.put(data, result.size()); result.add(next); } } } }
Source:
<code>boolean requestRunway (PushOne op) { synchronized (stateLock) { if (op.wasCanceled()) { <START> return true; <END> } if (inFlight.containsKey(op.getURI())) { return false; } pending.remove(op.getURI()); inFlight.put(op.getURI(), op); } return true; }</code><technical_language>clearer if returned false checked for cancel failed call prevent reschedule. I check for cancelled in success case anymore simplifying a bit potentially</technical_language>

Target:
boolean requestRunway (PushOne op) { synchronized (stateLock) { if (op.wasCanceled()) { return true; } pending.remove(op.getURI()); if (inFlight.containsKey(op.getURI())) { return false; } inFlight.put(op.getURI(), op); } return true; }
Source:
<code>public Collection<String> staticLabels() { Collection<String> knownStaticLabels = this.staticLabels; if (knownStaticLabels == null) { synchronized (this) { knownStaticLabels = this.staticLabels; if (knownStaticLabels == null) { <START> this.staticLabels = Collections.unmodifiableCollection(collectLabels(new ArrayList<>())); <END> knownStaticLabels = this.staticLabels; } } } return knownStaticLabels; }</code><technical_language>please get rid of new ArrayList create return in collectLabels function? This need adjustments in collectLabels feel IMHO</technical_language>

Target:
public Collection<String> staticLabels() { Collection<String> knownStaticLabels = this.staticLabels; if (knownStaticLabels == null) { synchronized (this) { knownStaticLabels = this.staticLabels; if (knownStaticLabels == null) { this.staticLabels = Collections.unmodifiableCollection(collectLabels()); knownStaticLabels = this.staticLabels; } } } return knownStaticLabels; }
Source:
<code>private Map<String, Diagram> createDiagramMap() { final Map<String, Diagram> diagramMap = new HashMap<String, Diagram>(); final List<?> diagramEditors = EditorService.getInstance().getRegisteredEditorParts(); final Iterator<?> it = diagramEditors.iterator(); while (it.hasNext()) { final Object obj = it.next(); if (obj instanceof DiagramEditor) { final DiagramEditor dEditor = (DiagramEditor) obj; Diagram diagram = dEditor.getDiagram(); String diagramName = dEditor.getPartName(); if (diagramName == null) { diagramName = dEditor.getTitle(); } if (diagramName == null) { diagramName = diagram.getName(); } Resource resource = diagram.eResource(); if (resource != null) { <START> URI diagramURI = resource.getURI(); <END> diagramName = diagramURI.toString() + "#" + diagramName; } diagramName = makeNameUnique(diagramName, diagramMap.keySet()); diagramMap.put(diagramName, diagram); } } return diagramMap; }</code><technical_language>"diagramURI" --> resourceURI</technical_language>

Target:
private Map<String, Diagram> createDiagramMap() { final Map<String, Diagram> diagramMap = new HashMap<String, Diagram>(); final List<?> diagramEditors = EditorService.getInstance().getRegisteredEditorParts(); final Iterator<?> it = diagramEditors.iterator(); while (it.hasNext()) { final Object obj = it.next(); if (obj instanceof DiagramEditor) { final DiagramEditor dEditor = (DiagramEditor) obj; Diagram diagram = dEditor.getDiagram(); String diagramName = dEditor.getPartName(); if (diagramName == null) { diagramName = dEditor.getTitle(); } if (diagramName == null) { diagramName = diagram.getName(); } Resource resource = diagram.eResource(); if (resource != null) { URI resourceURI = resource.getURI(); diagramName = resourceURI.toString() + "#" + diagramName; } diagramName = makeNameUnique(diagramName, diagramMap.keySet()); diagramMap.put(diagramName, diagram); } } return diagramMap; }
Source:
<code>public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { <START> if (msg instanceof HttpResponse && WebSocketExtensionUtil.isWebsocketUpgrade(((HttpResponse) msg).headers())) { <END> if (validExtensions != null) { HttpResponse response = (HttpResponse) msg; String headerValue = response.headers().getAsString(HttpHeaderNames.SEC_WEBSOCKET_EXTENSIONS); for (WebSocketServerExtension extension : validExtensions) { WebSocketExtensionData extensionData = extension.newReponseData(); headerValue = WebSocketExtensionUtil.appendExtension(headerValue, extensionData.name(), extensionData.parameters()); } promise.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { for (WebSocketServerExtension extension : validExtensions) { WebSocketExtensionDecoder decoder = extension.newExtensionDecoder(); WebSocketExtensionEncoder encoder = extension.newExtensionEncoder(); ctx.pipeline() .addAfter(ctx.name(), decoder.getClass().getName(), decoder) .addAfter(ctx.name(), encoder.getClass().getName(), encoder); } } } }); if (headerValue != null) { response.headers().set(HttpHeaderNames.SEC_WEBSOCKET_EXTENSIONS, headerValue); } } promise.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { ctx.pipeline().remove(ctx.name()); } } }); } super.write(ctx, msg, promise); }</code><technical_language>split this condition 2 separate if's? perform 1 class cast: ((HttpResponse) msg).headers() HttpResponse response = (HttpResponse) msg; Also, response.headers() moved variable</technical_language>

Target:
public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof HttpResponse) { HttpHeaders headers = ((HttpResponse) msg).headers(); if (WebSocketExtensionUtil.isWebsocketUpgrade(headers)) { if (validExtensions != null) { String headerValue = headers.getAsString(HttpHeaderNames.SEC_WEBSOCKET_EXTENSIONS); for (WebSocketServerExtension extension : validExtensions) { WebSocketExtensionData extensionData = extension.newReponseData(); headerValue = WebSocketExtensionUtil.appendExtension(headerValue, extensionData.name(), extensionData.parameters()); } promise.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { if (future.isSuccess()) { for (WebSocketServerExtension extension : validExtensions) { WebSocketExtensionDecoder decoder = extension.newExtensionDecoder(); WebSocketExtensionEncoder encoder = extension.newExtensionEncoder(); ctx.pipeline() .addAfter(ctx.name(), decoder.getClass().getName(), decoder) .addAfter(ctx.name(), encoder.getClass().getName(), encoder); } } } }); if (headerValue != null) { headers.set(HttpHeaderNames.SEC_WEBSOCKET_EXTENSIONS, headerValue); } } promise.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { if (future.isSuccess()) { ctx.pipeline().remove(WebSocketServerExtensionHandler.this); } } }); } } super.write(ctx, msg, promise); }
Source:
<code>public Command exec(String command) throws ConnectionException, TransportException { checkReuse(); log.debug("Will request to exec `{}`", command); <START> sendChannelRequest("exec", true, new Buffer.PlainBuffer().putString(command.getBytes(getRemoteCharset()))) <END> .await(conn.getTimeoutMs(), TimeUnit.MILLISECONDS); usedUp = true; return this; }</code><technical_language>main question I reading this, _every_ string written remote charset? If so, is nicer a property of Buffer, converting call putString</technical_language>

Target:
public Command exec(String command) throws ConnectionException, TransportException { checkReuse(); log.debug("Will request to exec `{}`", command); sendChannelRequest("exec", true, new Buffer.PlainBuffer().putString(command, getRemoteCharset())) .await(conn.getTimeoutMs(), TimeUnit.MILLISECONDS); usedUp = true; return this; }
Source:
<code>private static boolean codecNeedsSetOutputSurfaceWorkaround(String name) { return (("deb".equals(Util.DEVICE) || "flo".equals(Util.DEVICE)) && "OMX.qcom.video.decoder.avc".equals(name)) <START> || (("tcl_eu".equals(Util.DEVICE) || Util.MODEL.startsWith("BRAVIA")) <END> && "OMX.MTK.VIDEO.DECODER.AVC".equals(name)); }</code><technical_language>Util.MODEL.startsWith("BRAVIA") feels blacklist Sony TVs for long stick BRAVIA branding. a more precise, apply a maximum API level workaround applied future BRAVIA devices automatically get workaround too? Thanks</technical_language>

Target:
private static boolean codecNeedsSetOutputSurfaceWorkaround(String name) { return (("deb".equals(Util.DEVICE) || "flo".equals(Util.DEVICE)) && "OMX.qcom.video.decoder.avc".equals(name)) || (("tcl_eu".equals(Util.DEVICE) || "SVP-DTV15".equals(Util.DEVICE) || "BRAVIA_ATV2".equals(Util.DEVICE)) && "OMX.MTK.VIDEO.DECODER.AVC".equals(name)); }
Source:
<code>public int hashCode() { return <START> Objects.hash(id, resource); <END> }</code><technical_language>Please revert this too</technical_language>

Target:
public int hashCode() { return (int) id + resource.hashCode(); }
Source:
<code>public void assertAuthentication(MockWebServer server) { <START> assertEquals(server.getRequestCount(), 2); <END> try { assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1"); } catch (InterruptedException e) { Throwables.propagate(e); } }</code><technical_language>assert request count 2 in a base class this. mock tests more requests that</technical_language>

Target:
public void assertAuthentication(MockWebServer server) { assertTrue(server.getRequestCount() >= 1); try { assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1"); } catch (InterruptedException e) { Throwables.propagate(e); } }