auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void showCommonalityDetails() { if (correlationAttributes.isEmpty()) { JOptionPane.showConfirmDialog(showCommonalityMenuItem, Bundle.DataContentViewerOtherCases_correlatedArtifacts_isEmpty(), Bundle.DataContentViewerOtherCases_correlatedArtifacts_title(), DEFAULT_OPTION, PLAIN_MESSAGE); } else { StringBuilder msg = new StringBuilder(correlationAttributes.size()); int percentage; try { EamDb dbManager = EamDb.getInstance(); for (CorrelationAttribute eamArtifact : correlationAttributes) { try { percentage = dbManager.getFrequencyPercentage(eamArtifact); msg.append(Bundle.DataContentViewerOtherCases_correlatedArtifacts_byType(percentage, eamArtifact.getCorrelationType().getDisplayName(), eamArtifact.getCorrelationValue())); } catch (CorrelationAttributeNormalizationException ex) { String message = String.format("Unable to determine commonality for artifact %s", eamArtifact.toString()); LOGGER.log(Level.SEVERE, message, ex); Exceptions.printStackTrace(ex); } } JOptionPane.showConfirmDialog(showCommonalityMenuItem, msg.toString(), Bundle.DataContentViewerOtherCases_correlatedArtifacts_title(), DEFAULT_OPTION, PLAIN_MESSAGE); } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error getting commonality details.", ex); JOptionPane.showConfirmDialog(showCommonalityMenuItem, Bundle.DataContentViewerOtherCases_correlatedArtifacts_failed(), Bundle.DataContentViewerOtherCases_correlatedArtifacts_title(), DEFAULT_OPTION, ERROR_MESSAGE); } } }

Target:
private void showCommonalityDetails() { if (correlationAttributes.isEmpty()) { JOptionPane.showConfirmDialog(showCommonalityMenuItem, Bundle.DataContentViewerOtherCases_correlatedArtifacts_isEmpty(), Bundle.DataContentViewerOtherCases_correlatedArtifacts_title(), DEFAULT_OPTION, PLAIN_MESSAGE); } else { StringBuilder msg = new StringBuilder(correlationAttributes.size()); int percentage; try { EamDb dbManager = EamDb.getInstance(); for (CorrelationAttributeInstance eamArtifact : correlationAttributes) { try { percentage = dbManager.getFrequencyPercentage(eamArtifact); msg.append(Bundle.DataContentViewerOtherCases_correlatedArtifacts_byType(percentage, eamArtifact.getCorrelationType().getDisplayName(), eamArtifact.getCorrelationValue())); } catch (CorrelationAttributeNormalizationException ex) { LOGGER.log(Level.WARNING, String.format("Error getting commonality details for artifact with ID: %s.", eamArtifact.getID()), ex); } } JOptionPane.showConfirmDialog(showCommonalityMenuItem, msg.toString(), Bundle.DataContentViewerOtherCases_correlatedArtifacts_title(), DEFAULT_OPTION, PLAIN_MESSAGE); } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error getting commonality details.", ex); JOptionPane.showConfirmDialog(showCommonalityMenuItem, Bundle.DataContentViewerOtherCases_correlatedArtifacts_failed(), Bundle.DataContentViewerOtherCases_correlatedArtifacts_title(), DEFAULT_OPTION, ERROR_MESSAGE); } } }
Source:
private void handleWebSocketHandshake(HttpRequest httpRequest) throws ProtocolException { try { WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory( getWebSocketURL(httpRequest), null, true); handshaker = wsFactory.newHandshaker(httpRequest); handshaker.handshake(ctx.channel(), httpRequest); boolean isSecuredConnection = false; if (listenerConfiguration.getSslConfig() != null) { isSecuredConnection = true; } ChannelPipeline pipeline = ctx.pipeline(); int maxThreads = 15; EventExecutorGroup executorGroup = new DefaultEventExecutorGroup(maxThreads); pipeline.addLast(executorGroup, "ws_handler", new WebSocketSourceHandler(generateWebSocketChannelID(), this.connectionManager, this.listenerConfiguration, httpRequest.getUri(), isSecuredConnection, ctx)); pipeline.remove(this); } catch (Exception e) { ctx.channel().write(new CloseWebSocketFrame(1002, "")); ctx.close(); throw new ProtocolException("Error occurred in HTTP to WebSocket Upgrade."); } }

Target:
private void handleWebSocketHandshake(HttpRequest httpRequest) throws ProtocolException { try { WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory( getWebSocketURL(httpRequest), null, true); handshaker = wsFactory.newHandshaker(httpRequest); handshaker.handshake(ctx.channel(), httpRequest); boolean isSecuredConnection = false; if (listenerConfiguration.getSslConfig() != null) { isSecuredConnection = true; } ChannelPipeline pipeline = ctx.pipeline(); int maxThreads = PoolConfiguration.getInstance().getEventGroupExecutorThreads(); EventExecutorGroup executorGroup = new DefaultEventExecutorGroup(maxThreads); pipeline.addLast(executorGroup, "ws_handler", new WebSocketSourceHandler(generateWebSocketChannelID(), this.connectionManager, this.listenerConfiguration, httpRequest.getUri(), isSecuredConnection, ctx)); pipeline.remove(this); } catch (Exception e) { ctx.channel().writeAndFlush(new CloseWebSocketFrame(1002, "")); ctx.close(); throw new ProtocolException("Error occurred in HTTP to WebSocket Upgrade : " + e.getMessage()); } }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { this.modifier = savedInstanceState.getParcelable(MODIFIER_KEY); } Detail childDetail = getChildDetail(); TreeReference childReference = getChildReference(); NodeEntityFactory factory = new NodeEntityFactory(childDetail, this.getFactoryContext()); View rootView = inflater.inflate(R.layout.entity_detail_list, container, false); final Activity thisActivity = getActivity(); final Entity entity = factory.getEntity(childReference); final DetailCalloutListener detailCalloutListener = thisActivity instanceof DetailCalloutListener ? ((DetailCalloutListener)thisActivity) : null; adapter = new EntityDetailAdapter( thisActivity, asw.getSession(), childDetail, entity, detailCalloutListener, getArguments().getInt(DETAIL_INDEX), modifier ); ((ListView)rootView.findViewById(R.id.screen_entity_detail_list)).setAdapter((ListAdapter)adapter); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { this.modifier = savedInstanceState.getParcelable(MODIFIER_KEY); } Detail childDetail = getChildDetail(); TreeReference childReference = getChildReference(); NodeEntityFactory factory = new NodeEntityFactory(childDetail, this.getFactoryContext(childReference)); View rootView = inflater.inflate(R.layout.entity_detail_list, container, false); final Activity thisActivity = getActivity(); final Entity entity = factory.getEntity(childReference); final DetailCalloutListener detailCalloutListener = thisActivity instanceof DetailCalloutListener ? ((DetailCalloutListener)thisActivity) : null; adapter = new EntityDetailAdapter( thisActivity, asw.getSession(), childDetail, entity, detailCalloutListener, getArguments().getInt(DETAIL_INDEX), modifier ); ((ListView)rootView.findViewById(R.id.screen_entity_detail_list)).setAdapter((ListAdapter)adapter); return rootView; }
Source:
public Certificate getCertificate(String alias) { try { return getUnderlyingKeyStore().getCertificate(alias); } catch (KeyStoreException e) { logger.info("could not retrieve certificate for alias " + alias, e); } return null; }

Target:
public Certificate getCertificate(String alias) { try { return getUnderlyingKeyStore().getCertificate(alias); } catch (KeyStoreException e) { logger.warn("could not retrieve certificate for alias " + alias, e); } return null; }
Source:
public List<View> getRootViews() { try { return Collections.unmodifiableList(Arrays.asList((View[]) mViewsField.get(mWindowManagerGlobal))); } catch (IllegalAccessException e) { throw new RuntimeException("unfortunately, you cannot view the view tree of the dialog etc.", e); } }

Target:
public List<View> getRootViews() { try { return Collections.unmodifiableList(Arrays.asList((View[]) mViewsField.get(mWindowManagerGlobal))); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
Source:
public List<Map<String, Object>> getServices(String applicationID) { List<Map<String, Object>> services = configAdminExt.listServices(getDefaultFactoryLdapFilter(), getDefaultLdapFilter()); List<Map<String, Object>> returnValues = new ArrayList<Map<String, Object>>(); if (!services.isEmpty()) { Application app = appService.getApplication(applicationID); if (app != null) { try { Set<BundleInfo> bundles = app.getBundles(); Set<String> bundleLocations = new HashSet<String>(); for (BundleInfo info : bundles) { bundleLocations.add(info.getLocation()); } for (Map<String, Object> service : services) { if (service.containsKey("configurations")) { List<Map<String, Object>> configurations = (List<Map<String, Object>>) service.get("configurations"); for (Map<String, Object> item : configurations) { if (item.containsKey("bundle_location")) { String bundleLocation = (String) item.get("bundle_location"); if (bundleLocations.contains(bundleLocation)) { returnValues.add(service); } } } } } } catch (ApplicationServiceException e) { logger.error("There was an error while trying to access the application", e); return new ArrayList<Map<String, Object>>(); } } } return returnValues; }

Target:
public List<Map<String, Object>> getServices(String applicationID) { List<Map<String, Object>> services = configAdminExt.listServices(getDefaultFactoryLdapFilter(), getDefaultLdapFilter()); List<Map<String, Object>> returnValues = new ArrayList<Map<String, Object>>(); if (!services.isEmpty()) { Application app = appService.getApplication(applicationID); MetaTypeService metatypeService = getMetaTypeService(); if (app != null) { try { Set<BundleInfo> bundles = app.getBundles(); Set<String> bundleLocations = new HashSet<String>(); Set<MetaTypeInformation> metatypeInformation = new HashSet<MetaTypeInformation>(); for (BundleInfo info : bundles) { bundleLocations.add(info.getLocation()); } for (Bundle bundle : this.bundleContext.getBundles()) { for (BundleInfo info : bundles) { if (info.getLocation().equals(bundle.getLocation())) { metatypeInformation.add(metatypeService.getMetaTypeInformation(bundle)); } } } for (Map<String, Object> service : services) { if (service.containsKey("configurations")) { List<Map<String, Object>> configurations = (List<Map<String, Object>>) service.get("configurations"); for (Map<String, Object> item : configurations) { if (item.containsKey("bundle_location")) { String bundleLocation = (String) item.get("bundle_location"); if (bundleLocations.contains(bundleLocation)) { returnValues.add(service); } } } } else { if (checkForMetaTypesForService(metatypeInformation, service)) { returnValues.add(service); } } } } catch (ApplicationServiceException e) { logger.warn("There was an error while trying to access the application", e); return new ArrayList<Map<String, Object>>(); } } } return returnValues; }
Source:
public MethodNode(String selector, List<VarRefNode> arguments, SequenceNode sequence) { this.objectName = null; this.selector = selector; this.arguments = arguments; this.sequence = sequence; }

Target:
public MethodNode(String selector, List<VarRefNode> arguments, SequenceNode sequence) { this.objectName = Optional.empty(); this.selector = selector; this.arguments = arguments; this.sequence = sequence; }
Source:
public void deleteSecretSeriesById(long id) { long now = OffsetDateTime.now().toEpochSecond(); dslContext.transaction(configuration -> { SecretsRecord r = DSL.using(configuration) .fetchOne(SECRETS, SECRETS.ID.eq(id).and(SECRETS.CURRENT.isNotNull())); if (r != null) { DSL.using(configuration) .update(SECRETS) .set(SECRETS.NAME, transformNameForDeletion(r.getName())) .set(SECRETS.CURRENT, (Long) null) .set(SECRETS.UPDATEDAT, now) .where(SECRETS.ID.eq(id)) .execute(); DSL.using(configuration) .delete(ACCESSGRANTS) .where(ACCESSGRANTS.SECRETID.eq(id)) .execute(); } }); }

Target:
public void deleteSecretSeriesById(long id) { long now = OffsetDateTime.now().toEpochSecond(); dslContext.transaction(configuration -> { SecretsRecord r = DSL.using(configuration) .select() .from(SECRETS) .where(SECRETS.ID.eq(id).and(SECRETS.CURRENT.isNotNull())) .forUpdate() .fetchOneInto(SECRETS); if (r != null) { DSL.using(configuration) .update(SECRETS) .set(SECRETS.NAME, transformNameForDeletion(r.getName())) .set(SECRETS.CURRENT, (Long) null) .set(SECRETS.UPDATEDAT, now) .where(SECRETS.ID.eq(id)) .execute(); DSL.using(configuration) .delete(ACCESSGRANTS) .where(ACCESSGRANTS.SECRETID.eq(id)) .execute(); } }); }
Source:
public boolean removeAcl(OzoneObj obj, OzoneAcl acl) throws IOException { Objects.requireNonNull(obj); Objects.requireNonNull(acl); if (!obj.getResourceType().equals(OzoneObj.ResourceType.BUCKET)) { throw new IllegalArgumentException("Unexpected argument passed to " + "BucketManager. OzoneObj type:" + obj.getResourceType()); } String volume = obj.getVolumeName(); String bucket = obj.getBucketName(); metadataManager.getLock().acquireBucketLock(volume, bucket); try { String dbBucketKey = metadataManager.getBucketKey(volume, bucket); OmBucketInfo bucketInfo = metadataManager.getBucketTable().get(dbBucketKey); if (bucketInfo == null) { LOG.debug("Bucket:{}/{} does not exist", volume, bucket); throw new OMException("Bucket " + bucket + " is not found", BUCKET_NOT_FOUND); } for(OzoneAcl a: bucketInfo.getAcls()) { if(a.getName().equals(acl.getName()) && a.getType().equals(acl.getType())) { BitSet bits = (BitSet) acl.getAclBitSet().clone(); bits.and(a.getAclBitSet()); if (bits.equals(ZERO_BITSET)) { return false; } bits = (BitSet) acl.getAclBitSet().clone(); bits.and(a.getAclBitSet()); a.getAclBitSet().xor(bits); if(a.getAclBitSet().equals(ZERO_BITSET)) { bucketInfo.getAcls().remove(a); } break; } } metadataManager.getBucketTable().put(dbBucketKey, bucketInfo); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Remove acl operation failed for bucket:{}/{} acl:{}", volume, bucket, acl, ex); } throw ex; } finally { metadataManager.getLock().releaseBucketLock(volume, bucket); } return true; }

Target:
public boolean removeAcl(OzoneObj obj, OzoneAcl acl) throws IOException { Objects.requireNonNull(obj); Objects.requireNonNull(acl); if (!obj.getResourceType().equals(OzoneObj.ResourceType.BUCKET)) { throw new IllegalArgumentException("Unexpected argument passed to " + "BucketManager. OzoneObj type:" + obj.getResourceType()); } String volume = obj.getVolumeName(); String bucket = obj.getBucketName(); metadataManager.getLock().acquireBucketLock(volume, bucket); try { String dbBucketKey = metadataManager.getBucketKey(volume, bucket); OmBucketInfo bucketInfo = metadataManager.getBucketTable().get(dbBucketKey); if (bucketInfo == null) { LOG.debug("Bucket:{}/{} does not exist", volume, bucket); throw new OMException("Bucket " + bucket + " is not found", BUCKET_NOT_FOUND); } for(OzoneAcl a: bucketInfo.getAcls()) { if(a.getName().equals(acl.getName()) && a.getType().equals(acl.getType())) { BitSet bits = (BitSet) acl.getAclBitSet().clone(); bits.and(a.getAclBitSet()); if (bits.equals(ZERO_BITSET)) { return false; } bits = (BitSet) acl.getAclBitSet().clone(); bits.and(a.getAclBitSet()); a.getAclBitSet().xor(bits); if(a.getAclBitSet().equals(ZERO_BITSET)) { bucketInfo.getAcls().remove(a); } break; } else { return false; } } metadataManager.getBucketTable().put(dbBucketKey, bucketInfo); } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.error("Remove acl operation failed for bucket:{}/{} acl:{}", volume, bucket, acl, ex); } throw ex; } finally { metadataManager.getLock().releaseBucketLock(volume, bucket); } return true; }
Source:
private Message decodeDelivery(Delivery delivery) { ExtendedAmqpMessage extendedAmqpMessage = null; final Message response = Proton.message(); final int msgSize = delivery.pending(); final byte[] buffer = new byte[msgSize]; final int read = receiveLink.recv(buffer, 0, msgSize); response.decode(buffer, 0, read); if (senderSettleMode == SenderSettleMode.SETTLED) { delivery.disposition(Accepted.getInstance()); delivery.settle(); extendedAmqpMessage = new ExtendedAmqpMessage(response, null); } else { extendedAmqpMessage = new ExtendedAmqpMessage(response, ByteBuffer.wrap(delivery.getTag())); } return extendedAmqpMessage; }

Target:
private Message decodeDelivery(Delivery delivery) { final Message response = Proton.message(); final int msgSize = delivery.pending(); final byte[] buffer = new byte[msgSize]; final int read = receiveLink.recv(buffer, 0, msgSize); response.decode(buffer, 0, read); if (this.senderSettleMode == SenderSettleMode.SETTLED) { delivery.disposition(Accepted.getInstance()); delivery.settle(); } return response; }
Source:
public void initChecker() { @Nullable Trees trees = Trees.instance(processingEnv); assert trees != null; this.trees = trees; this.messager = processingEnv.getMessager(); this.messagesProperties = getMessagesProperties(); this.visitor = createSourceVisitor(); this.activeLints = createActiveLints(getOptions()); }

Target:
public void initChecker() { @Nullable Trees trees = Trees.instance(processingEnv); assert trees != null; this.trees = trees; this.messager = processingEnv.getMessager(); this.messagesProperties = getMessagesProperties(); this.visitor = createSourceVisitor(); if (this.activeLints == null) { this.activeLints = createActiveLints(getOptions()); } }
Source:
private void doOpenSelectionDialog(FormEntry entry) { FilteredSchemaAttributeSelectionDialog dialog = new FilteredSchemaAttributeSelectionDialog(PDEPlugin.getActiveWorkbenchShell()); int status = dialog.open(); if (status == Window.OK) { Object[] selectedAttributes = dialog.getResult(); StringBuilder result = new StringBuilder(); for (Object object : selectedAttributes) { if (object instanceof ISchemaAttribute) { ISchemaAttribute attribute = (ISchemaAttribute) object; String id = PDESchemaHelper.getReferenceIdentifier(attribute); if (result.length() > 0) result.append(","); result.append(id); } } entry.setValue(result.toString()); entry.commit(); } }

Target:
private void doOpenSelectionDialog(FormEntry entry) { FilteredSchemaAttributeSelectionDialog dialog = new FilteredSchemaAttributeSelectionDialog(PDEPlugin.getActiveWorkbenchShell()); int status = dialog.open(); if (status == Window.OK) { Object[] selectedAttributes = dialog.getResult(); StringBuilder result = new StringBuilder(); for (Object object : selectedAttributes) { if (object instanceof ISchemaAttribute) { ISchemaAttribute attribute = (ISchemaAttribute) object; String id = PDESchemaHelper.getReferenceIdentifier(attribute); if (result.length() > 0) { result.append(","); } result.append(id); } } entry.setValue(result.toString()); entry.commit(); } }
Source:
public VoidResponse downloadWithResponse(OutputStream stream, BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout, Context context) { Mono<VoidResponse> download = blobAsyncClient .downloadWithResponse(range, options, accessConditions, rangeGetContentMD5, context) .flatMapMany(res -> res.getValue() .doOnNext(bf -> { try { WritableByteChannel channel = Channels.newChannel(stream); channel.write(bf); channel.close(); } catch (IOException e) { throw logger.logExceptionAsError(new UncheckedIOException(e)); } }).map(bf -> res)) .last() .map(VoidResponse::new); return Utility.blockWithOptionalTimeout(download, timeout); }

Target:
public Response<Void> downloadWithResponse(OutputStream stream, BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout, Context context) { Utility.assertNotNull("stream", stream); Mono<Response<Void>> download = blobAsyncClient .downloadWithResponse(range, options, accessConditions, rangeGetContentMD5, context) .flatMapMany(res -> res.getValue() .doOnNext(bf -> { try { stream.write(FluxUtil.byteBufferToArray(bf)); } catch (IOException e) { throw logger.logExceptionAsError(new UncheckedIOException(e)); } }).map(bf -> res)) .last() .map(response -> new SimpleResponse<>(response, null)); return Utility.blockWithOptionalTimeout(download, timeout); }
Source:
public String show(Request request, Response response) throws IOException { String pluginId = request.params("id"); CombinedPluginInfo pluginInfo = this.pluginInfoFinder.pluginInfoFor(pluginId); CombinedPluginInfo badPluginInfo = null; if (pluginInfo != null && hasUnsupportedExtensionType(pluginInfo)) { throw new RecordNotFoundException(notFoundMessage()); } if (pluginInfo == null) { GoPluginDescriptor pluginDescriptor = defaultPluginManager.getPluginDescriptorFor(pluginId); if (pluginDescriptor != null && pluginDescriptor.isInvalid()) { badPluginInfo = new CombinedPluginInfo(new BadPluginInfo(pluginDescriptor)); } } if (pluginInfo == null && badPluginInfo == null) { throw new RecordNotFoundException(notFoundMessage()); } CombinedPluginInfo extractedPluginInfo = badPluginInfo != null ? badPluginInfo : pluginInfo; String etag = etagFor(extractedPluginInfo); if (fresh(request, etag)) { return notModified(response); } setEtagHeader(response, etag); return writerForTopLevelObject(request, response, writer -> PluginInfoRepresenter.toJSON(writer, extractedPluginInfo)); }

Target:
public String show(Request request, Response response) throws IOException { String pluginId = request.params("id"); CombinedPluginInfo pluginInfo = this.pluginInfoFinder.pluginInfoFor(pluginId); if (pluginInfo == null) { GoPluginDescriptor pluginDescriptor = defaultPluginManager.getPluginDescriptorFor(pluginId); if (pluginDescriptor != null && pluginDescriptor.isInvalid()) { pluginInfo = new CombinedPluginInfo(new BadPluginInfo(pluginDescriptor)); } else { throw new RecordNotFoundException(notFoundMessage()); } } String etag = etagFor(pluginInfo); if (fresh(request, etag)) { return notModified(response); } setEtagHeader(response, etag); CombinedPluginInfo finalPluginInfo = pluginInfo; return writerForTopLevelObject(request, response, writer -> PluginInfoRepresenter.toJSON(writer, finalPluginInfo)); }
Source:
public boolean isNonCodedDrug() { return getDrugNonCoded() != null; }

Target:
public boolean isNonCodedDrug() { return StringUtils.isNotBlank(this.drugNonCoded); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } NewSpatialDimensionSchema that = (NewSpatialDimensionSchema) o; if (dims != null ? dims.equals(that.dims) : that.dims == null) { return true; } return this.delimiter.equals(that.delimiter); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } NewSpatialDimensionSchema that = (NewSpatialDimensionSchema) o; if (!super.equals(that)) { return false; } if (!Objects.equals(dims, that.dims)) { return false; } return this.delimiter.equals(that.delimiter); }
Source:
private void startClientAndTestPool(Configuration conf) throws Exception { Injector injector = Guice.createInjector( new ConfigModule(conf), new ZKModule(), new DiscoveryModules().getDistributedModules(), new TransactionModules().getDistributedModules(), new TransactionClientModule() ); ZKClientService zkClient = injector.getInstance(ZKClientService.class); zkClient.startAndWait(); final PooledClientProvider clientProvider = new PooledClientProvider(conf, injector.getInstance(DiscoveryServiceClient.class)); try (CloseableThriftClient closeableThriftClient = clientProvider.getCloseableClient()) { } List<Future<Integer>> clientIds = new ArrayList<Future<Integer>>(); ExecutorService executor = Executors.newFixedThreadPool(MAX_CLIENT_COUNT + 1); for (int i = 0; i < MAX_CLIENT_COUNT + 1; i++) { clientIds.add(executor.submit(new RetrieveClient(clientProvider, CLIENT_OBTAIN_TIMEOUT / 2))); } Set<Integer> ids = new HashSet<Integer>(); for (Future<Integer> id : clientIds) { ids.add(id.get()); } try { for (int i = 0; i < MAX_CLIENT_COUNT + 1; i++) { clientIds.add(executor.submit(new RetrieveClient(clientProvider, CLIENT_OBTAIN_TIMEOUT * 2))); } for (Future<Integer> clientId : clientIds) { clientId.get(); } Assert.fail(String.format("Expected one thread to not obtain a client within %s milliseconds.", CLIENT_OBTAIN_TIMEOUT)); } catch (ExecutionException expected) { Assert.assertEquals(TimeoutException.class, expected.getCause().getClass()); } executor.shutdown(); Assert.assertEquals(MAX_CLIENT_COUNT, ids.size()); }

Target:
private void startClientAndTestPool(Configuration conf) throws Exception { Injector injector = Guice.createInjector( new ConfigModule(conf), new ZKModule(), new DiscoveryModules().getDistributedModules(), new TransactionModules().getDistributedModules(), new TransactionClientModule() ); ZKClientService zkClient = injector.getInstance(ZKClientService.class); zkClient.startAndWait(); final PooledClientProvider clientProvider = new PooledClientProvider(conf, injector.getInstance(DiscoveryServiceClient.class)); try (CloseableThriftClient closeableThriftClient = clientProvider.getCloseableClient()) { } List<Future<Integer>> clientIds = new ArrayList<Future<Integer>>(); ExecutorService executor = Executors.newFixedThreadPool(MAX_CLIENT_COUNT + 1); for (int i = 0; i < MAX_CLIENT_COUNT + 1; i++) { clientIds.add(executor.submit(new RetrieveClient(clientProvider, CLIENT_OBTAIN_TIMEOUT / 2))); } Set<Integer> ids = new HashSet<Integer>(); for (Future<Integer> id : clientIds) { ids.add(id.get()); } Assert.assertEquals(MAX_CLIENT_COUNT, ids.size()); for (int i = 0; i < MAX_CLIENT_COUNT + 1; i++) { clientIds.add(executor.submit(new RetrieveClient(clientProvider, CLIENT_OBTAIN_TIMEOUT * 2))); } int numTimeoutExceptions = 0; for (Future<Integer> clientId : clientIds) { try { clientId.get(); } catch (ExecutionException expected) { Assert.assertEquals(TimeoutException.class, expected.getCause().getClass()); numTimeoutExceptions++; } } Assert.assertEquals(String.format("Expected one thread to not obtain a client within %s milliseconds.", CLIENT_OBTAIN_TIMEOUT), 1, numTimeoutExceptions); executor.shutdown(); }
Source:
public static void deleteFile(String name) { File file = files.get(name + XML_EXTENSION); if (file == null) { return; } file.delete(); }

Target:
public static void deleteFile(String name) { Map<String, File> files = listFile(); File file = files.get(name); if (file == null) { return; } file.delete(); }
Source:
private void generateRequestInterface(Method method) { generateDoc(method); String request = getRequestName(method); String response = getResponseName(method); javaBuffer.addLine("public interface %1$s extends Request<%1$s, %2$s> {", request, response); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateRequestParameterInterface); javaBuffer.addImport(Map.class); javaBuffer.addDocComment("Additional HTTP headers."); javaBuffer.addLine("%1s headers(Map<String, String> headers);", request); javaBuffer.addDocComment("Additional URL query parameters."); javaBuffer.addLine("%1s query(Map<String, String> query);", request); javaBuffer.addLine("}"); javaBuffer.addLine(); }

Target:
private void generateRequestInterface(Method method) { generateDoc(method); String request = getRequestName(method); String response = getResponseName(method); javaBuffer.addLine("public interface %1$s extends Request<%1$s, %2$s> {", request, response); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateRequestParameterInterface); javaBuffer.addLine("}"); javaBuffer.addLine(); }
Source:
private static Expression convertRow(Row expression) { List<Expression> fields = IntStream.range(0, expression.getArity()) .mapToObj(expression::getField) .map(ApiExpressionUtils::objectToExpression) .collect(Collectors.toList()); return ApiExpressionUtils.unresolvedCall(BuiltInFunctionDefinitions.ROW, fields); }

Target:
private static Expression convertRow(Row expression) { List<Expression> fields = IntStream.range(0, expression.getArity()) .mapToObj(expression::getField) .map(ApiExpressionUtils::objectToExpression) .collect(Collectors.toList()); return unresolvedCall(BuiltInFunctionDefinitions.ROW, fields); }
Source:
public void testSmallList() { int testSize = 100; doTestIntList(testSize); }

Target:
public void testSmallList() { int testSize = IntList.INITIAL_SLAB_SIZE - 100; doTestIntList(testSize, IntList.INITIAL_SLAB_SIZE); }
Source:
public void testAddDeleteUser() { UserApi userApi = api.getUserApi().get(); Set<? extends User> initialUsers = userApi.list().concat().toSet(); String randUser = "test_user_" + UUID.randomUUID().toString(); String email = "test@testmail.tm"; String password = "secrete"; User newUser = userApi.add(randUser, email, true, password); Set<? extends User> newUsers = userApi.list().concat().toSet(); assertTrue(newUsers.contains(newUser)); assertTrue(userApi.delete(newUser.getId())); Set<? extends User> finalUsers = userApi.list().concat().toSet(); assertEquals(initialUsers, finalUsers); }

Target:
public void testAddDeleteUser() { UserApi userApi = api.getUserApi().get(); Set<? extends User> initialUsers = userApi.list().concat().toSet(); String randUser = "test_user_" + UUID.randomUUID().toString(); String email = "test@testmail.tm"; String password = "secrete"; User newUser = userApi.create(randUser, email, true, password); Set<? extends User> newUsers = userApi.list().concat().toSet(); assertTrue(newUsers.contains(newUser)); assertTrue(userApi.delete(newUser.getId())); Set<? extends User> finalUsers = userApi.list().concat().toSet(); assertEquals(initialUsers, finalUsers); }
Source:
public void restoreRedundancyWithNoArgumentsRestoresRedundancyForAllRegions() { List<String> regionNames = getAllRegionNames(); createAndPopulateRegions(regionNames); int numberOfServers = servers.size(); regionNames.forEach(region -> locator .waitUntilRegionIsReadyOnExactlyThisManyServers(SEPARATOR + region, numberOfServers)); String command = new CommandStringBuilder(COMMAND_NAME).getCommandString(); CommandResultAssert commandResult = gfsh.executeAndAssertThat(command).statusIsSuccess() .hasNoSection(ZERO_REDUNDANCY_SECTION) .hasNoSection(UNDER_REDUNDANCY_SECTION); InfoResultModelAssert summary = commandResult.hasInfoSection(SUMMARY_SECTION); summary.hasOutput().contains(ZERO_REDUNDANT_COPIES + 0); summary.hasOutput().contains(PARTIALLY_SATISFIED_REDUNDANCY + 0); summary.hasOutput().contains(FULLY_SATISFIED_REDUNDANCY + regionNames.size()); InfoResultModelAssert satisfiedSection = commandResult.hasInfoSection(SATISFIED_REDUNDANCY_SECTION); satisfiedSection.hasHeader().isEqualTo(REDUNDANCY_SATISFIED_FOR_REGIONS); satisfiedSection.hasOutput().contains(regionNames); InfoResultModelAssert primariesSection = commandResult.hasInfoSection(PRIMARIES_INFO_SECTION); primariesSection.hasOutput().contains(PRIMARY_TRANSFERS_COMPLETED, PRIMARY_TRANSFER_TIME); int numberOfActiveServers = servers.size(); servers.get(0).invoke(() -> { for (String regionName : regionNames) { assertRedundancyStatusForRegion(regionName, true); assertPrimariesBalanced(regionName, numberOfActiveServers, true); } }); }

Target:
public void restoreRedundancyWithNoArgumentsRestoresRedundancyForAllRegions() { List<String> regionNames = getAllRegionNames(); createAndPopulateRegions(regionNames); int numberOfServers = servers.size(); regionNames.forEach(region -> locator .waitUntilRegionIsReadyOnExactlyThisManyServers(SEPARATOR + region, numberOfServers)); String command = new CommandStringBuilder(RESTORE_REDUNDANCY).getCommandString(); CommandResultAssert commandResult = gfsh.executeAndAssertThat(command).statusIsSuccess(); verifyGfshOutput(commandResult, new ArrayList<>(), new ArrayList<>(), regionNames); int numberOfActiveServers = servers.size(); servers.get(0).invoke(() -> { for (String regionName : regionNames) { assertRedundancyStatusForRegion(regionName, true); assertPrimariesBalanced(regionName, numberOfActiveServers, true); } }); }
Source:
protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = null; try { ref = context.getResolver().resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); } catch (ColumnNotFoundException e) { if (context.getCurrentTable().getTable().getIndexType() == IndexType.LOCAL) { try { return new LocalIndexDataColumnRef(context, node.getName()); } catch (ColumnFamilyNotFoundException c) { throw e; } } else { throw e; } } PTable table = ref.getTable(); int pkPosition = ref.getPKSlotPosition(); if (pkPosition >= 0) { boolean isSalted = table.getBucketNum() != null; boolean isMultiTenant = context.getConnection()==null ? table.isMultiTenant() : (context.getConnection().getTenantId() != null && table.isMultiTenant()); boolean isSharedViewIndex = table.getViewIndexId() != null; int minPosition = (isSalted ? 1 : 0) + (isMultiTenant ? 1 : 0) + (isSharedViewIndex ? 1 : 0); if (pkPosition < minPosition) { throw new ColumnNotFoundException(table.getSchemaName().getString(), table.getTableName().getString(), null, ref.getColumn().getName().getString()); } } return ref; }

