auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void zipRequestWrapperTest_shouldReturnTrueIfUnzippedContentReadFromWrapperIsTheSameAsContentBeforeZipping() throws Exception { GlobalProperty property = new GlobalProperty("gzip.acceptCompressedRequestsForPaths", ".*"); Context.getAdministrationService().saveGlobalProperty(property); MockHttpServletRequest req = new MockHttpServletRequest(); req.setContextPath("http://gzipservletpath"); req.addHeader("Content-encoding", "gzip"); ByteArrayOutputStream stream = new ByteArrayOutputStream(); GZIPOutputStream gzOutput = new GZIPOutputStream(stream); PrintWriter pwriter = new PrintWriter(gzOutput); pwriter.write("message string"); pwriter.flush(); gzOutput.finish(); req.setContent(stream.toByteArray()); MockHttpServletResponse resp = new MockHttpServletResponse(); FilterChain fil = mock(FilterChain.class); GZIPFilter gzipFilter = new GZIPFilter(); gzipFilter.doFilterInternal(req, resp, fil); final ArgumentCaptor<HttpServletRequest> argumentCaptor = ArgumentCaptor.forClass(HttpServletRequest.class); Mockito.verify(fil).doFilter(argumentCaptor.capture(), Mockito.any(HttpServletResponse.class)); HttpServletRequest requestArgument = (HttpServletRequest) argumentCaptor.getValue(); try { InputStream iStream = requestArgument.getInputStream(); InputStreamReader iReader = new InputStreamReader(iStream); BufferedReader bufReader = new BufferedReader(iReader); String outputMessage = bufReader.readLine(); Assert.assertEquals(outputMessage.equals("message string"), true); } catch (IOException e) { throw new RuntimeException(); } }

Target:
public void zipRequestWrapperTest_shouldReturnTrueIfUnzippedContentReadFromWrapperIsTheSameAsContentBeforeZipping() throws Exception { GlobalProperty property = new GlobalProperty("gzip.acceptCompressedRequestsForPaths", ".*"); Context.getAdministrationService().saveGlobalProperty(property); MockHttpServletRequest req = new MockHttpServletRequest(); req.setContextPath("http://gzipservletpath"); req.addHeader("Content-encoding", "gzip"); ByteArrayOutputStream stream = new ByteArrayOutputStream(); GZIPOutputStream gzOutput = new GZIPOutputStream(stream); PrintWriter pwriter = new PrintWriter(gzOutput); pwriter.write("message string"); pwriter.flush(); gzOutput.finish(); req.setContent(stream.toByteArray()); MockHttpServletResponse resp = new MockHttpServletResponse(); FilterChain fil = mock(FilterChain.class); GZIPFilter gzipFilter = new GZIPFilter(); gzipFilter.doFilterInternal(req, resp, fil); final ArgumentCaptor<HttpServletRequest> argumentCaptor = ArgumentCaptor.forClass(HttpServletRequest.class); Mockito.verify(fil).doFilter(argumentCaptor.capture(), Mockito.any(HttpServletResponse.class)); HttpServletRequest requestArgument = argumentCaptor.getValue(); try { InputStream iStream = requestArgument.getInputStream(); InputStreamReader iReader = new InputStreamReader(iStream); BufferedReader bufReader = new BufferedReader(iReader); String outputMessage = bufReader.readLine(); Assert.assertEquals(outputMessage.equals("message string"), true); } catch (IOException e) { throw new RuntimeException(); } }
Source:
static <T> Future<T> fromCompletableFuture(ExecutorService executorService, CompletableFuture<T> future) { Objects.requireNonNull(executorService, "executorService is null"); Objects.requireNonNull(future, "future is null"); FutureImpl<T> newFuture = new FutureImpl<>(executorService); future.handle((t, throwable) -> newFuture .tryComplete(throwable == null ? Try.success(t) : Try.failure(throwable instanceof CompletionException ? throwable.getCause() : throwable))); return newFuture; }

Target:
static <T> Future<T> fromCompletableFuture(ExecutorService executorService, CompletableFuture<T> future) { Objects.requireNonNull(executorService, "executorService is null"); Objects.requireNonNull(future, "future is null"); final Promise<T> promise = Promise.make(); future.handle((t, err) -> err == null ? promise.success(t) : promise.failure(err)); return promise.future(); }
Source:
public String getDisplayName() { switch (this) { case PREPARING: return "Preparing device"; case WAITING: return "waiting for device"; case UNINSTALL: return "Uninstall apps"; case INSTALL: return "Install apps"; case RUNNING: return "Running session"; case SENDING_RESULTS: return "Sending results"; case PROCESSING_RESULTS: return "Processing results"; default: return ""; } }

Target:
public String getDisplayName() { switch (this) { case PREPARING: return "Preparing device"; case WAITING: return "Waiting for device"; case UNINSTALL: return "Uninstall apps"; case INSTALL: return "Install apps"; case RUNNING: return "Running session"; case SENDING_RESULTS: return "Sending results"; case PROCESSING_RESULTS: return "Processing results"; default: return ""; } }
Source:
public void waitForRevokeLeader(long timeout) throws Exception { final LeaderInformation revoke = revokeQueue.poll(timeout, TimeUnit.MILLISECONDS); if (revoke == null || !revoke.equals(LeaderInformation.empty())) { throw new TimeoutException("Contender was not revoked within " + timeout + "ms"); } isLeader = false; }

Target:
public void waitForRevokeLeader(long timeout) throws Exception { throwExceptionIfNotNull(); final String errorMsg = "Contender was not revoked within " + timeout + "ms"; CommonTestUtils.waitUntilCondition( () -> { final LeaderInformation leader = leaderEventQueue.poll(timeout, TimeUnit.MILLISECONDS); return leader != null && leader.isEmpty(); }, Deadline.fromNow(Duration.ofMillis(timeout)), errorMsg); isLeader = false; }
Source:
private void serviceV2() throws IOException { if (biDirectionalPipe) { for (String s : v2CapabilityAdvertisement) { pckOut.writeString(s); } pckOut.end(); } try { while (true) { String command; try { command = pckIn.readString(); } catch (EOFException eof) { break; } while (pckIn.readString() != PacketLineIn.DELIM) { } if (command.equals("command=ls-refs")) { lsRefsV2(); } else { throw new PackProtocolException("unknown command " + command); } } } finally { rawOut.stopBuffering(); } }

