auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void assignResourceRequests() { while (hasReadyPendingRequest()) { SamzaResourceRequest request = peekReadyPendingRequest().get(); String processorId = request.getProcessorId(); String preferredHost = hostAffinityEnabled ? request.getPreferredHost() : ResourceRequestState.ANY_HOST; Instant requestCreationTime = request.getRequestTimestamp(); <START> <END> LOG.info("Handling assignment request for Processor ID: on host: {}.", processorId, preferredHost); if (hasAllocatedResource(preferredHost)) { LOG.info("Found an available container for Processor ID: on the host: {}", processorId, preferredHost); if (hostAffinityEnabled) { state.matchedResourceRequests.incrementAndGet(); } if (this.standbyContainerManager.isPresent()) { standbyContainerManager.get().checkStandbyConstraintsAndRunStreamProcessor(request, preferredHost, peekAllocatedResource(preferredHost), this, resourceRequestState); } else { runStreamProcessor(request, preferredHost); } } else { LOG.info("Did not find any allocated containers for running Processor ID: on the host: {}.", processorId, preferredHost); boolean expired = isRequestExpired(request); if (expired) { updateExpiryMetrics(request); if (hostAffinityEnabled) { handleExpiredRequestWithHostAffinityEnabled(processorId, preferredHost, request); } } else { LOG.info("Request for Processor ID: on preferred host has not expired yet." + "Request creation time: {}. Current Time: {}. Request timeout: ms", processorId, preferredHost, requestCreationTime, System.currentTimeMillis(), requestTimeout); break; } } } }</code><technical_language>whitespace</technical_language>

Target:
void assignResourceRequests() { while (hasReadyPendingRequest()) { SamzaResourceRequest request = peekReadyPendingRequest().get(); String processorId = request.getProcessorId(); String preferredHost = hostAffinityEnabled ? request.getPreferredHost() : ResourceRequestState.ANY_HOST; Instant requestCreationTime = request.getRequestTimestamp(); LOG.info("Handling assignment request for Processor ID: on host: {}.", processorId, preferredHost); if (hasAllocatedResource(preferredHost)) { LOG.info("Found an available container for Processor ID: on the host: {}", processorId, preferredHost); if (hostAffinityEnabled) { state.matchedResourceRequests.incrementAndGet(); } if (this.standbyContainerManager.isPresent()) { checkStandByContrainsAndRunStreamProcessor(request, preferredHost); } else { runStreamProcessor(request, preferredHost); } } else { LOG.info("Did not find any allocated containers for running Processor ID: on the host: {}.", processorId, preferredHost); boolean expired = isRequestExpired(request); if (expired) { updateExpiryMetrics(request); if (hostAffinityEnabled) { handleExpiredRequestWithHostAffinityEnabled(processorId, preferredHost, request); } } else { LOG.info("Request for Processor ID: on preferred host has not expired yet." + "Request creation time: {}. Current Time: {}. Request timeout: ms", processorId, preferredHost, requestCreationTime, System.currentTimeMillis(), requestExpiryTimeout); break; } } } }
Source:
<code>public void before() { Locale.setDefault(ENGLISH); if (System.getProperty("java.specification.version").equals("9")) { <START> expected_formatted_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rss version=\"2.0\">\n <channel>\n" <END> + " <title>Java Tutorials and Examples 1</title>\n" + " <language>en-us</language>\n" + " </channel>\n</rss>\n"; } else { expected_formatted_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\">\n <channel>\n" + " <title>Java Tutorials and Examples 1</title>\n" + " <language>en-us</language>\n" + " </channel>\n</rss>\n"; } }</code><technical_language>formatting: put <channel>\n a new line</technical_language>

Target:
public void before() { Locale.setDefault(ENGLISH); if (System.getProperty("java.specification.version").equals("9")) { expected_formatted_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rss version=\"2.0\">\n" + " <channel>\n" + " <title>Java Tutorials and Examples 1</title>\n" + " <language>en-us</language>\n" + " </channel>\n" + "</rss>\n"; } else { expected_formatted_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<rss version=\"2.0\">\n" + " <channel>\n" + " <title>Java Tutorials and Examples 1</title>\n" + " <language>en-us</language>\n" + " </channel>\n" + "</rss>\n"; } }
Source:
<code><START> public void setVisibility(Visibility visibility) { <END> this.visibility = visibility; }</code><technical_language>this protected expose Accumulo implementation package private in AccumuloEdge AccumuloVertex. people calling setVisibility Elements</technical_language>