Target:
protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = null; try { ref = context.getResolver().resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); } catch (ColumnNotFoundException e) { if (context.getCurrentTable().getTable().getIndexType() == IndexType.LOCAL) { try { return new LocalIndexDataColumnRef(context, node.getName()); } catch (ColumnFamilyNotFoundException c) { throw e; } } else { throw e; } } PTable table = ref.getTable(); int pkPosition = ref.getPKSlotPosition(); if (pkPosition >= 0) { boolean isSalted = table.getBucketNum() != null; boolean isMultiTenant = context.getConnection().getTenantId() != null && table.isMultiTenant(); boolean isSharedViewIndex = table.getViewIndexId() != null; int minPosition = (isSalted ? 1 : 0) + (isMultiTenant ? 1 : 0) + (isSharedViewIndex ? 1 : 0); if (pkPosition < minPosition) { throw new ColumnNotFoundException(table.getSchemaName().getString(), table.getTableName().getString(), null, ref.getColumn().getName().getString()); } } return ref; }
Source:
public String generateUserDelegationSas(UserDelegationKey delegationKey, String accountName, Context context) { StorageImplUtils.assertNotNull("delegationKey", delegationKey); StorageImplUtils.assertNotNull("accountName", accountName); ensureState(); final String canonicalName = getCanonicalName(accountName); final String stringToSign = stringToSign(delegationKey, canonicalName); if (context != null && Boolean.TRUE.equals(context.getData("Log-String-To-Sign").orElse(false))) { logger.info("The string to sign computed by the SDK is: {}{}", stringToSign, System.getProperty("line.separator")); logger.warning("Please remember to disable 'Log-String-To-Sign' before going to production as this " + "string can potentially contain PII."); } String signature = StorageImplUtils.computeHMac256(delegationKey.getValue(), stringToSign); return encode(delegationKey, signature); }