Target:
private void serviceV2() throws IOException { if (biDirectionalPipe) { for (String s : v2CapabilityAdvertisement) { pckOut.writeString(s + "\n"); } pckOut.end(); } try { while (true) { String command; try { command = pckIn.readString(); } catch (EOFException eof) { break; } if (command.equals("command=" + CAPABILITY_LS_REFS)) { lsRefsV2(); } else { throw new PackProtocolException("unknown command " + command); } } } finally { rawOut.stopBuffering(); } }
Source:
private RepositoriesView getRepositoriesView() { return (RepositoriesView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .findViewReference(RepositoriesView.VIEW_ID).getView(false); }

Target:
private RepositoriesView getRepositoriesView() { IWorkbenchPage page = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); IViewReference ref = page.findViewReference(RepositoriesView.VIEW_ID); return ref == null ? null : (RepositoriesView) ref.getView(false); }
Source:
private boolean isDomainReportedAsProblematic(VDSDomainsData tempData, boolean isLog) { if (tempData.getCode() != 0) { if (isLog) { log.errorFormat("Domain {0} was reported with error code {1}", tempData.getDomainId(), tempData.getCode()); } return true; } if (tempData.getLastCheck() > Config .<Double> GetValue(ConfigValues.MaxStorageVdsTimeoutCheckSec)) { if (isLog) { log.errorFormat("Domain {0} was reported with too big lastCheck {1}", tempData.getDomainId(), tempData.getLastCheck()); } return true; } return false; }

Target:
private boolean isDomainReportedAsProblematic(VDSDomainsData tempData, boolean isLog) { if (tempData.getCode() != 0) { if (isLog) { log.errorFormat("Domain {0} was reported with error code {1}", tempData.getDomainId(), tempData.getCode()); } return true; } if (tempData.getLastCheck() > Config .<Double> GetValue(ConfigValues.MaxStorageVdsTimeoutCheckSec)) { if (isLog) { log.errorFormat("Domain {0} check timeot {1} is too big", tempData.getDomainId(), tempData.getLastCheck()); } return true; } return false; }
Source:
public void visitToken(final DetailAST ast) { switch (ast.getType()) { case TokenTypes.VARIABLE_DEF: case TokenTypes.PARAMETER_DEF: case TokenTypes.PATTERN_VARIABLE_DEF: case TokenTypes.RECORD_COMPONENT_DEF: currentFrame.addField(ast); break; case TokenTypes.METHOD_CALL: processMethodCall(ast); break; case TokenTypes.SLIST: processSlist(ast); break; case TokenTypes.LITERAL_NEW: processLiteralNew(ast); break; case TokenTypes.OBJBLOCK: final int parentType = ast.getParent().getType(); if (parentType != TokenTypes.CLASS_DEF && parentType != TokenTypes.RECORD_DEF && parentType != TokenTypes.ENUM_DEF) { processFrame(ast); } break; default: processFrame(ast); } }

Target:
public void visitToken(final DetailAST ast) { switch (ast.getType()) { case TokenTypes.VARIABLE_DEF: case TokenTypes.PARAMETER_DEF: case TokenTypes.PATTERN_VARIABLE_DEF: case TokenTypes.RECORD_COMPONENT_DEF: currentFrame.addField(ast); break; case TokenTypes.METHOD_CALL: processMethodCall(ast); break; case TokenTypes.SLIST: processSlist(ast); break; case TokenTypes.LITERAL_NEW: processLiteralNew(ast); break; case TokenTypes.OBJBLOCK: final int parentType = ast.getParent().getType(); if (!astTypeIsClassOrEnumOrRecordDef(parentType)) { processFrame(ast); } break; default: processFrame(ast); } }
Source:
private void put(TableReference tableRef, Map<Cell, byte[]> values, long ttlDuration, TimeUnit ttlUnit) { Preconditions.checkArgument(!AtlasDbConstants.hiddenTables.contains(tableRef)); if (conflictDetectionManager.get(tableRef) == null) { throw new IllegalArgumentException( "Not a valid table for this transaction." + " Make sure this table name exists or has a valid namespace: " + tableRef); } if (values.isEmpty()) { return; } Map<Cell, byte[]> valuesToWrite = ttlDuration != Cell.INVALID_TTL && ttlUnit != Cell.INVALID_TTL_TYPE ? createExpiringValues(values, ttlDuration, ttlUnit) : values; numWriters.incrementAndGet(); try { Preconditions.checkState(state.get() == State.UNCOMMITTED, "Transaction must be uncommitted."); ConcurrentNavigableMap<Cell, byte[]> writes = getLocalWrites(tableRef); putWritesAndLogIfTooLarge(valuesToWrite, writes); } finally { numWriters.decrementAndGet(); } }

Target:
private void put(TableReference tableRef, Map<Cell, byte[]> values, long ttlDuration, TimeUnit ttlUnit) { Preconditions.checkArgument(!AtlasDbConstants.hiddenTables.contains(tableRef)); if (values.isEmpty()) { return; } Map<Cell, byte[]> valuesToWrite = ttlDuration != Cell.INVALID_TTL && ttlUnit != Cell.INVALID_TTL_TYPE ? createExpiringValues(values, ttlDuration, ttlUnit) : values; numWriters.incrementAndGet(); try { Preconditions.checkState(state.get() == State.UNCOMMITTED, "Transaction must be uncommitted."); ConcurrentNavigableMap<Cell, byte[]> writes = getLocalWrites(tableRef); putWritesAndLogIfTooLarge(valuesToWrite, writes); } finally { numWriters.decrementAndGet(); } }
Source:
public void testSendStatement() { AccountVO accountVO = new AccountVO(); accountVO.setId(2L); accountVO.setDomainId(1L); Mockito.when(accountDao.findById(Mockito.anyLong())).thenReturn(accountVO); QuotaAccountVO acc = new QuotaAccountVO(2L); acc.setQuotaBalance(new BigDecimal(404)); acc.setLastStatementDate(null); List<QuotaAccountVO> accounts = new ArrayList<>(); accounts.add(acc); Mockito.when(quotaAcc.listAllQuotaAccount()).thenReturn(accounts); Mockito.when(quotaUsage.findTotalQuotaUsage(Mockito.anyLong(), Mockito.anyLong(), Mockito.anyInt(), Mockito.any(Date.class), Mockito.any(Date.class))) .thenReturn(new BigDecimal(100)); Mockito.doCallRealMethod().when(quotaStatement).sendStatement(); }