Target:
protected void setVisibility(Visibility visibility) { this.visibility = visibility; }
Source:
<code>public SSymbol(final String value) { string = value; numberOfSignatureArguments = determineNumberOfSignatureArguments(); <START> symbolId = (short) idGenerator.getAndIncrement(); <END> if (VmSettings.ACTOR_TRACING) { ActorExecutionTrace.logSymbol(symbolId, string); } }</code><technical_language>in if (VmSettings.ACTOR_TRACING) {</technical_language>

Target:
public SSymbol(final String value) { string = value; numberOfSignatureArguments = determineNumberOfSignatureArguments(); if (VmSettings.ACTOR_TRACING) { symbolId = (short) idGenerator.getAndIncrement(); ActorExecutionTrace.logSymbol(this); } else { symbolId = 0; } }
Source:
<code>public void process() { if (RecordAndReplayUtils.getRecordAndReplayStatus() == RecordAndReplayStatus.REPLAYING && !this.loadedRecordedEvents) { fillRecordedEvents(); this.loadedRecordedEvents = true; logger.info("Loaded Recorded Events!"); startTime = System.currentTimeMillis(); } if (RecordAndReplayUtils.getRecordAndReplayStatus() == RecordAndReplayStatus.REPLAYING) { processRecordedEvents(10); if (this.recordedEvents.isEmpty()) { if (RecordAndReplayUtils.getFileCount() <= RecordAndReplayUtils.getFileAmount()) { String recordingPath = PathManager.getInstance().getRecordingPath(RecordAndReplayUtils.getGameTitle()).toString(); RecordAndReplaySerializer.deserializeRecordedEvents(recordingPath); fillRecordedEvents(); } else { RecordAndReplayUtils.reset(); RecordedEventStore.popEvents(); RecordAndReplayUtils.setRecordAndReplayStatus(RecordAndReplayStatus.REPLAY_FINISHED); } } } <START> for (PendingEvent event = pendingEvents.poll(); event != null; event = pendingEvents.poll()) { <END> if (event.getComponent() != null) { originalSend(event.getEntity(), event.getEvent(), event.getComponent()); } else { originalSend(event.getEntity(), event.getEvent()); } } }</code><technical_language>personal preference is more explicit while loops for loops in cases involving _definite_ iteration</technical_language>

Target:
public void process() { processRecordedEvents(); PendingEvent event = pendingEvents.poll(); while (event != null) { if (event.getComponent() != null) { originalSend(event.getEntity(), event.getEvent(), event.getComponent()); } else { originalSend(event.getEntity(), event.getEvent()); } event = pendingEvents.poll(); } }
Source:
<code>public Text getService() { if (OM_SERVICE_ADD.get() == null) { OM_SERVICE_ADD.compareAndSet(null, <START> SecurityUtil.buildTokenService(OmUtils.getOmAddressForClients(conf))); <END> } return OM_SERVICE_ADD.get(); }</code><technical_language>HA, getOmAddressForClients, this takes om address ozone.om.address. So, do need find leader OM set it. complete context security, this is used. So, want this works</technical_language>

Target:
public Text getService() { return omServiceAdd; }
Source:
<code>protected List<Context> getContexts() { Context ctx = getContext(); <START> return ctx == null ? null : new ArrayList<Context>(Arrays.asList(ctx)); <END> }</code><technical_language>return empty list instead, avoid null checks. - wrap in ArrayList is necessary</technical_language>

Target:
protected List<Context> getContexts() { Context ctx = getContext(); return ctx == null ? Collections.emptyList() : Arrays.asList(ctx); }
Source:
<code>public void testAnalysisExecution() { assertNull(fModule.getStateSystem()); <START> IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(NonNullUtils.checkNotNull(fTrace), TidAnalysisModule.class, TidAnalysisModule.ID); <END> assertNotNull(module); module.schedule(); module.waitForCompletion(); assertTrue(TmfTestHelper.executeAnalysis(fModule)); assertNotNull(fModule.getStateSystem()); }</code><technical_language>I ITmfTrace trace = ftrace; assertNotNull(trace);getAnalModOfCl(trace..)</technical_language>

Target:
public void testAnalysisExecution() { assertNull(fModule.getStateSystem()); ITmfTrace trace = fTrace; assertNotNull(trace); IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, TidAnalysisModule.class, TidAnalysisModule.ID); assertNotNull(module); module.schedule(); module.waitForCompletion(); assertTrue(TmfTestHelper.executeAnalysis(fModule)); assertNotNull(fModule.getStateSystem()); }
Source:
<code>private static void addBootOrder(VmDevice vmDevice, Map<String, Object> struct) { <START> String s = Integer.valueOf(vmDevice.getBootOrder()).toString(); <END> if (!org.apache.commons.lang.StringUtils.isEmpty(s) && !s.equals("0")) { struct.put(VdsProperties.BootOrder, s); } }</code><technical_language>Instead of Integer.valueOf(int).toString(), String.valueOf(int)</technical_language>

Target:
private static void addBootOrder(VmDevice vmDevice, Map<String, Object> struct) { String s = String.valueOf(vmDevice.getBootOrder()); if (!org.apache.commons.lang.StringUtils.isEmpty(s) && !s.equals("0")) { struct.put(VdsProperties.BootOrder, s); } }
Source:
<code>protected IsWidget createIcon() { Span iconSpan = new Span(); iconSpan.addStyleName(Styles.FONT_AWESOME_BASE); if (SnapshotStatus.IN_PREVIEW.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.EYE.getCssName()); } else if (SnapshotStatus.LOCKED.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.LOCK.getCssName()); } else if (getEntity().containsMemory()) { Span holder = new <START> Span(); <END> holder.setStyleName(Styles.ICON_STACK); holder.getElement().getStyle().setLeft(-0.2, Style.Unit.EM); holder.getElement().getStyle().setTop(-0.2, Style.Unit.EM); Italic cameraItalic = new Italic(); cameraItalic.addStyleName(Styles.FONT_AWESOME_BASE); cameraItalic.addStyleName(IconType.CAMERA.getCssName()); cameraItalic.getElement().getStyle().setFontSize(1, Style.Unit.EM); Italic memoryItalic = new Italic(); memoryItalic.addStyleName(Styles.FONT_AWESOME_BASE); memoryItalic.addStyleName(Styles.ICON_STACK_TOP); memoryItalic.addStyleName(PatternflyConstants.PFICON_MEMORY); memoryItalic.getElement().getStyle().setTop(-4, Style.Unit.PX); memoryItalic.getElement().getStyle().setLeft(18, Style.Unit.PX); memoryItalic.getElement().getStyle().setColor("#0088ce"); memoryItalic.getElement().getStyle().setFontSize(11, Style.Unit.PX); memoryItalic.getElement().getStyle().setWhiteSpace(Style.WhiteSpace.NOWRAP); holder.add(cameraItalic); holder.add(memoryItalic); Tooltip memoryInfoToolTip = new Tooltip(memoryItalic); memoryInfoToolTip.setTitle(constants.thisSnapshotContainsMemory()); memoryInfoToolTip.setPlacement(Placement.RIGHT); holder.add(memoryInfoToolTip); iconSpan.add(holder); } else { iconSpan.addStyleName(IconType.CAMERA.getCssName()); } iconSpan.addStyleName(PatternflyConstants.PF_LIST_VIEW_ICON_SM); iconPanel.add(iconSpan); return iconPanel; }</code><technical_language>wrap this new section a private function returning Span object change small much: iconSpan.add(createSnapshotWithMemoryIconSpan())</technical_language>