Target:
public String generateUserDelegationSas(UserDelegationKey delegationKey, String accountName, Context context) { StorageImplUtils.assertNotNull("delegationKey", delegationKey); StorageImplUtils.assertNotNull("accountName", accountName); ensureState(); final String canonicalName = getCanonicalName(accountName); final String stringToSign = stringToSign(delegationKey, canonicalName); StorageImplUtils.logStringToSign(logger, stringToSign, context); String signature = StorageImplUtils.computeHMac256(delegationKey.getValue(), stringToSign); return encode(delegationKey, signature); }
Source:
public Response updateChildrenBulk(@Context HttpServletRequest request, String content) { Response response; if (StringUtils.isNotBlank(content)) { try { JsonObject jsonObj = (JsonObject) new JsonParser().parse(content); Set<Entry<String, JsonElement>> entrySet = jsonObj.entrySet(); int itemCount = entrySet.size(); if (itemCount > 0) { Map<String, JsonObject> itemMap = new HashMap<>(itemCount); for (Entry<String, JsonElement> entry : entrySet) { itemMap.put(entry.getKey(), (JsonObject) entry.getValue()); } if (updateItemChildren(itemMap)) { response = Response.ok().build(); } else { response = Response.serverError().build(); } } else { log.error("Incoming content had no items"); response = Response.status(Response.Status.BAD_REQUEST).build(); } } catch (JsonSyntaxException ex) { log.error("Could not parse incoming content: {}", content, ex); response = Response.status(Response.Status.BAD_REQUEST).build(); } } else { log.error("Incoming content was empty"); response = Response.status(Response.Status.BAD_REQUEST).build(); } return response; }