Target:
public void testSendStatement() throws UnsupportedEncodingException, MessagingException { Calendar date = Calendar.getInstance(); AccountVO accountVO = new AccountVO(); accountVO.setId(2L); accountVO.setDomainId(1L); Mockito.when(accountDao.findById(Mockito.anyLong())).thenReturn(accountVO); QuotaAccountVO acc = new QuotaAccountVO(2L); acc.setQuotaBalance(new BigDecimal(404)); acc.setLastStatementDate(null); List<QuotaAccountVO> accounts = new ArrayList<>(); accounts.add(acc); Mockito.when(quotaAcc.listAllQuotaAccount()).thenReturn(accounts); Mockito.when(quotaUsage.findTotalQuotaUsage(Mockito.anyLong(), Mockito.anyLong(), Mockito.anyInt(), Mockito.any(Date.class), Mockito.any(Date.class))) .thenReturn(new BigDecimal(100)); QuotaAlertManagerImpl.DeferredQuotaEmail email = new QuotaAlertManagerImpl.DeferredQuotaEmail(accountVO, acc, new BigDecimal(100), QuotaConfig.QuotaEmailTemplateTypes.QUOTA_LOW); Mockito.doCallRealMethod().when(quotaStatement).sendStatement(); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.MONTHLY); if (period != null){ Mockito.verify(alertManager, Mockito.times(1)).sendQuotaAlert(email); } }
Source:
public <T extends Annotation> AnnotatedTypeConfigurator<T> configureQualifier(Class<T> qualifier) { checkWithinObserverNotification(); AnnotatedTypeConfiguratorImpl<T> configurator = new AnnotatedTypeConfiguratorImpl<>(getBeanManager().createAnnotatedType(qualifier)); additionalQualifiers.add(configurator); return configurator; }

Target:
public <T extends Annotation> AnnotatedTypeConfigurator<T> configureQualifier(Class<T> qualifier) { checkWithinObserverNotification(); AnnotatedTypeConfiguratorImpl<T> configurator = new AnnotatedTypeConfiguratorImpl<>(getBeanManager().createAnnotatedType(qualifier)); additionalQualifiers.add(configurator); BootstrapLogger.LOG.configureQualifierCalled(getReceiver(), qualifier); return configurator; }
Source:
private void configureExistingWindows() { List<MArea> elements = modelService.findElements(window, null, MArea.class, null); for (MArea area : elements) { Object widget = area.getWidget(); if (widget instanceof Control) { installAreaDropSupport((Control) widget); } } }

Target:
private void configureExistingWindows() { List<MArea> elements = modelService.findElements(window, null, MArea.class, null); for (MArea area : elements) { Object widget = area.getWidget(); if (widget instanceof Control) { installAreaDropSupport((Control) widget); break; } } }
Source:
protected void updateBlobTtl(final String blobIdStr, final String serviceId, long expiresAtMs, FutureResult<Void> futureResult, Callback<Void> callback) { boolean needGet = isMaybeMetadataBlob(blobIdStr); if (needGet) { Callback<GetBlobResultInternal> internalCallback = (GetBlobResultInternal result, Exception exception) -> { List<String> blobIdStrs = new ArrayList<>(); blobIdStrs.add(blobIdStr); if (exception != null) { completeOperation(futureResult, callback, null, exception, false); } else if (result.getBlobResult != null) { exception = new RouterException( "GET blob call returned the blob instead of just the store keys (before TTL update)", RouterErrorCode.UnexpectedInternalError); completeOperation(futureResult, callback, null, exception, false); } else if (result.storeKeys != null) { result.storeKeys.forEach(key -> blobIdStrs.add(key.getID())); } currentOperationsCount.addAndGet(blobIdStrs.size()); doUpdateTtlOperation(blobIdStrs, serviceId, expiresAtMs, futureResult, callback); }; GetBlobOptionsInternal options = new GetBlobOptionsInternal(new GetBlobOptions(GetBlobOptions.OperationType.All, GetOption.None, null), true, routerMetrics.ageAtTtlUpdate); try { getBlob(blobIdStr, options, internalCallback); } catch (RouterException e) { completeUpdateBlobTtlOperation(e, futureResult, callback); } } else { routerMetrics.skippedGetBlobCount.inc(); doUpdateTtlOperation(ImmutableList.of(blobIdStr), serviceId, expiresAtMs, futureResult, callback); } }

Target:
protected void updateBlobTtl(final String blobIdStr, final String serviceId, long expiresAtMs, FutureResult<Void> futureResult, Callback<Void> callback) { if (isMaybeMetadataBlob(blobIdStr)) { Callback<GetBlobResultInternal> internalCallback = (GetBlobResultInternal result, Exception exception) -> { if (exception != null) { completeOperation(futureResult, callback, null, exception, false); } else if (result.getBlobResult != null) { exception = new RouterException( "GET blob call returned the blob instead of just the store keys (before TTL update)", RouterErrorCode.UnexpectedInternalError); completeOperation(futureResult, callback, null, exception, false); } else { List<String> blobIdStrs = new ArrayList<>(); blobIdStrs.add(blobIdStr); if (result.storeKeys != null) { result.storeKeys.forEach(key -> blobIdStrs.add(key.getID())); } currentOperationsCount.addAndGet(blobIdStrs.size()); doUpdateTtlOperation(blobIdStrs, serviceId, expiresAtMs, futureResult, callback); } }; GetBlobOptionsInternal options = new GetBlobOptionsInternal(new GetBlobOptions(GetBlobOptions.OperationType.All, GetOption.None, null), true, routerMetrics.ageAtTtlUpdate); try { getBlob(blobIdStr, options, internalCallback); } catch (RouterException e) { completeUpdateBlobTtlOperation(e, futureResult, callback); } } else { routerMetrics.skippedGetBlobCount.inc(); doUpdateTtlOperation(Collections.singletonList(blobIdStr), serviceId, expiresAtMs, futureResult, callback); } }
Source:
public DataObject getAttributeValue(final DlmsConnectionHolder conn, final AttributeAddress attributeAddress) throws FunctionalException { Objects.requireNonNull(conn, "conn must not be null"); Objects.requireNonNull(attributeAddress, "attributeAddress must not be null"); try { final GetResult getResult = conn.getConnection().get(attributeAddress); final AccessResultCode resultCode = getResult.getResultCode(); if (AccessResultCode.SUCCESS == resultCode) { return getResult.getResultData(); } final String errorMessage = String.format("Retrieving attribute value for { %d, %s, %d }. Result: resultCode(" + "%d), with data: %s", attributeAddress.getClassId(), attributeAddress.getInstanceId().toObisCode(), attributeAddress.getId(), resultCode.getCode(), this.getDebugInfo(getResult.getResultData())); LOGGER.error(errorMessage); throw new FunctionalException(FunctionalExceptionType.ERROR_RETRIEVING_ATTRIBUTE_VALUE, ComponentType.PROTOCOL_DLMS); } catch (final IOException e) { throw new ConnectionException(e); } }