Target:
protected IsWidget createIcon() { Span iconSpan = new Span(); iconSpan.addStyleName(Styles.FONT_AWESOME_BASE); if (SnapshotStatus.IN_PREVIEW.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.EYE.getCssName()); } else if (SnapshotStatus.LOCKED.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.LOCK.getCssName()); } else if (getEntity().containsMemory()) { iconSpan.add(createSnapshotWithMemoryIcon()); } else { iconSpan.addStyleName(IconType.CAMERA.getCssName()); } iconSpan.addStyleName(PatternflyConstants.PF_LIST_VIEW_ICON_SM); iconPanel.add(iconSpan); return iconPanel; }
Source:
<code>public void appendConstraints(AllocationAttempt attempt, AllocationLog log, List<Constraint> constraints) { Instance instance = attempt.getInstance(); if (instance == null) { return; } @SuppressWarnings("unchecked") Map<String, String> labels = DataAccessor.fields(instance).withKey(InstanceConstants.FIELD_LABELS) .as(Map.class); if (labels == null) { return; } for (Map.Entry<String, String> labelEntry : labels.entrySet()) { String labelKey = labelEntry.getKey(); <START> if (labelKey.startsWith("io.rancher.scheduler.disksize.")) { <END> String labelValue = labelEntry.getValue(); String key = labelKey.substring("io.rancher.scheduler.disksize.".length()); constraints.add(new DiskSizeConstraint(key, labelValue, objectManager)); } } }</code><technical_language>define label prefix in SystemLabels class, reference</technical_language>

Target:
public void appendConstraints(AllocationAttempt attempt, AllocationLog log, List<Constraint> constraints) { Instance instance = attempt.getInstance(); if (instance == null) { return; } @SuppressWarnings("unchecked") Map<String, String> labels = DataAccessor.fields(instance).withKey(InstanceConstants.FIELD_LABELS) .as(Map.class); if (labels == null) { return; } for (Map.Entry<String, String> labelEntry : labels.entrySet()) { String labelKey = labelEntry.getKey(); String labelPrefix = SystemLabels.LABEL_SCHEDULER_DISKSIZE_PREFIX; if (labelKey.startsWith(labelPrefix) && labelKey.length() > labelPrefix.length()) { String key = labelKey.substring(SystemLabels.LABEL_SCHEDULER_DISKSIZE_PREFIX.length()); String labelValue = labelEntry.getValue(); constraints.add(new DiskSizeConstraint(key, labelValue, objectManager)); } } }
Source:
<code>public Image getImage(Object element) { if (element instanceof IReviewItem) { IReviewItem item = (IReviewItem) element; Image image = ReviewsUiPlugin.getDefault().getImageManager().getFileImage(item.getName()); if (element instanceof IFileItem) { ImageDescriptor baseImage = ImageDescriptor.createFromImage(image); IFileItem fItem = (IFileItem) element; if (fItem.getBase() != null && fItem.getTarget() != null) { IFileRevision base = fItem.getBase(); IFileRevision target = fItem.getTarget(); if (base.getPath() == null && target.getPath() != null) { ImageDescriptor overlay = ReviewsImages.OVERLAY_ADDED; Image icon = CommonImages.getImageWithOverlay(baseImage, overlay, true, true); return icon; } else if (base.getPath() != null && target.getPath() == null) { ImageDescriptor overlay = ReviewsImages.OVERLAY_REMOVED; <START> Image icon = CommonImages.getImageWithOverlay(baseImage, overlay, true, true); <END> return icon; } } } return image; } return null; }</code><technical_language>false, false. I want in right corner here</technical_language>

Target:
public Image getImage(Object element) { if (element instanceof IReviewItem) { return super.getImage(element); } return null; }
Source:
<code>protected void executeQueryCommand() { Provider<?> provider = getDbFacade().getProviderDao().get(getParameters().getId()); if (provider == null) { return; } NetworkProviderProxy client = getProviderProxyFactory().create(provider); List<Network> externalNetworks = client.getAll(); Map<Network, Set<Guid>> externalNetworkToDcId = new HashMap<Network, Set<Guid>>(); for (Network network : externalNetworks) { <START> List<Guid> dcIds = getDbFacade().getStoragePoolDao().getDcIdByExternalNetworkId(network.getProvidedBy().getExternalId()); <END> Set<Guid> dataCenterIds = new HashSet<Guid>(); for (Guid dcId : dcIds) { dataCenterIds.add(dcId); } externalNetworkToDcId.put(network, dataCenterIds); } getQueryReturnValue().setReturnValue(externalNetworkToDcId); }</code><technical_language>replacing 'for' loop ? new HashSet<Guid>(dcIds); eventually get: externalNetworkToDcId.put(network, new HashSet<Guid>(dcIds));</technical_language>