Target:
public Response updateChildrenBulk(@Context HttpServletRequest request, String content) { Response response; if (StringUtils.isNotBlank(content)) { try { JsonObject jsonObj = (JsonObject) new JsonParser().parse(content); Set<Entry<String, JsonElement>> entrySet = jsonObj.entrySet(); int itemCount = entrySet.size(); if (itemCount > 0) { Map<String, JsonObject> itemMap = new HashMap<>(); for (Entry<String, JsonElement> entry : entrySet) { itemMap.put(entry.getKey(), (JsonObject) entry.getValue()); } if (updateItemChildren(itemMap)) { response = Response.ok().build(); } else { response = Response.serverError().build(); } } else { log.error("Incoming content had no items"); response = Response.status(Response.Status.BAD_REQUEST).build(); } } catch (JsonSyntaxException ex) { log.error("Could not parse incoming content: {}", content, ex); response = Response.status(Response.Status.BAD_REQUEST).build(); } } else { log.error("Incoming content was empty"); response = Response.status(Response.Status.BAD_REQUEST).build(); } return response; }
Source:
private DFUFilePartWrapper[] wrapAndResolveFileParts(DFUPartLocation[] fileLocations, DFUFilePart[] fileParts) throws Exception { if(fileLocations == null || fileLocations.length == 0) throw new Exception("Encountered empty DFU Part Locations array"); if(fileParts == null || fileParts.length == 0) throw new Exception("Encountered empty DFU Parts array"); Hashtable<Integer, String> availableLocations = new Hashtable<Integer, String>(fileLocations.length); for (int locationindex = 0; locationindex < fileLocations.length; locationindex++) { availableLocations.put(fileLocations[locationindex].getLocationIndex(), fileLocations[locationindex].getHost()); } int dataFilePartsCount = fileParts.length; if (fileType == DFUFileTypeWrapper.Index && dataFilePartsCount % availableLocations.size() != 0) { dataFilePartsCount--; } DFUFilePartWrapper wrappedDFUFileParts = new DFUFilePartWrapper[dataFilePartsCount]; for (int i = 0; i < dataFilePartsCount; i++) { Integer filepartindex = fileParts[i].getPartIndex(); if (filepartindex < 1 || filepartindex > dataFilePartsCount) throw new IndexOutOfBoundsException("Encountered invalid Filepart index: '" + filepartindex + "'"); if ( wrappedDFUFileParts[filepartindex-1] != null) throw new IndexOutOfBoundsException("Encountered duplicate Filepart copy index: '" + filepartindex + "'"); wrappedDFUFileParts[filepartindex-1] = new DFUFilePartWrapper(fileParts[i], availableLocations); } return wrappedDFUFileParts; }