Target:
public DataObject getAttributeValue(final DlmsConnectionHolder conn, final AttributeAddress attributeAddress) throws FunctionalException { Objects.requireNonNull(conn, "conn must not be null"); Objects.requireNonNull(attributeAddress, "attributeAddress must not be null"); try { final GetResult getResult = conn.getConnection().get(attributeAddress); final AccessResultCode resultCode = getResult.getResultCode(); if (AccessResultCode.SUCCESS == resultCode) { return getResult.getResultData(); } final String errorMessage = String.format("Retrieving attribute value for { %d, %s, %d }. Result: resultCode(" + "%d), with data: %s", attributeAddress.getClassId(), attributeAddress.getInstanceId().toObisCode(), attributeAddress.getId(), resultCode.getCode(), this.getDebugInfo(getResult.getResultData())); LOGGER.error(errorMessage); throw new FunctionalException(FunctionalExceptionType.ERROR_RETRIEVING_ATTRIBUTE_VALUE, ComponentType.PROTOCOL_DLMS, new ProtocolAdapterException(errorMessage)); } catch (final IOException e) { throw new ConnectionException(e); } }
Source:
private void databaseCorruptionDetected() throws IndexException { String msg = NLS.bind("Corrupted database: {0}", new Object[] { this.fLocation.getName() }); throw new IndexException(new DBStatus(msg)); }

Target:
private void databaseCorruptionDetected() throws IndexException { String msg = "Corrupted database: " + this.fLocation.getName(); throw new IndexException(new DBStatus(msg)); }
Source:
private static List<Trackable> loadInventory(final String geocode) { if (StringUtils.isBlank(geocode)) { return null; } init(); final List<Trackable> trackables = new ArrayList<>(); final Cursor cursor = database.query( dbTableTrackables, new String[]{"_id", "updated", "tbcode", "guid", "title", "owner", "released", "goal", "description", "retrieved"}, "geocode = ?", new String[]{geocode}, null, null, "title COLLATE NOCASE ASC", "100"); while (cursor.moveToNext()) { trackables.add(createTrackableFromDatabaseContent(cursor)); } cursor.close(); return trackables; }

Target:
private static List<Trackable> loadInventory(final String geocode) { if (StringUtils.isBlank(geocode)) { return null; } init(); final List<Trackable> trackables = new ArrayList<>(); final Cursor cursor = database.query( dbTableTrackables, new String[]{"_id", "updated", "tbcode", "guid", "title", "owner", "released", "goal", "description", "log_date", "log_type", "log_guid"}, "geocode = ?", new String[]{geocode}, null, null, "title COLLATE NOCASE ASC", "100"); while (cursor.moveToNext()) { trackables.add(createTrackableFromDatabaseContent(cursor)); } cursor.close(); return trackables; }
Source:
@Override protected String getDescription(MBeanOperationInfo op, MBeanParameterInfo param, int seq) { String str = super.getDescription(op, param, seq); try { Method m = getMethod(op); MXBeanParametersDescriptions decsAnn = m.getAnnotation(MXBeanParametersDescriptions.class); if (decsAnn != null) { assert decsAnn.value() != null; assert seq < decsAnn.value().length; str = decsAnn.value()[seq]; assert str != null; assert !str.trim().isEmpty(); assert Character.isUpperCase(str.charAt(0)) : str; assert str.charAt(str.length() - 1) == '.' : str; } else { MXBeanParameterInfo argumentInfoAnnotation = getMXBeanArgumentAnnotation(m, seq); if (argumentInfoAnnotation != null) { str = argumentInfoAnnotation.description(); assert str != null; assert !str.trim().isEmpty(); assert Character.isUpperCase(str.charAt(0)) : str; assert str.charAt(str.length() - 1) == '.' : str; } } } catch (SecurityException | ClassNotFoundException ignored) { } return str; }

Target:
@Override protected String getDescription(MBeanOperationInfo op, MBeanParameterInfo param, int seq) { String str = super.getDescription(op, param, seq); try { Method m = getMethod(op); MXBeanParametersDescriptions decsAnn = m.getAnnotation(MXBeanParametersDescriptions.class); if (decsAnn != null) { assert decsAnn.value() != null; assert seq < decsAnn.value().length; str = decsAnn.value()[seq]; assert str != null : DESC_MUST_BE_NOT_NULL + str; assert !str.trim().isEmpty() : DESC_MUST_BE_NOT_EMPTY + str; assert Character.isUpperCase(str.charAt(0)) : DESC_MUST_START_WITH_UPP_CASE + str; assert str.charAt(str.length() - 1) == '.' : DESC_MUST_END_WITH_PERIOD + str; } else { MXBeanParameter argInfoAnnotation = getMXBeanArgumentAnnotation(m, seq); if (argInfoAnnotation != null) { str = argInfoAnnotation.description(); assert str != null : DESC_MUST_BE_NOT_NULL + str; assert !str.trim().isEmpty() : DESC_MUST_BE_NOT_EMPTY + str; assert Character.isUpperCase(str.charAt(0)) : DESC_MUST_START_WITH_UPP_CASE + str; assert str.charAt(str.length() - 1) == '.' : DESC_MUST_END_WITH_PERIOD + str; } } } catch (SecurityException | ClassNotFoundException ignored) { } return str; }
Source:
static int[] optimizedFoldOrbit(int r) { if (r >= ORBIT_MIN_VALUE) { return FOLD_MAP.get(r); } else return null; }