Target:
protected void executeQueryCommand() { Provider<?> provider = getDbFacade().getProviderDao().get(getParameters().getId()); if (provider == null) { return; } NetworkProviderProxy client = getProviderProxyFactory().create(provider); List<Network> externalNetworks = client.getAll(); Map<Network, Set<Guid>> externalNetworkToDcId = new HashMap<Network, Set<Guid>>(); for (Network network : externalNetworks) { List<Guid> dcIds = getDbFacade().getNetworkDao().getDcIdByExternalNetworkId(network.getProvidedBy().getExternalId()); externalNetworkToDcId.put(network, new HashSet<Guid>(dcIds)); } getQueryReturnValue().setReturnValue(externalNetworkToDcId); }
Source:
<code>private static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual, Deque<Integer> indexes, Object messageOrSupplier) { if (expected == actual) { return; } assertIterablesNotNull(expected, actual, indexes, messageOrSupplier); Iterator<?> expectedIterator = expected.iterator(); Iterator<?> actualIterator = actual.iterator(); int processed = 0; while (expectedIterator.hasNext() && actualIterator.hasNext()) { processed++; Object expectedElement = expectedIterator.next(); Object actualElement = actualIterator.next(); if (expectedElement == actualElement) { continue; } <START> if (expectedElement != null && expectedElement.equals(actualElement)) { <END> continue; } indexes.addLast(processed - 1); assertIterableElementsEqual(expectedElement, actualElement, indexes, messageOrSupplier); indexes.removeLast(); } assertIteratorsAreEmpty(expectedIterator, actualIterator, processed, indexes, messageOrSupplier); }</code><technical_language>suggestion if (Objects.equals(expectedElement, actualElement)) { merge ifs Objects.equals() checks for ==</technical_language>

Target:
private static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual, Deque<Integer> indexes, Object messageOrSupplier) { if (expected == actual) { return; } assertIterablesNotNull(expected, actual, indexes, messageOrSupplier); Iterator<?> expectedIterator = expected.iterator(); Iterator<?> actualIterator = actual.iterator(); int processed = 0; while (expectedIterator.hasNext() && actualIterator.hasNext()) { processed++; Object expectedElement = expectedIterator.next(); Object actualElement = actualIterator.next(); if (Objects.equals(expectedElement, actualElement)) { continue; } indexes.addLast(processed - 1); assertIterableElementsEqual(expectedElement, actualElement, indexes, messageOrSupplier); indexes.removeLast(); } assertIteratorsAreEmpty(expectedIterator, actualIterator, processed, indexes, messageOrSupplier); }
Source:
<code>public WriteContext init(Configuration configuration) { this.configuration = configuration; if (this.protocolFactory == null) { try { this.protocolFactory = getTProtocolFactoryClass(configuration).newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } if (thriftClass != null) { TBaseWriteSupport.setThriftClass(configuration, thriftClass); } else { thriftClass = TBaseWriteSupport.getThriftClass(configuration); } ThriftSchemaConverter thriftSchemaConverter = new ThriftSchemaConverter(this.configuration); <START> this.thriftStruct = thriftSchemaConverter.toStructType(thriftClass); <END> this.schema = thriftSchemaConverter.convert(thriftStruct); if (buffered) { readToWrite = new BufferedProtocolReadToWrite(thriftStruct, errorHandler); } else { readToWrite = new ProtocolReadToWrite(); } return thriftWriteSupport.init(configuration); }</code><technical_language>drop this. for this line next right</technical_language>

Target:
public WriteContext init(Configuration configuration) { this.configuration = configuration; if (this.protocolFactory == null) { try { this.protocolFactory = getTProtocolFactoryClass(configuration).newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } } if (thriftClass != null) { TBaseWriteSupport.setThriftClass(configuration, thriftClass); } else { thriftClass = TBaseWriteSupport.getThriftClass(configuration); } ThriftSchemaConverter thriftSchemaConverter = new ThriftSchemaConverter(this.configuration); thriftStruct = thriftSchemaConverter.toStructType(thriftClass); schema = thriftSchemaConverter.convert(thriftStruct); if (buffered) { readToWrite = new BufferedProtocolReadToWrite(thriftStruct, errorHandler); } else { readToWrite = new ProtocolReadToWrite(); } return thriftWriteSupport.init(configuration); }
Source:
<code>protected static Serializable getDocumentPropertyValue(Object o) throws JSONException { if (o instanceof String) { Calendar calendar = null; try { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZ"); Date date = df.parse((String) o); calendar = Calendar.getInstance(); calendar.setTime(date); } catch (ParseException e) { } if (calendar != null) { return calendar; } else { return (Serializable) o; } } else if (o instanceof JSONArray) { JSONArray jsonArray = (JSONArray) o; ArrayList<Serializable> list = new ArrayList<Serializable>(); for (Object aJsonArray : jsonArray) { Serializable pValue = getDocumentPropertyValue(aJsonArray); if (pValue != null && !(pValue instanceof JSONNull)) { list.add(pValue); } <START> } <END> return list; } else if (o instanceof JSONObject) { JSONObject jsonObject = (JSONObject) o; HashMap<String, Serializable> map = new HashMap<String, Serializable>(); Iterator<String> keys = jsonObject.keys(); while (keys.hasNext()) { String key = keys.next(); map.put(key, getDocumentPropertyValue(jsonObject.get(key))); } return map; } else { return (Serializable) o; } }</code><technical_language>Format is wrong, { line if</technical_language>

Target:
protected static Serializable getDocumentPropertyValue(Object o) throws JSONException { if (o == null || o instanceof JSONNull) { return null; } else if (o instanceof String) { Calendar calendar = null; try { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZ"); Date date = df.parse((String) o); calendar = Calendar.getInstance(); calendar.setTime(date); } catch (ParseException e) { } if (calendar != null) { return calendar; } else { return (Serializable) o; } } else if (o instanceof JSONArray) { JSONArray jsonArray = (JSONArray) o; ArrayList<Serializable> list = new ArrayList<Serializable>(); for (Object aJsonArray : jsonArray) { Serializable pValue = getDocumentPropertyValue(aJsonArray); if (pValue != null) { list.add(pValue); } } return list; } else if (o instanceof JSONObject) { JSONObject jsonObject = (JSONObject) o; HashMap<String, Serializable> map = new HashMap<String, Serializable>(); Iterator<String> keys = jsonObject.keys(); while (keys.hasNext()) { String key = keys.next(); map.put(key, getDocumentPropertyValue(jsonObject.get(key))); } return map; } else { return (Serializable) o; } }
Source:
<code>public void load(String propertyFileLocation) throws IOException { <START> ConnectionFactoryConfigurer.load(this, propertyFileLocation); <END> }</code><technical_language>I Configurator is a more common word in English</technical_language>

Target:
public ConnectionFactory load(String propertyFileLocation) throws IOException { ConnectionFactoryConfigurator.load(this, propertyFileLocation); return this; }
Source:
<code>public void createWithoutOverwrite() throws Exception { Path path = new Path("/file"); alluxio.client.file.FileSystem alluxioFs = mock(alluxio.client.file.FileSystem.class); when(alluxioFs.exists(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)))) .thenReturn(true); when(alluxioFs.createFile(eq(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path))), any())) .thenThrow(new FileAlreadyExistsException(path.toString())); <START> FileSystem alluxioHadoopFs = new FileSystem(alluxioFs); <END> try { alluxioHadoopFs.create(path, false, 100, (short) 1, 1000); fail("create() of existing file is expected to fail"); } catch (IOException e) { assertEquals("Not allowed to create() (overwrite=false) for existing Alluxio path: " + path, e.getMessage()); } alluxioHadoopFs.close(); }</code><technical_language>I this try-with-resource is closed</technical_language>

Target:
public void createWithoutOverwrite() throws Exception { Path path = new Path("/file"); alluxio.client.file.FileSystem alluxioFs = mock(alluxio.client.file.FileSystem.class); when(alluxioFs.exists(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)))) .thenReturn(true); when(alluxioFs.createFile(eq(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path))), any())) .thenThrow(new FileAlreadyExistsException(path.toString())); try (FileSystem alluxioHadoopFs = new FileSystem(alluxioFs)) { alluxioHadoopFs.create(path, false, 100, (short) 1, 1000); fail("create() of existing file is expected to fail"); } catch (IOException e) { assertEquals("Not allowed to create() (overwrite=false) for existing Alluxio path: " + path, e.getMessage()); } }
Source:
<code>public void onSubscribe(Subscription s) { env.debug(String.format("%s::onSubscribe(%s)", this, s)); if (!subscription.isCompleted()) { <START> subscription.complete(s); <END> onSubscribeCalled.set(true); } else { env.flop("Subscriber::onSubscribe called on an already-subscribed Subscriber"); } }</code><technical_language>is a [completeImmediately()](<LINK_0> method promise</technical_language>

Target:
public void onSubscribe(Subscription s) { env.debug(String.format("%s::onSubscribe(%s)", this, s)); if (!subscription.isCompleted()) { subscription.complete(s); } else { env.flop("Subscriber::onSubscribe called on an already-subscribed Subscriber"); } }
Source:
<code><START> public Boolean deserializeZxidDigest(InputArchive ia) throws IOException { <END> if (!DigestCalculator.digestEnabled()) { return false; } try { ZxidDigest zxidDigest = new ZxidDigest(); zxidDigest.deserialize(ia); if (zxidDigest.zxid > 0) { digestFromLoadedSnapshot = zxidDigest; } return true; } catch (EOFException e) { LOG.warn("Got EOF exception while reading the digest, " + "likely due to the reading an older snapshot."); return false; } }</code><technical_language>Nit: boolean</technical_language>

Target:
public boolean deserializeZxidDigest(InputArchive ia) throws IOException { if (!DigestCalculator.digestEnabled()) { return false; } try { ZxidDigest zxidDigest = new ZxidDigest(); zxidDigest.deserialize(ia); if (zxidDigest.zxid > 0) { digestFromLoadedSnapshot = zxidDigest; } return true; } catch (EOFException e) { LOG.warn("Got EOF exception while reading the digest, " + "likely due to the reading an older snapshot."); return false; } }
Source:
<code>public void testOptionsFileExclude() throws Exception { final JavadocRunner javadocRunner = buildTestRunner(); final JavadocOptions options = new JavadocOptions(); final List<String> excludes = new LinkedList<String>(); excludes.add("*.internal"); excludes.add("*.internal.*"); excludes.add("*.xom"); options.setExcludes(excludes); javadocRunner.setOptions(options); final Set<File> manifests = new HashSet<File>(); File file = getTestBundleRoot(); <START> Assert.assertNotNull(file); <END> manifests.add(file); javadocRunner.setManifestFiles(manifests); String optionsFile = javadocRunner.createOptionsFileContent(); AssertOnBuffer aob = new AssertOnBuffer(optionsFile); aob.assertNextLine("com.example.bundle.core"); aob.assertNextLine("com.example.bundle.core.conf"); aob.assertNextLine("com.acme.other.core"); aob.assertNoMoreLines(); }</code><technical_language>this assertion, please fix getTestBundleRoot method throw exception in this case</technical_language>

Target:
public void testOptionsFileExclude() throws Exception { final JavadocRunner javadocRunner = buildTestRunner(); final JavadocOptions options = new JavadocOptions(); final List<String> excludes = new LinkedList<String>(); excludes.add("*.internal"); excludes.add("*.internal.*"); excludes.add("*.xom"); options.setExcludes(excludes); javadocRunner.setOptions(options); final Set<File> manifests = new HashSet<File>(); File file = getTestBundleRoot(); manifests.add(file); javadocRunner.setManifestFiles(manifests); String optionsFile = javadocRunner.createOptionsFileContent(); AssertOnBuffer aob = new AssertOnBuffer(optionsFile); aob.assertNextLine("com.example.bundle.core"); aob.assertNextLine("com.example.bundle.core.conf"); aob.assertNextLine("com.acme.other.core"); aob.assertNoMoreLines(); }
Source:
<code>public static List<Store> readStores() throws Exception { ClassPathResource resource = new ClassPathResource("starbucks.csv"); Scanner scanner = new Scanner(resource.getInputStream()); String line = scanner.nextLine(); scanner.close(); FlatFileItemReader<Store> itemReader = new FlatFileItemReader<Store>(); itemReader.setResource(resource); DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(); tokenizer.setNames(line.split(",")); tokenizer.setStrict(false); DefaultLineMapper<Store> lineMapper = new DefaultLineMapper<Store>(); lineMapper.setLineTokenizer(tokenizer); lineMapper.setFieldSetMapper(StoreFieldSetMapper.INSTANCE); itemReader.setLineMapper(lineMapper); itemReader.setRecordSeparatorPolicy(new DefaultRecordSeparatorPolicy()); itemReader.setLinesToSkip(1); itemReader.open(new ExecutionContext()); <START> List<Store> stores = new ArrayList<Store>(); <END> Store store = null; do { store = itemReader.read(); if (store != null) { stores.add(store); } } while (store != null); return stores; }</code><technical_language>Left overs intermediate removal of Java 7 settings</technical_language>

Target:
public static List<Store> readStores() throws Exception { ClassPathResource resource = new ClassPathResource("starbucks.csv"); Scanner scanner = new Scanner(resource.getInputStream()); String line = scanner.nextLine(); scanner.close(); FlatFileItemReader<Store> itemReader = new FlatFileItemReader<Store>(); itemReader.setResource(resource); DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(); tokenizer.setNames(line.split(",")); tokenizer.setStrict(false); DefaultLineMapper<Store> lineMapper = new DefaultLineMapper<Store>(); lineMapper.setLineTokenizer(tokenizer); lineMapper.setFieldSetMapper(StoreFieldSetMapper.INSTANCE); itemReader.setLineMapper(lineMapper); itemReader.setRecordSeparatorPolicy(new DefaultRecordSeparatorPolicy()); itemReader.setLinesToSkip(1); itemReader.open(new ExecutionContext()); List<Store> stores = new ArrayList<>(); Store store = null; do { store = itemReader.read(); if (store != null) { stores.add(store); } } while (store != null); return stores; }
Source:
<code>public void testGcGraceSecondsUpgradeIsApplied() throws TException { CassandraKeyValueService kvs = createKvs(getConfigWithGcGraceSeconds(FOUR_DAYS_IN_SECONDS)); <START> verify(logger, times(1)) <END> .debug(startsWith("No tables are being upgraded on startup. No updated table-related settings found.")); kvs.createTable(testTable, AtlasDbConstants.GENERIC_TABLE_METADATA); assertThatGcGraceSecondsIs(kvs, FOUR_DAYS_IN_SECONDS); kvs.close(); CassandraKeyValueService kvs2 = createKvs(getConfigWithGcGraceSeconds(ONE_HOUR_IN_SECONDS)); assertThatGcGraceSecondsIs(kvs2, ONE_HOUR_IN_SECONDS); kvs.close(); verify(logger, times(1)) .debug(startsWith("New table-related settings were applied on startup!!")); CassandraKeyValueService kvs3 = createKvs(getConfigWithGcGraceSeconds(ONE_HOUR_IN_SECONDS)); assertThatGcGraceSecondsIs(kvs3, ONE_HOUR_IN_SECONDS); verify(logger, times(2)) .debug(startsWith("No tables are being upgraded on startup. No updated table-related settings found.")); kvs3.close(); }</code><technical_language>This work _if this test is run first_, unfortunately, AbstractKeyValueServiceTest creates KVS test run. want reset logger mock begin, for this one</technical_language>

Target:
public void testGcGraceSecondsUpgradeIsApplied() throws TException { Logger testLogger = mock(Logger.class); CassandraKeyValueService kvs = createKvs(getConfigWithGcGraceSeconds(FOUR_DAYS_IN_SECONDS), testLogger); verify(testLogger, times(1)) .info(startsWith("No tables are being upgraded on startup. No updated table-related settings found.")); kvs.createTable(testTable, AtlasDbConstants.GENERIC_TABLE_METADATA); assertThatGcGraceSecondsIs(kvs, FOUR_DAYS_IN_SECONDS); kvs.close(); CassandraKeyValueService kvs2 = createKvs(getConfigWithGcGraceSeconds(ONE_HOUR_IN_SECONDS), testLogger); assertThatGcGraceSecondsIs(kvs2, ONE_HOUR_IN_SECONDS); kvs2.close(); verify(testLogger, times(1)) .info(startsWith("New table-related settings were applied on startup!!")); CassandraKeyValueService kvs3 = createKvs(getConfigWithGcGraceSeconds(ONE_HOUR_IN_SECONDS), testLogger); assertThatGcGraceSecondsIs(kvs3, ONE_HOUR_IN_SECONDS); verify(testLogger, times(2)) .info(startsWith("No tables are being upgraded on startup. No updated table-related settings found.")); kvs3.close(); }
Source:
<code>protected boolean canDoAction() { Disk disk = getDiskDao().get(getParameters().getImageGroupID()); DiskValidator diskValidator = new DiskValidator(disk); return validate(diskValidator.validateDiskIsNotLun()) <START> && validate(diskValidator.validateDiskIsNotCinder()); <END> }</code><technical_language>more clear if validation for copy. validateStorageTypeSupportedForCopyOrMove()</technical_language>

Target:
protected boolean canDoAction() { Disk disk = getDiskDao().get(getParameters().getImageGroupID()); if (disk != null) { DiskValidator diskValidator = new DiskValidator(disk); return validate(diskValidator.validateUnsupportedDiskStorageType( DiskStorageType.LUN, DiskStorageType.CINDER)); } return false; }
Source:
<code><START> private static BlockingQueue createTaskQueue( int queueSize ) <END> { if ( queueSize == UNBOUNDED_QUEUE ) { return new LinkedBlockingQueue(); } else if ( queueSize == SYNCHRONOUS_QUEUE ) { return new SynchronousQueue(); } else if ( queueSize > 0 ) { return new ArrayBlockingQueue( queueSize ); } throw new IllegalArgumentException( String.format( "Unsupported queue size %d for thread pool creation.", queueSize ) ); }</code><technical_language>BlockingQueue<Runnable> avoid raw types</technical_language>

Target:
private static BlockingQueue<Runnable> createTaskQueue( int queueSize ) { if ( queueSize == UNBOUNDED_QUEUE ) { return new LinkedBlockingQueue<>(); } else if ( queueSize == SYNCHRONOUS_QUEUE ) { return new SynchronousQueue<>(); } else if ( queueSize > 0 ) { return new ArrayBlockingQueue<>( queueSize ); } throw new IllegalArgumentException( String.format( "Unsupported queue size %d for thread pool creation.", queueSize ) ); }
Source:
<code>private Map<TypeElement, ViewInjector> findAndParseTargets(RoundEnvironment env) { Map<TypeElement, ViewInjector> targetClassMap = new LinkedHashMap<TypeElement, ViewInjector>(); <START> Set<String> erasedTargetNames = new HashSet<String>(); <END> for (Element element : env.getElementsAnnotatedWith(InjectView.class)) { try { parseInjectView(element, targetClassMap, erasedTargetNames); } catch (Exception e) { StringWriter stackTrace = new StringWriter(); e.printStackTrace(new PrintWriter(stackTrace)); error(element, "Unable to generate view injector for @InjectView.\n\n%s", stackTrace.toString()); } } for (Class<? extends Annotation> listener : LISTENERS) { findAndParseListener(env, listener, targetClassMap, erasedTargetNames); } for (Map.Entry<TypeElement, ViewInjector> entry : targetClassMap.entrySet()) { String parentClassFqcn = findParentFqcn(entry.getKey(), erasedTargetNames); if (parentClassFqcn != null) { entry.getValue().setParentInjector(parentClassFqcn + SUFFIX); } } return targetClassMap; }</code><technical_language>this LinkedHashSet</technical_language>

Target:
private Map<TypeElement, ViewInjector> findAndParseTargets(RoundEnvironment env) { Map<TypeElement, ViewInjector> targetClassMap = new LinkedHashMap<TypeElement, ViewInjector>(); Set<String> erasedTargetNames = new LinkedHashSet<String>(); for (Element element : env.getElementsAnnotatedWith(InjectView.class)) { try { parseInjectView(element, targetClassMap, erasedTargetNames); } catch (Exception e) { StringWriter stackTrace = new StringWriter(); e.printStackTrace(new PrintWriter(stackTrace)); error(element, "Unable to generate view injector for @InjectView.\n\n%s", stackTrace.toString()); } } for (Class<? extends Annotation> listener : LISTENERS) { findAndParseListener(env, listener, targetClassMap, erasedTargetNames); } for (Map.Entry<TypeElement, ViewInjector> entry : targetClassMap.entrySet()) { String parentClassFqcn = findParentFqcn(entry.getKey(), erasedTargetNames); if (parentClassFqcn != null) { entry.getValue().setParentInjector(parentClassFqcn + SUFFIX); } } return targetClassMap; }
Source:
<code>private BundleHandoverResponse deployPatch(BundleHandoverRequest request) { <START> File patchFile; <END> try { patchFile = File.createTempFile("rhq-jboss-as-7-", ".patch"); } catch (IOException e) { return BundleHandoverResponse .failure(BundleHandoverResponse.FailureType.EXECUTION, "Failed to create a temp file to copy patch to."); } try { StreamUtil.copy(request.getContent(), new FileOutputStream(patchFile)); } catch (FileNotFoundException e) { return BundleHandoverResponse.failure(EXECUTION, "Failed to copy patch to local storage."); } Map<String, String> parameters = request.getParams(); if (parameters != null) { for (Map.Entry<String, String> e : parameters.entrySet()) { String name = e.getKey(); String value = e.getValue(); if (!("override".equals(name) || "override-all".equals(name) || "preserve".equals(name) || "override-modules".equals(name))) { return BundleHandoverResponse.failure(BundleHandoverResponse.FailureType.INVALID_PARAMETER, "'" + name + "' is not a supported parameter. Only 'override', 'override-all', 'preserve' and 'override-modules' are supported."); } } } String errorMessage = deployPatch(patchFile, parameters); return errorMessage == null ? BundleHandoverResponse.success() : BundleHandoverResponse.failure(EXECUTION, errorMessage); }</code><technical_language>temp patch file is deleted this method returns? littering :p</technical_language>

Target:
private BundleHandoverResponse deployPatch(BundleHandoverRequest request) { File patchFile = null; try { try { patchFile = File.createTempFile("rhq-jboss-as-7-", ".patch"); } catch (IOException e) { return BundleHandoverResponse .failure(BundleHandoverResponse.FailureType.EXECUTION, "Failed to create a temp file to copy patch to."); } try { StreamUtil.copy(request.getContent(), new FileOutputStream(patchFile)); } catch (FileNotFoundException e) { return BundleHandoverResponse.failure(EXECUTION, "Failed to copy patch to local storage."); } Map<String, String> parameters = request.getParams(); if (parameters != null) { for (Map.Entry<String, String> e : parameters.entrySet()) { String name = e.getKey(); String value = e.getValue(); if (!("override".equals(name) || "override-all".equals(name) || "preserve".equals(name) || "override-modules".equals(name))) { return BundleHandoverResponse.failure(BundleHandoverResponse.FailureType.INVALID_PARAMETER, "'" + name + "' is not a supported parameter. Only 'override', 'override-all', 'preserve' and 'override-modules' are supported."); } } } String errorMessage = deployPatch(patchFile, parameters); return errorMessage == null ? BundleHandoverResponse.success() : BundleHandoverResponse.failure(EXECUTION, errorMessage); } finally { if (patchFile != null) { patchFile.delete(); } } }
Source:
<code>public NodeValue exec(List<NodeValue> args) { <START> if ( args.isEmpty() ) <END> throw new ExprBuildException("fn:apply: no function to call (minimum number of args is one)"); NodeValue functionId = args.get(0); List<NodeValue> argExprs = args.subList(1,args.size()) ; ExprList exprs = new ExprList(); argExprs.forEach((a)->exprs.add(a)); Node fnNode = functionId.asNode(); if ( fnNode.isBlank() ) throw new ExprBuildException("fn:apply: function id is a blank node (must be a URI)"); if ( fnNode.isLiteral() ) throw new ExprBuildException("fn:apply: function id is a literal (must be a URI)"); if ( fnNode.isVariable() ) throw new ExprBuildException("fn:apply: function id is an unbound variable (must be a URI)"); if ( fnNode.isURI() ) { String functionIRI = fnNode.getURI(); Function function = cache1.getOrFill(functionIRI, ()->buildFunction(functionIRI)); if ( function instanceof FunctionBase ) { return ((FunctionBase)function).exec(argExprs); } function.build(functionIRI, exprs); return function.exec(null, exprs, functionIRI, null); } throw new ExprEvalException("fn:apply: Weird function argument (arg 1): "+functionId); }</code><technical_language>checkBuild get called</technical_language>

Target:
public NodeValue exec(List<NodeValue> args) { if ( args.isEmpty() ) throw new ExprException("fn:apply: no function to call (minimum number of args is one)"); NodeValue functionId = args.get(0); List<NodeValue> argExprs = args.subList(1,args.size()) ; ExprList exprs = new ExprList(); argExprs.forEach(exprs::add); Node fnNode = functionId.asNode(); if ( fnNode.isBlank() ) throw new ExprEvalException("fn:apply: function id is a blank node (must be a URI)"); if ( fnNode.isLiteral() ) throw new ExprEvalException("fn:apply: function id is a literal (must be a URI)"); if ( fnNode.isVariable() ) throw new ExprEvalException("fn:apply: function id is an unbound variable (must be a URI)"); if ( fnNode.isURI() ) { String functionIRI = fnNode.getURI(); Function function = cache1.getOrFill(functionIRI, ()->buildFunction(functionIRI)); if ( function == null ) throw new ExprEvalException("fn:apply: Unknown function: <"+functionId+">"); if ( function instanceof FunctionBase ) { return ((FunctionBase)function).exec(argExprs); } function.build(functionIRI, exprs); return function.exec(null, exprs, functionIRI, null); } throw new ExprEvalException("fn:apply: Weird function argument (arg 1): "+functionId); }
Source:
<code>private void unsubscribe() { loginSubscriptions.unsubscribe(); <START> loginSubscriptions = new CompositeSubscription(); <END> Log.v(TAG, "Unsubscribed from login events."); }</code><technical_language>need do this</technical_language>

Target:
private void unsubscribe() { loginSubscriptions.unsubscribe(); loginSubscriptions = new CompositeSubscription(); }
Source:
<code>LedgerEntryRequest(List<BookieSocketAddress> ensemble, long lId, long eId) { this.entryImpl = LedgerEntryImpl.create(lId, eId); this.ensemble = ensemble; this.eId = eId; long entryIdToConsiderForWriteSet = eId; if (clientCtx.getConf().enableStickyReads && lh.getLedgerMetadata().getWriteQuorumSize() == lh.getLedgerMetadata().getEnsembleSize()) { <START> entryIdToConsiderForWriteSet = 0; <END> } if (clientCtx.getConf().enableReorderReadSequence) { writeSet = clientCtx.getPlacementPolicy() .reorderReadSequence( ensemble, lh.getBookiesHealthInfo(), lh.distributionSchedule.getWriteSet(entryIdToConsiderForWriteSet)); } else { writeSet = lh.distributionSchedule.getWriteSet(entryIdToConsiderForWriteSet); } }</code><technical_language>do deal ensemble changes</technical_language>

Target:
LedgerEntryRequest(List<BookieSocketAddress> ensemble, long lId, long eId) { this.entryImpl = LedgerEntryImpl.create(lId, eId); this.ensemble = ensemble; this.eId = eId; if (clientCtx.getConf().enableReorderReadSequence) { writeSet = clientCtx.getPlacementPolicy() .reorderReadSequence( ensemble, lh.getBookiesHealthInfo(), lh.getWriteSetForReadOperation(eId)); } else { writeSet = lh.getWriteSetForReadOperation(eId); } }
Source:
<code>public Collection<MgfMsSpectrum> execute() throws MSDKException { logger.info("Started MGF import from file", target); double mzValues[] = null; float intensityValues[] = null; int numOfDataPoints; try (final BufferedReader reader = new BufferedReader(new FileReader(target))) { String line; while ((line = reader.readLine()) != null) { switch (line) { case "BEGIN IONS": spectra.add(processSpectrum(reader)); processedSpectra++; break; } } reader.close(); } catch (IOException e) { <START> System.out.println("Well"); <END> } return spectra; }</code><technical_language>println() in final code, please. throw new MSDKException(e) instead</technical_language>

Target:
public List<MgfMsSpectrum> execute() throws MSDKException { logger.info("Started MGF import from {}", target); spectra = new LinkedList<>(); String line; try (final BufferedReader reader = new BufferedReader(new FileReader(target))) { while (!cancelled) { line = reader.readLine(); if (line == null) break; switch (line) { case "BEGIN IONS": spectra.add(processSpectrum(reader)); break; } } reader.close(); } catch (IOException e) { throw new MSDKException(e); } logger.info("Finished MGF import from with spectrums", target, spectra.size()); return spectra; }
Source:
<code>public void checkout() throws IOException { if (headCommitTree != null) preScanTwoTrees(headCommitTree.getTreeId(), dc, mergeCommitTree.getTreeId()); else prescanOneTree(dc, mergeCommitTree.getTreeId()); if (!conflicts.isEmpty()) { if (failOnConflict) { dc.unlock(); throw new IOException("dirty files exist; refusing to merge."); } else cleanUpConflicts(); } builder.finish(); File file; for (String p : updated.keySet()) { file = new File(repo.getWorkDir(), p); file.getParentFile().mkdirs(); file.createNewFile(); DirCacheEntry entry = dc.getEntry(p); entry.checkoutEntry(repo, file, config_filemode()); entry.setLastModified(file.lastModified()); entry.setLength((int) file.length()); } <START> for (String r : removed) { <END> file = new File(repo.getWorkDir(), r); file.delete(); removeEmptyParents(file); } if (!builder.commit()) { dc.unlock(); throw new IOException( "couldn't commit the index; refusing to merge"); } }</code><technical_language>apply removed first. If foo/bar turning foo, need safely delete file bar, safely delete directory foo, safely create file called foo. Also, try apply in order, starting bottom of tree up. avoid removeEmptyParents() name scheduled for removal in directory is removed. hard. removed is a List<String>, built name traversal, sorted properly. track of directory prefix walk names: String = ""; for (String r : removed) { if (!samePrefix(r, last)) removeEmptyParents(last); ... delete r = r; } removeEmptyParents(last); private boolean isSamePrefix(String a, String b) { int = a.lastIndexOf('/'); int bs = b.lastIndexOf('/'); return a.substring(0, + 1).equals(bs.substring(0, bs + 1)); }</technical_language>

Target:
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; 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()); entry.setLastModified(file.lastModified()); entry.setLength((int) file.length()); } for (String path : removed) { file = new File(repo.getWorkDir(), path); file.delete(); removeEmptyParents(file); } if (!builder.commit()) { dc.unlock(); throw new IOException(JGitText.get().cannotDeleteFile); } }
Source:
<code>public void should_fail_if_files_are_not_binary_identical() throws IOException { <START> Throwable throwable = catchThrowable(() -> unMockedFiles.assertSameContentAs(someInfo(), createFileWithNonUTF8Character(), expected)); <END> assertThat(throwable).isInstanceOf(AssertionError.class) .hasMessageEndingWith("does not have expected binary content at offset <0>, expecting:\n" + " <\"EOF\">\n" + "but was:\n" + " <\"0x0\">"); }</code><technical_language>is Java 8 specific in comparing binary content, code merged in assertj core 2.x means shoudn't lambdas (yes sucks I know)</technical_language>

Target:
public void should_fail_if_files_are_not_binary_identical() throws IOException { try { unMockedFiles.assertSameContentAs(someInfo(), createFileWithNonUTF8Character(), expected); failBecauseExpectedAssertionErrorWasNotThrown(); } catch (AssertionError e) { assertThat(e.getMessage()).endsWith("does not have expected binary content at offset <0>, expecting:\n" + " <\"EOF\">\n" + "but was:\n" + " <\"0x0\">"); } }