Target:
private DFUFilePartWrapper[] wrapAndResolveFileParts(DFUPartLocation[] fileLocations, DFUFilePart[] fileParts) throws Exception { if(fileLocations == null || fileLocations.length == 0) throw new Exception("Encountered empty DFU Part Locations array"); if(fileParts == null || fileParts.length == 0) throw new Exception("Encountered empty DFU Parts array"); Hashtable<Integer, String> availableLocations = new Hashtable<Integer, String>(fileLocations.length); for (int locationindex = 0; locationindex < fileLocations.length; locationindex++) { availableLocations.put(fileLocations[locationindex].getLocationIndex(), fileLocations[locationindex].getHost()); } int dataFilePartsCount = fileParts.length; if (fileType == DFUFileTypeWrapper.Index && dataFilePartsCount % availableLocations.size() != 0) { dataFilePartsCount--; log.warn("Ignoring " + fileParts.length +"th filepart (determined to be indexed file top-level-key)"); } DFUFilePartWrapper wrappedDFUFileParts = new DFUFilePartWrapper[dataFilePartsCount]; for (int i = 0; i < dataFilePartsCount; i++) { Integer filepartindex = fileParts[i].getPartIndex(); if (filepartindex < 1 || filepartindex > dataFilePartsCount) throw new IndexOutOfBoundsException("Encountered invalid Filepart index: '" + filepartindex + "'"); if ( wrappedDFUFileParts[filepartindex-1] != null) throw new IndexOutOfBoundsException("Encountered duplicate Filepart copy index: '" + filepartindex + "'"); wrappedDFUFileParts[filepartindex-1] = new DFUFilePartWrapper(fileParts[i], availableLocations); } return wrappedDFUFileParts; }
Source:
protected void refresh(InterpreterContext context) { context.out().clear(); try { context.out.write("%table\n"); for (int i = 0; i < schema.getFieldCount(); ++i) { String field = schema.getFieldName(i).get(); context.out.write(field); if (i != (schema.getFieldCount() - 1)) { context.out.write("\t"); } } context.out.write("\n"); LOGGER.debug("*****************Row size: " + materializedTable.size()); materializedTable.sort((r1, r2) -> { String f1 = r1.getField(0).toString(); String f2 = r2.getField(0).toString(); return f1.compareTo(f2); }); for (Row row : materializedTable) { for (int i = 0; i < row.getArity(); ++i) { Object field = row.getField(i); context.out.write(field.toString()); if (i != (row.getArity() - 1)) { context.out.write("\t"); } } LOGGER.debug("Row:" + row); context.out.write("\n"); } context.out.write("\n%text "); context.out.flush(); } catch (IOException e) { e.printStackTrace(); LOGGER.error("Fail to refresh data", e); } }