Target:
static int[] optimizedFoldOrbit(int r) { if (r >= ORBIT_MIN_VALUE) { return FOLD_MAP.get(r); } return null; }
Source:
private double computeTextToTagRatio(String line) { int tag = 0; int text = 0; for (int i = 0; i >= 0 && i < line.length(); i++) { if (line.charAt(i) == '<') { tag++; i = line.indexOf('>', i); if (i == -1) { break; } } else if (tag == 0 && line.charAt(i) == '>') { text = 0; tag++; } else { text++; } } if (tag == 0) { tag = 1; } if(text != 0){ } return (double) text / (double) tag; }

Target:
private double computeTextToTagRatio(String line) { int tag = 0; int text = 0; for (int i = 0; i >= 0 && i < line.length(); i++) { if (line.charAt(i) == '<') { tag++; i = line.indexOf('>', i); if (i == -1) { break; } } else if (tag == 0 && line.charAt(i) == '>') { text = 0; tag++; } else { text++; } } tag = Math.max(tag, 1); return (double) text / (double) tag; }
Source:
public Map<String, Long> getFormatCounts(AccessGroupSet accessGroups) { HashMap<String, Long> counts = new HashMap<String, Long>(); try { StringBuilder queryBuilder = new StringBuilder("*:*"); addAccessRestrictions(queryBuilder, accessGroups); SolrQuery query = new SolrQuery(); query.setQuery(queryBuilder.toString()); query.setRows(0); query.addFacetField("contentType"); query.setFacetLimit(-1); QueryResponse response = this.executeQuery(query); FacetField facetField = response.getFacetField("contentType"); for (Count count : facetField.getValues()) { if (count.getName().startsWith("^text")) counts.put("text", count.getCount()); else if (count.getName().startsWith("^image")) counts.put("image", count.getCount()); else if (count.getName().startsWith("^dataset")) counts.put("dataset", count.getCount()); else if (count.getName().startsWith("^audio")) counts.put("audio", count.getCount()); else if (count.getName().startsWith("^video")) counts.put("video", count.getCount()); } } catch (SolrServerException | AccessRestrictionException e) { LOG.error("Error retrieving format counts", e); } return counts; }

Target:
public Map<String, Long> getFormatCounts(AccessGroupSet accessGroups) { Map<String, Long> counts = new HashMap<>(); try { StringBuilder queryBuilder = new StringBuilder("*:*"); addAccessRestrictions(queryBuilder, accessGroups); SolrQuery query = new SolrQuery(); query.setQuery(queryBuilder.toString()); query.setRows(0); query.addFacetField("contentType"); query.setFacetLimit(-1); QueryResponse response = this.executeQuery(query); FacetField facetField = response.getFacetField("contentType"); for (Count count : facetField.getValues()) { if (count.getName().startsWith("^text")) counts.put("text", count.getCount()); else if (count.getName().startsWith("^image")) counts.put("image", count.getCount()); else if (count.getName().startsWith("^dataset")) counts.put("dataset", count.getCount()); else if (count.getName().startsWith("^audio")) counts.put("audio", count.getCount()); else if (count.getName().startsWith("^video")) counts.put("video", count.getCount()); } } catch (SolrServerException | AccessRestrictionException e) { LOG.error("Error retrieving format counts", e); } return counts; }
Source:
public void showChargesCreatedSuccessfully(Charges changes) { Toast.makeText(getActivity(), R.string.change_created_success, Toast.LENGTH_LONG) .show(); }

Target:
public void showChargesCreatedSuccessfully(Charges changes) { Toast.makeText(getActivity(), R.string.charge_created_success, Toast.LENGTH_LONG) .show(); }
Source:
public void anAlarmNotificationIsReceivedFromAnUnknownDevice() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }

Target:
public void anAlarmNotificationIsReceivedFromAnUnknownDevice() throws Throwable { try { SimulatePushedAlarmsHooks.simulateAlarm(UnknownDevice, new byte[] { 0x2C, 0x00, 0x00, 0x01, 0x02 }); SimulatePushedAlarmsHooks.simulateAlarm(UnknownDevice, new byte[] { 0x2C, 0x04, 0x20, 0x00, 0x00 }); } catch (final Exception e) { LOGGER.error("Error occured simulateAlarm: ", e); } PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
public static void setup() { Igneous.duringTele.send(mecanum); BooleanMixing.whenBooleanBecomes(octocanumShifting, true).send(new EventOutput(){ public void event(){ Igneous.duringTele.unsend(mecanum); Igneous.duringTele.send(tankDrive); } }); BooleanMixing.whenBooleanBecomes(octocanumShifting, false).send(new EventOutput(){ public void event(){ Igneous.duringTele.unsend(tankDrive); Igneous.duringTele.send(mecanum); } }); }

Target:
public static void setup() { octocanumShifting.toggleWhen(octocanumShiftingButton); Igneous.duringTele.send(EventMixing.filterEvent(octocanumShifting, false, mecanum)); Igneous.duringTele.send(EventMixing.filterEvent(octocanumShifting, true, DriverImpls.createTankDriverEvent(leftJoystickChannelY, rightJoystickChannelY, leftMotors, rightMotors))); }
Source:
public void bindComparisonOperator() throws StandardException{ boolean nullableResult; if (singleLeftOperand) { if (!rightOperandList.comparable(getLeftOperand(), false)) { addCastOnRightOperandForStringToNonStringComparison(); } rightOperandList.comparable(getLeftOperand(), true); } nullableResult= leftOperandList.isNullable() || rightOperandList.isNullable(); setType(new DataTypeDescriptor(TypeId.BOOLEAN_ID,nullableResult)); }

Target:
public void bindComparisonOperator() throws StandardException{ boolean nullableResult; if (singleLeftOperand) { if (!rightOperandList.comparable(getLeftOperand())) { addCastOnRightOperandForStringToNonStringComparison(); } rightOperandList.throwIfNotComparable(getLeftOperand()); } nullableResult= leftOperandList.isNullable() || rightOperandList.isNullable(); setType(new DataTypeDescriptor(TypeId.BOOLEAN_ID,nullableResult)); }
Source:
public void elementShouldContain(String locator, String text, String...params) { String message = robot.getParamsValue(params, 0, ""); Boolean ignoreCase = robot.getParamsValue(params, 1, Boolean.FALSE); String actual = getText(locator); String textToCompare = text; if (ignoreCase) { actual = actual.toLowerCase(); textToCompare = textToCompare.toLowerCase(); } if (!actual.contains(textToCompare)) { if (StringUtils.isBlank(message)) { message = String.format("Element should have contained text '%s', but its text was %s.", text, actual); } logging.info(String.format("Element Should Contain: %s => FAILED", text)); throw new SeleniumLibraryNonFatalException(message); } else { logging.info(String.format("Element Should Contain: %s => OK", text)); } }

Target:
public void elementShouldContain(String locator, String text, String...params) { String message = robot.getParamsValue(params, 0, StringUtils.EMPTY); Boolean ignoreCase = robot.getParamsValue(params, 1, Boolean.FALSE); String actual = getText(locator); if (!textContains(actual, text, ignoreCase)) { if (StringUtils.isEmpty(message)) { message = String.format("Element should have contained text '%s', but its text was %s.", text, actual); } logging.info(String.format("Element Should Contain: %s => FAILED", text)); throw new SeleniumLibraryNonFatalException(message); } else { logging.info(String.format("Element Should Contain: %s => OK", text)); } }
Source:
void nonAmphibiousMarineWithAmphibiousAssault() { testData.addTech(new ImprovedArtillerySupportAdvance(testData.gameData)); final List<Unit> amphibUnits = new ArrayList<>(); amphibUnits.addAll(testData.tank(1)); amphibUnits.addAll(testData.artillery(1)); amphibUnits.addAll(testData.marine(1)); amphibUnits.forEach( unit -> { unit.getProperty(Unit.UNLOADED_AMPHIBIOUS) .ifPresent( property -> { try { property.setValue(true); } catch (final MutableProperty.InvalidValueException e) { } }); }); final List<Unit> attackingUnits = new ArrayList<>(amphibUnits); attackingUnits.addAll(testData.marine(1)); final List<Unit> result = CasualtyOrderOfLosses.sortUnitsForCasualtiesWithSupport( CasualtyOrderOfLosses.Parameters.builder() .targetsToPickFrom(attackingUnits) .combatModifiers( CombatModifiers.builder().defending(false).territoryEffects(List.of()).build()) .player(testData.british) .enemyUnits(List.of()) .battlesite(testData.france) .costs(testData.costMap) .data(testData.gameData) .build()); assertThat(result, hasSize(4)); assertThat( "Non amphibious marine only has attack of 2 since it doesn't get marine bonus", result.get(0), is(attackingUnits.get(3))); assertThat(result.get(1), is(attackingUnits.get(1))); assertThat("Amphibious marine has attack of 3", result.get(2), is(attackingUnits.get(2))); assertThat(result.get(3), is(attackingUnits.get(0))); }

Target:
void nonAmphibiousMarineWithAmphibiousAssault() { testData.addTech(new ImprovedArtillerySupportAdvance(testData.gameData)); final List<Unit> attackingUnits = new ArrayList<>(); attackingUnits.addAll(testData.tank(1)); attackingUnits.addAll(testData.artillery(1)); attackingUnits.addAll(testData.marine(1)); final List<Unit> amphibMarines = new ArrayList<>(testData.marine(1)); amphibMarines .get(0) .getProperty(Unit.UNLOADED_AMPHIBIOUS) .ifPresent( property -> { try { property.setValue(true); } catch (final MutableProperty.InvalidValueException e) { } }); attackingUnits.addAll(amphibMarines); final List<Unit> result = CasualtyOrderOfLosses.sortUnitsForCasualtiesWithSupport( CasualtyOrderOfLosses.Parameters.builder() .targetsToPickFrom(attackingUnits) .combatModifiers( CombatModifiers.builder().defending(false).territoryEffects(List.of()).build()) .player(testData.british) .enemyUnits(List.of()) .battlesite(testData.france) .costs(testData.costMap) .data(testData.gameData) .build()); assertThat(result, hasSize(4)); assertThat( "Non amphibious marine only has attack of 2 since it doesn't get marine bonus", result.get(0), is(attackingUnits.get(2))); assertThat(result.get(1), is(attackingUnits.get(1))); assertThat("Amphibious marine has attack of 3", result.get(2), is(attackingUnits.get(3))); assertThat(result.get(3), is(attackingUnits.get(0))); }
Source:
protected final IMethod[] getExtractedMethods(final ICompilationUnit unit) throws JavaModelException { Assert.isNotNull(unit); final List<IJavaElement> list= new ArrayList<>(); for (IMember fMember : fMembers) { if (fMember instanceof IMethod) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, fMember); if (element instanceof IMethod && !JdtFlags.isDefaultMethod((IMethod) element)) list.add(element); } } return list.toArray(new IMethod[list.size()]); }

Target:
protected final IMethod[] getExtractedMethods(final ICompilationUnit unit) throws JavaModelException { Assert.isNotNull(unit); final List<IJavaElement> list= new ArrayList<>(); for (IMember member : fMembers) { if (member instanceof IMethod) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, member); if (element instanceof IMethod && !JdtFlags.isDefaultMethod((IMethod) element)) list.add(element); } } return list.toArray(new IMethod[list.size()]); }
Source:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("reset") .setDescription("Remove a setting value.<br>" + "It's not possible to try to reset settings defined in sonar.properties.<br/>" + "Requires one of the following permissions: " + "<ul>" + "<li>'Administer System'</li>" + "<li>'Administer' rights on the specified component</li>" + "</ul>") .setSince("6.1") .setChangelog(new Change("7.1", "Settings from sonar.properties are explicitly forbidden")) .setPost(true) .setHandler(this); action.createParam(PARAM_KEYS) .setDescription("Comma-separated list of keys") .setExampleValue("sonar.links.scm,sonar.debt.hoursInDay") .setRequired(true); action.createParam(PARAM_COMPONENT) .setDescription("Component key") .setDeprecatedKey("componentKey", "6.3") .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(PARAM_BRANCH) .setDescription("Branch key") .setExampleValue(KEY_BRANCH_EXAMPLE_001) .setInternal(true) .setSince("6.6"); }