Target:
protected void refresh(InterpreterContext context) { context.out().clear(); try { context.out.write("%table\n"); for (int i = 0; i < schema.getFieldCount(); ++i) { String field = schema.getFieldName(i).get(); context.out.write(field); if (i != (schema.getFieldCount() - 1)) { context.out.write("\t"); } } context.out.write("\n"); LOGGER.debug("*****************Row size: " + materializedTable.size()); materializedTable.sort((r1, r2) -> { String f1 = r1.getField(0).toString(); String f2 = r2.getField(0).toString(); return f1.compareTo(f2); }); for (Row row : materializedTable) { for (int i = 0; i < row.getArity(); ++i) { Object field = row.getField(i); context.out.write(field.toString()); if (i != (row.getArity() - 1)) { context.out.write("\t"); } } context.out.write("\n"); } context.out.flush(); } catch (IOException e) { LOGGER.error("Fail to refresh data", e); } }
Source:
public void logout() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.logout_message) .setPositiveButton(R.string.action_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { PrefManager.clearToken(); startActivity(new Intent(MifosBaseActivity.this, SplashScreenActivity.class )); finish(); } }) .setNegativeButton(R.string.action_no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }).create().show(); }

Target:
public void logout() { new MaterialDialog.Builder().init(MifosBaseActivity.this) .setMessage(R.string.dialog_logout) .setPositiveButton(getString(R.string.logout), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { PrefManager.clearPrefs(); startActivity(new Intent(MifosBaseActivity.this, SplashScreenActivity.class)); finish(); } }) .setNegativeButton(getString(R.string.cancel)) .createMaterialDialog() .show(); }
Source:
public void fetchAllExternalIdsWithUniformPageSizes() throws Exception { final Function<List<Category>, List<String>> externalIdCallBack = categories -> categories.stream() .map(Category::getExternalId) .collect(toList()); final CompletionStage<List<List<String>>> categoryPagesStage = QueryExecutionUtils .queryAll(client(), CategoryQuery.of(), externalIdCallBack, 3); final List<List<String>> categoryPages = SphereClientUtils .blockingWait(categoryPagesStage, Duration.ofMinutes(5)); assertThat(categoryPages).hasSize(5); final List<String> externalIds = categoryPages.stream() .flatMap(List::stream) .collect(toList()); assertThat(externalIds).hasSize(15); IntStream.range(0, externalIds.size()).forEach(index -> assertThat(externalIds).contains(index + "")); }

Target:
public void fetchAllExternalIdsWithUniformPageSizes() throws Exception { final CompletionStage<List<String>> categoriesStage = QueryExecutionUtils .queryAll(client(), CategoryQuery.of(), Category::getExternalId, 3); final List<String> externalIds = SphereClientUtils .blockingWait(categoriesStage, Duration.ofMinutes(1)); assertThat(externalIds).hasSize(15); IntStream.range(0, externalIds.size()).forEach(index -> assertThat(externalIds).contains(index + "")); }
Source:
public String evidenceMessage( TokenNameLookup tokenNameLookup, LabelSchemaDescriptor schema ) { assert schema.getPropertyIds().length == propertyValues.values().length; String labelName = tokenNameLookup.labelGetName( schema.getLabelId() ); if ( addedNodeId == NO_SUCH_NODE ) { return format( "Node(%d) already exists with label `%s` and %s", existingNodeId, labelName, propertyString( tokenNameLookup, schema.getPropertyIds() ) ); } else { return format( "Both Node(%d) and Node(%d) have the label `%s` and %s", existingNodeId, addedNodeId, labelName, propertyString( tokenNameLookup, schema.getPropertyIds() ) ); } }

Target:
public String evidenceMessage( TokenNameLookup tokenNameLookup, LabelSchemaDescriptor schema ) { assert schema.getPropertyIds().length == propertyValues.size(); String labelName = tokenNameLookup.labelGetName( schema.getLabelId() ); if ( addedNodeId == NO_SUCH_NODE ) { return format( "Node(%d) already exists with label `%s` and %s", existingNodeId, labelName, propertyString( tokenNameLookup, schema.getPropertyIds() ) ); } else { return format( "Both Node(%d) and Node(%d) have the label `%s` and %s", existingNodeId, addedNodeId, labelName, propertyString( tokenNameLookup, schema.getPropertyIds() ) ); } }
Source:
public void testUpdateWithReturnEntity() { final Person updated = new Person(TEST_PERSON.getId(), UPDATED_FIRST_NAME, TEST_PERSON.getLastName(), TEST_PERSON.getHobbies(), TEST_PERSON.getShippingAddresses()); final Person updatedPerson = cosmosTemplate.upsertAndReturnEntity(Person.class.getSimpleName(), updated); final Person findPersonById = cosmosTemplate.findById(Person.class.getSimpleName(), updatedPerson.getId(), Person.class); assertEquals(updatedPerson, updated); }