Target:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("reset") .setDescription("Remove a setting value.<br>" + "The settings defined in config/sonar.properties are read-only and can't be changed.<br/>" + "Requires one of the following permissions: " + "<ul>" + "<li>'Administer System'</li>" + "<li>'Administer' rights on the specified component</li>" + "</ul>") .setSince("6.1") .setChangelog(new Change("7.1", "The settings defined in config/sonar.properties are read-only and can't be changed")) .setPost(true) .setHandler(this); action.createParam(PARAM_KEYS) .setDescription("Comma-separated list of keys") .setExampleValue("sonar.links.scm,sonar.debt.hoursInDay") .setRequired(true); action.createParam(PARAM_COMPONENT) .setDescription("Component key") .setDeprecatedKey("componentKey", "6.3") .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(PARAM_BRANCH) .setDescription("Branch key") .setExampleValue(KEY_BRANCH_EXAMPLE_001) .setInternal(true) .setSince("6.6"); }
Source:
public boolean supports(EntityType entityType) { final boolean callingFromMinecraftThread = ServerUtils.isCallingFromMainThread(); for (Tuple<DataProcessor<M, I>, Timing> tuple : this.processors) { if (callingFromMinecraftThread) { tuple.getSecond().startTiming(); } if (tuple.getFirst().supports(entityType)) { if (callingFromMinecraftThread) { tuple.getSecond().stopTiming(); } return true; } if (callingFromMinecraftThread) { tuple.getSecond().stopTiming(); } } return false; }

Target:
public boolean supports(EntityType entityType) { final boolean callingFromMinecraftThread = ServerUtils.isCallingFromMainThread(); for (Tuple<DataProcessor<M, I>, Timing> tuple : this.processors) { try (Timing timing = callingFromMinecraftThread ? tuple.getSecond().startTiming() : null) { if (tuple.getFirst().supports(entityType)) { return true; } } } return false; }
Source:
private Pair<Integer, Integer> getAllValuesFromMmap(ByteBuffer mmap, StoreKey keyToFind, int positiveMatchInd, int totalEntries, NavigableSet<IndexValue> values) throws IOException { byte[] buf = new byte[valueSize]; int end = positiveMatchInd; StoreKey found; do { mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); end++; if (end < totalEntries) { found = getKeyAt(mmap, end); logger.trace("Index Segment {}: found at {}", indexFile.getAbsolutePath(), found, end); } else { break; } } while (found.equals(keyToFind)); end--; int start = positiveMatchInd; while (start > 0) { found = getKeyAt(mmap, --start); logger.trace("Index Segment {}: found at {}", indexFile.getAbsolutePath(), found, start); if (found.equals(keyToFind)) { mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); } else { start++; break; } } return new Pair<>(start, end); }

Target:
private Pair<Integer, Integer> getAllValuesFromMmap(ByteBuffer mmap, StoreKey keyToFind, int positiveMatchInd, int totalEntries, NavigableSet<IndexValue> values) throws IOException { byte[] buf = new byte[valueSize]; int end = positiveMatchInd; for (; end < totalEntries && getKeyAt(mmap, end).equals(keyToFind); end++) { logger.trace("Index Segment {}: found at {}", indexFile.getAbsolutePath(), keyToFind, end); mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); } end--; int start = positiveMatchInd - 1; for (; start >= 0 && getKeyAt(mmap, start).equals(keyToFind); start--) { logger.trace("Index Segment {}: found at {}", indexFile.getAbsolutePath(), keyToFind, start); mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); } return new Pair<>(start, end); }
Source:
private void writeNumaTune() { NumaTuneMode numaTune = vm.getNumaTuneMode(); if (numaTune == null) { return; } Map<String, Object> numaTuneSetting = NumaSettingFactory.buildVmNumatuneSetting( numaTune, vmNumaNodesSupplier.get()); if (numaTuneSetting.isEmpty()) { return; } String nodeSet = (String) numaTuneSetting.get(VdsProperties.NUMA_TUNE_NODESET); String mode = (String) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MODE); @SuppressWarnings("unchecked") List<Map<String, String>> memNodes = (List<Map<String, String>>) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MEMNODES); if (nodeSet != null || memNodes != null) { writer.writeStartElement("numatune"); if (memNodes != null) { for (Map<String, String> memnode : memNodes) { writer.writeStartElement("memnode"); writer.writeAttributeString("mode", mode); writer.writeAttributeString("cellid", (String) memnode.get(VdsProperties.NUMA_TUNE_VM_NODE_INDEX)); writer.writeAttributeString("nodeset", (String) memnode.get(VdsProperties.NUMA_TUNE_NODESET)); writer.writeEndElement(); } } writer.writeEndElement(); } }

Target:
private void writeNumaTune() { NumaTuneMode numaTune = vm.getNumaTuneMode(); if (numaTune == null) { return; } Map<String, Object> numaTuneSetting = NumaSettingFactory.buildVmNumatuneSetting( numaTune, vmNumaNodesSupplier.get()); if (numaTuneSetting.isEmpty()) { return; } String mode = (String) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MODE); @SuppressWarnings("unchecked") List<Map<String, String>> memNodes = (List<Map<String, String>>) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MEMNODES); if (memNodes != null) { writer.writeStartElement("numatune"); if (memNodes != null) { for (Map<String, String> memnode : memNodes) { writer.writeStartElement("memnode"); writer.writeAttributeString("mode", mode); writer.writeAttributeString("cellid", (String) memnode.get(VdsProperties.NUMA_TUNE_VM_NODE_INDEX)); writer.writeAttributeString("nodeset", (String) memnode.get(VdsProperties.NUMA_TUNE_NODESET)); writer.writeEndElement(); } } writer.writeEndElement(); } }
Source:
public void tryEvaluateWithAll(String expression, Type expectedType) { executeProjectionWithAll(expression, expectedType, session, compiler); }