Target:
public void testUpdateWithReturnEntity() { final Person updated = new Person(TEST_PERSON.getId(), UPDATED_FIRST_NAME, TEST_PERSON.getLastName(), TEST_PERSON.getHobbies(), TEST_PERSON.getShippingAddresses()); updated.set_etag(insertedPerson.get_etag()); final Person updatedPerson = cosmosTemplate.upsertAndReturnEntity(Person.class.getSimpleName(), updated); final Person findPersonById = cosmosTemplate.findById(Person.class.getSimpleName(), updatedPerson.getId(), Person.class); assertEquals(updatedPerson, updated); assertThat(updatedPerson.get_etag()).isEqualTo(findPersonById.get_etag()); }
Source:
public void testPrintTreeJavadocOption() throws Exception { final String expected = new String(Files.readAllBytes(Paths.get( getNonPackagePath("astprinter/expectedInputJavadocComment.txt"))), StandardCharsets.UTF_8) .replaceAll("\\\\r\\\\n", "\\\\n"); exit.checkAssertionAfterwards(() -> { assertEquals(expected, systemOut.getLog().replaceAll("\\\\r\\\\n", "\\\\n")); assertEquals("", systemErr.getLog()); }); Main.main("-j", getNonPackagePath("astprinter/InputJavadocComment.javadoc")); }

Target:
public void testPrintTreeJavadocOption() throws Exception { final String expected = new String(Files.readAllBytes(Paths.get( getPath("InputMainExpectedInputJavadocComment.txt"))), StandardCharsets.UTF_8) .replaceAll("\\\\r\\\\n", "\\\\n"); exit.checkAssertionAfterwards(() -> { assertEquals(expected, systemOut.getLog().replaceAll("\\\\r\\\\n", "\\\\n")); assertEquals("", systemErr.getLog()); }); Main.main("-j", getPath("InputMainJavadocComment.javadoc")); }