Target:
public void tryEvaluateWithAll(String expression, Type expectedType) { tryEvaluateWithAll(expression, expectedType, session); }
Source:
private void waitUntilReadyToServeClients(List<String> clients) { Awaitility.await() .atMost(60, TimeUnit.SECONDS) .pollInterval(500, TimeUnit.MILLISECONDS) .until(() -> { try { clients.forEach(client -> timelockServiceForClient(client).getFreshTimestamp()); timelockServiceForClient(defaultClient).getFreshTimestamp(); return true; } catch (Throwable t) { return false; } }); }

Target:
private void waitUntilReadyToServeClients(List<String> clients) { Awaitility.await() .atMost(60, TimeUnit.SECONDS) .pollInterval(500, TimeUnit.MILLISECONDS) .until(() -> { try { clients.forEach(name -> timelockServiceForClient(name).getFreshTimestamp()); return true; } catch (Throwable t) { return false; } }); }
Source:
public boolean checkRootByBuildTags() { String buildTags = android.os.Build.TAGS; if (buildTags != null && buildTags.contains(SU_TAG)) { if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, "Build tags are found in the device"); } return false; } return false; }

Target:
public boolean checkRootByBuildTags() { String buildTags = android.os.Build.TAGS; if (buildTags != null && buildTags.contains(SU_TAG)) { if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, "Build tags are found in the device"); } return true; } return false; }
Source:
public void selectNodeByXpath() { final DetailAST rootAST = (DetailAST) tree.getModel().getRoot(); if (rootAST.hasChildren()) { final String xpath = "/EOF" + xpathEditor.getText(); final Deque<DetailAST> nodes = new ArrayDeque<>(); if (search(rootAST, xpath, nodes)) { TreePath path = new TreePath(nodes.pop()); while (!nodes.isEmpty()) { path = path.pathByAddingChild(nodes.pop()); if (!tree.isExpanded(path)) { tree.expandPath(path); } tree.setSelectionPath(path); makeCodeSelection(); } } else { xpathEditor.setText(xpathEditor.getText() + "- wrong xpath query"); } } else { xpathEditor.setText("No file Opened"); } }

Target:
public void selectNodeByXpath() { final DetailAST rootAST = (DetailAST) tree.getModel().getRoot(); if (rootAST.hasChildren()) { final String xpath = "/EOF" + xpathEditor.getText(); final Deque<DetailAST> nodes = new ArrayDeque<>(); if (search(rootAST, xpath, nodes)) { TreePath path = new TreePath(nodes.pop()); while (!nodes.isEmpty()) { path = path.pathByAddingChild(nodes.pop()); if (!tree.isExpanded(path)) { tree.expandPath(path); } tree.setSelectionPath(path); makeCodeSelection(); } } else { xpathEditor.setText(xpathEditor.getText() + "\n^ wrong xpath query"); } } else { xpathEditor.setText("No file Opened"); } }
Source:
public void testBug487151_Classes(final Comparison comparison, final CompareTestSupport support) { final List<Diff> differences = comparison.getDifferences(); final List<Conflict> conflicts = comparison.getConflicts(); assertEquals(69, differences.size()); assertEquals(4, conflicts.size()); Iterable<Conflict> realConflicts = filter(conflicts, containsConflictOfTypes(ConflictKind.REAL)); assertEquals(2, size(realConflicts)); assertTrue(all(differences, hasState(DifferenceState.UNRESOLVED))); Iterable<Diff> nonConflictingDifferences = acceptNonConflictingChanges(comparison); assertFalse(isEmpty(nonConflictingDifferences)); final List<Diff> conflictingDifferences = collectDifferences(realConflicts); assertFalse(conflictingDifferences.isEmpty()); assertTrue(all(nonConflictingDifferences, hasState(DifferenceState.MERGED))); assertTrue(all(conflictingDifferences, hasState(DifferenceState.UNRESOLVED))); EObject root = getLeftUMLRoot(comparison); assertNotNull(root); assertTrue(root instanceof Model); Model model = (Model)root; Package package1 = (Package)model.getPackagedElement("Package1"); assertNotNull(package1); PackageableElement class1 = package1.getPackagedElement("Class1"); assertNull(class1); PackageableElement class2 = package1.getPackagedElement("Class2"); assertNotNull(class2); Class class2class = (Class)class2; assertEquals(1, class2class.getGeneralizations().size()); Generalization class2generalization = class2class.getGeneralizations().get(0); Classifier class2superclass = class2generalization.getGeneral(); assertNull(class2superclass); }

Target:
public void testBug487151_Classes(final Comparison comparison, final CompareTestSupport support) { final List<Diff> differences = comparison.getDifferences(); final List<Conflict> conflicts = comparison.getConflicts(); Iterable<Conflict> realConflicts = filter(conflicts, containsConflictOfTypes(ConflictKind.REAL)); assertEquals(2, size(realConflicts)); assertTrue(all(differences, hasState(DifferenceState.UNRESOLVED))); Iterable<Diff> nonConflictingDifferences = acceptNonConflictingChanges(comparison); assertFalse(isEmpty(nonConflictingDifferences)); final List<Diff> conflictingDifferences = collectDifferences(realConflicts); assertFalse(conflictingDifferences.isEmpty()); assertTrue(all(nonConflictingDifferences, hasState(DifferenceState.MERGED))); assertTrue(all(conflictingDifferences, hasState(DifferenceState.UNRESOLVED))); EObject root = getLeftUMLRoot(comparison); assertNotNull(root); assertTrue(root instanceof Model); Model model = (Model)root; Package package1 = (Package)model.getPackagedElement("Package1"); assertNotNull(package1); PackageableElement class1 = package1.getPackagedElement("Class1"); assertNull(class1); PackageableElement class2 = package1.getPackagedElement("Class2"); assertNotNull(class2); Class class2class = (Class)class2; assertTrue(class2class.getGeneralizations().isEmpty()); }