auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void reset() { uID = new UniqueID(); nick = PokemonInfo.name(uID); item = 0; ability = 0; nature = 0; hiddenPowerType = 16; gender = 1; gen = new Gen(); shiny = false; happiness = 0; isHackmon = false; level = 100; moves[0] = new TeamMove(0); moves[1] = new TeamMove(0); moves[2] = new TeamMove(0); moves[3] = new TeamMove(0); DVs[0] = DVs[1] = DVs[2] = DVs[3] = DVs[4] = DVs[5] = 31; EVs[0] = EVs[1] = EVs[2] = EVs[3] = EVs[4] = EVs[5] = 0; }

Target:
public void reset() { uID = new UniqueID(); nick = PokemonInfo.name(uID); item = 0; ability = 0; nature = 0; hiddenPowerType = (byte)TypeInfo.Type.Dark.ordinal(); gender = 1; gen = new Gen(); shiny = false; happiness = 0; isHackmon = false; level = 100; moves[0] = new TeamMove(0); moves[1] = new TeamMove(0); moves[2] = new TeamMove(0); moves[3] = new TeamMove(0); DVs[0] = DVs[1] = DVs[2] = DVs[3] = DVs[4] = DVs[5] = 31; EVs[0] = EVs[1] = EVs[2] = EVs[3] = EVs[4] = EVs[5] = 0; }
Source:
protected ButtonAttributes getPositiveButtonAttributes() { return new ButtonAttributes() { @NonNull @Override public String getMessage() { return getContext().getResources().getString(R.string.label_ok); } @Nullable @Override public DialogInterface.OnClickListener getOnClickListener() { return null; } }; }

Target:
protected ButtonAttributes getPositiveButtonAttributes() { return new ButtonAttributes() { @NonNull @Override public String getMessage() { return getContext().getResources().getString(R.string.label_ok); } @Nullable @Override public DialogInterface.OnClickListener getOnClickListener() { return mOnPositiveClick; } }; }
Source:
public Diagnostics(Configuration config) { this.config = config; hostData = new JSONObject(); appData = new JSONObject(); }

Target:
public Diagnostics(Configuration config) { this.config = config; JSONUtils.safePutOpt(deviceData, "osName", System.getProperty("os.name")); }
Source:
public void onEntityKill(EntityDeathEvent e) { if (e.getEntity().getKiller() != null) { Player p = e.getEntity().getKiller(); ItemStack item = p.getInventory().getItemInMainHand(); Set<ItemStack> customDrops = SlimefunPlugin.getRegistry().getMobDrops(e.getEntityType()); if (customDrops != null && !customDrops.isEmpty()) { for(ItemStack is:customDrops) { SlimefunItem sfi = SlimefunItem.getByItem(is); if(sfi != null && sfi instanceof ChanceDrop) { if(((ChanceDrop)sfi).getChance() <= ThreadLocalRandom.current().nextInt(0,100)) continue; else addDrops(p, customDrops, e.getDrops()); } } } if (item.getType() != Material.AIR) { SlimefunItem sfItem = SlimefunItem.getByItem(item); if (sfItem != null && Slimefun.hasUnlocked(p, sfItem, true)) { sfItem.callItemHandler(EntityKillHandler.class, handler -> handler.onKill(e, e.getEntity(), p, item)); } } } }

Target:
public void onEntityKill(EntityDeathEvent e) { if (e.getEntity().getKiller() != null) { Player p = e.getEntity().getKiller(); ItemStack item = p.getInventory().getItemInMainHand(); Set<ItemStack> customDrops = SlimefunPlugin.getRegistry().getMobDrops(e.getEntityType()); if (customDrops != null && !customDrops.isEmpty()) addDrops(p, customDrops, e.getDrops()); if (item.getType() != Material.AIR) { SlimefunItem sfItem = SlimefunItem.getByItem(item); if (sfItem != null && Slimefun.hasUnlocked(p, sfItem, true)) { sfItem.callItemHandler(EntityKillHandler.class, handler -> handler.onKill(e, e.getEntity(), p, item)); } } } }
Source:
private Config loadConfig( Optional<Path> additionalConfig ) throws CommandFailed { return withAdditionalConfig( additionalConfig, Config.fromFile( configDir.resolve( "neo4j.conf" ) ).withHome( homeDir ) .withConnectorsDisabled().build() ); }

Target:
private Config loadConfig( Optional<Path> additionalConfig ) throws CommandFailed { return withAdditionalConfig( additionalConfig, Config.fromFile( configDir.resolve( Config.DEFAULT_CONFIG_FILE_NAME ) ).withHome( homeDir ) .withConnectorsDisabled().build() ); }
Source:
public PaymentWorksBatchReportVendorItem createBatchReportVendorItem(PaymentWorksVendor pmwVendorProcessed) { return new PaymentWorksBatchReportVendorItem(pmwVendorProcessed.getPmwVendorRequestId(), pmwVendorProcessed.getProcessTimestamp(), pmwVendorProcessed.getVendorType(), pmwVendorProcessed.getRequestingCompanyLegalName(), pmwVendorProcessed.getRequestingCompanyLegalFirstName(), pmwVendorProcessed.getRequestingCompanyLegalLastName(), pmwVendorProcessed.getRequestingCompanyTinType(), pmwVendorProcessed.getRequestingCompanyCorporateEmail(), pmwVendorProcessed.getInitiatorNetId(), null); }

Target:
public PaymentWorksBatchReportVendorItem createBatchReportVendorItem(PaymentWorksVendor pmwVendorProcessed) { return createBatchReportVendorItem(pmwVendorProcessed, (List<String>) null); }
Source:
public static void assertIndex(IndexDescriptor expected, String keyspace, Session session) { TableMetadata tableMetadata = session.getCluster().getMetadata().getKeyspace(keyspace.toLowerCase()) .getTable(expected.getTableName().toCql()); IndexMetadata imd = tableMetadata.getIndex(expected.getName().toCql()); assertEquals(expected.getName(), imd == null ? null : imd.getName()); }

Target:
public static void assertIndex(IndexDescriptor expected, String keyspace, Session session) { TableMetadata tableMetadata = session.getCluster().getMetadata().getKeyspace(keyspace.toLowerCase()) .getTable(expected.getTableName().toCql()); IndexMetadata indexMetadata = tableMetadata.getIndex(expected.getName().toCql()); assertThat(indexMetadata, is(not(nullValue()))); assertThat(indexMetadata.getName(), is(equalTo(expected.getName().toCql()))); }
Source:
private String checkDockerCertPath(String dockerCertPath) { if (StringUtils.isEmpty(dockerCertPath)) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certifate path (DOCKER_CERT_PATH) is not defined."); } else { File certPath = new File(dockerCertPath); if (!certPath.exists()) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certificate path (DOCKER_CERT_PATH) '" + dockerCertPath + "' doesn't exist."); } if (certPath.isDirectory()) { return dockerCertPath; } else { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certificate path (DOCKER_CERT_PATH) '" + dockerCertPath + "' doesn't point to a directory."); } } }

Target:
private String checkDockerCertPath(String dockerCertPath) { if (StringUtils.isEmpty(dockerCertPath)) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certifate path (DOCKER_CERT_PATH) is not defined."); } File certPath = new File(dockerCertPath); if (!certPath.exists()) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certificate path (DOCKER_CERT_PATH) '" + dockerCertPath + "' doesn't exist."); } else if (!certPath.isDirectory()) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certificate path (DOCKER_CERT_PATH) '" + dockerCertPath + "' doesn't point to a directory."); } return dockerCertPath; }
Source:
public Object getData(String key, boolean refresh) { return getData(ThreadLocalParamsContainer.getHttpSessionId(), key, refresh); }

Target:
public final Object getData(String key, boolean refresh) { return getData(ThreadLocalParamsContainer.getHttpSessionId(), key, refresh); }
Source:
public Description matchClass(ClassTree tree, VisitorState state) { List<Tree> types = new ArrayList<>(); types.add(tree.getExtendsClause()); types.addAll(tree.getImplementsClause()); return testTypes(types); }

Target:
public Description matchClass(ClassTree tree, VisitorState state) { Description extendsResult = testType(tree.getExtendsClause()); if (extendsResult != Description.NO_MATCH) { return extendsResult; } return testTypes(tree.getImplementsClause()); }
Source:
void getTrackFile() throws Exception { this.mockMvc.perform(get(BASELINE_URL_TEMPLATE.format(new Object[] {"E-MTAB-5423", "g391"}))) .andExpect(status().isOk()) .andReturn(); }

Target:
void getTrackFile() throws Exception { this.mockMvc.perform(get(BASELINE_URL_TEMPLATE.format(new Object[] {"E-MTAB-5423", "g391"}))) .andExpect(status().isOk()); }
Source:
private String getResult(QueryResult result, String propertyName) throws RepositoryException { StringBuilder buff = new StringBuilder(); RowIterator it = result.getRows(); while (it.hasNext()) { if (buff.length() > 0) { buff.append(", "); } buff.append(it.nextRow().getValue(propertyName).getString()); } return buff.toString(); }

Target:
private static String getResult(QueryResult result, String propertyName) throws RepositoryException { StringBuilder buff = new StringBuilder(); RowIterator it = result.getRows(); while (it.hasNext()) { if (buff.length() > 0) { buff.append(", "); } buff.append(it.nextRow().getValue(propertyName).getString()); } return buff.toString(); }
Source:
protected void doStart() throws Exception { if (this.processor instanceof ServiceSupport) { ((ServiceSupport)this.processor).start(); } }

Target:
protected void doStart() throws Exception { ServiceHelper.startService(this.processor); }
Source:
public boolean isExcluded(File file) { boolean isMinified = new MinificationAssessor(getEncoding()).isMinified(file); if (isMinified) { LOG.debug("File [" + file.getAbsolutePath() + "] is minified"); } return isMinified; }

Target:
public boolean isExcluded(File file) { boolean isMinified = new MinificationAssessor(getEncoding()).isMinified(file); if (isMinified) { LOG.debug("File [" + file.getAbsolutePath() + "] looks like a minified file and will not be analyzed"); } return isMinified; }
Source:
public void testLocaleIsSupported() { final String language = DEFAULT_LOCALE.getLanguage(); if (!Locale.ROOT.getLanguage().equals(language) && !Locale.ENGLISH.getLanguage().equals(language)) { final LocalizedMessage localizedMessage = createSampleLocalizedMessage(); assertThat("Unsupported language: " + DEFAULT_LOCALE, localizedMessage.getMessage(), not("Empty statement.")); } }

Target:
public void testLocaleIsSupported() { final String language = DEFAULT_LOCALE.getLanguage(); if (!language.isEmpty() && !Locale.ENGLISH.getLanguage().equals(language)) { final LocalizedMessage localizedMessage = createSampleLocalizedMessage(); assertThat("Unsupported language: " + DEFAULT_LOCALE, localizedMessage.getMessage(), not("Empty statement.")); } }
Source:
public ResponseEntity setServerSettings(@RequestBody @Validated ServerSettingsForm serverSettingsForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String acceptHeader) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_SERVER_SETTINGS, bindingResult); } configurationManagementService.setBaseUrl(serverSettingsForm.getBaseUrl()); configurationManagementService.setPort(serverSettingsForm.getPort()); return ResponseEntity.ok(getResponseEntityBody(SUCCESSFUL_SAVE_SERVER_SETTINGS, acceptHeader)); }

Target:
public ResponseEntity setServerSettings(@RequestBody @Validated ServerSettingsForm serverSettingsForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String acceptHeader) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_SERVER_SETTINGS, bindingResult); } configurationManagementService.setBaseUrl(serverSettingsForm.getBaseUrl()); configurationManagementService.setPort(serverSettingsForm.getPort()); return getSuccessfulResponseEntity(SUCCESSFUL_SAVE_SERVER_SETTINGS, acceptHeader); }
Source:
public static @Nullable Set<Integer> getActiveThreadsForRange(KernelAnalysisModule module, long rangeStart, long rangeEnd) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return null; } List<ITmfStateInterval> fullQueryAtStart; int threadsQuark; try { fullQueryAtStart = ss.queryFullState(rangeStart); threadsQuark = ss.getQuarkAbsolute(Attributes.THREADS); } catch (AttributeNotFoundException | StateSystemDisposedException e) { return null; } List<Integer> threadQuarks = ss.getSubAttributes(threadsQuark, false); return threadQuarks.stream() .filter(threadQuark -> { ITmfStateInterval intervalAtStart = fullQueryAtStart.get(threadQuark); if (IS_STATE_VALUE_ACTIVE.test(intervalAtStart.getStateValue())) { return true; } if (intervalAtStart.getEndTime() >= rangeEnd) { return false; } QuarkIterator it = new QuarkIterator(ss, threadQuark, rangeStart, rangeEnd); while (it.hasNext()) { ITmfStateInterval interval = it.next(); if (IS_STATE_VALUE_ACTIVE.test(interval.getStateValue())) { return true; } } return false; }) .map(ss::getAttributeName) .filter(attribName -> !attribName.startsWith(Attributes.THREAD_0_PREFIX)) .map(Integer::parseInt) .collect(Collectors.toSet()); }

Target:
public static @Nullable Set<Integer> getActiveThreadsForRange(KernelAnalysisModule module, long rangeStart, long rangeEnd) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return null; } List<ITmfStateInterval> fullQueryAtStart; int threadsQuark; try { fullQueryAtStart = ss.queryFullState(rangeStart); threadsQuark = ss.getQuarkAbsolute(Attributes.THREADS); } catch (AttributeNotFoundException | StateSystemDisposedException e) { return null; } List<Integer> threadQuarks = ss.getSubAttributes(threadsQuark, false); return threadQuarks.stream() .filter(threadQuark -> { ITmfStateInterval intervalAtStart = fullQueryAtStart.get(threadQuark); if (IS_STATE_VALUE_ACTIVE.test(intervalAtStart.getStateValue())) { return true; } if (intervalAtStart.getEndTime() >= rangeEnd) { return false; } Iterator<ITmfStateInterval> it = new QuarkIterator(ss, threadQuark, rangeStart, rangeEnd); return Iterators.any(it, interval -> IS_STATE_VALUE_ACTIVE.test(interval.getStateValue())); }) .map(ss::getAttributeName) .filter(attribName -> !attribName.startsWith(Attributes.THREAD_0_PREFIX)) .map(Integer::parseInt) .collect(Collectors.toSet()); }
Source:
public void testDoesNotMarkBuildIfPromotionNotGoodEnough() throws Exception { FreeStyleProject upJob = createProject("up"); upJob.getBuildersList().add(successfulBuilder()); FreeStyleProject downJob = createProject("down"); downJob.getBuildersList().add(successfulBuilder()); PromotionProcess promotionJob = createDownstreamSuccessPromotion(upJob, downJob); promotionJob.getBuildSteps().add(new FixedResultBuilder(Result.FAILURE)); promotionJob.getBuildSteps().add(new KeepBuildForeverAction()); for (ItemListener l : ItemListener.all()) { l.onLoaded(); } FreeStyleBuild upBuild = assertBuildStatusSuccess(upJob.scheduleBuild2(0).get()); assertFalse(upBuild.isKeepLog()); assertBuildStatusSuccess(downJob.scheduleBuild2(0).get()); waitForBuild(promotionJob, 1); assertFalse(upBuild.isKeepLog()); }

Target:
public void testDoesNotMarkBuildIfPromotionNotGoodEnough() throws Exception { FreeStyleProject upJob = createProject("up"); upJob.getBuildersList().add(successfulBuilder()); FreeStyleProject downJob = createProject("down"); downJob.getBuildersList().add(successfulBuilder()); PromotionProcess promotionJob = createDownstreamSuccessPromotion(upJob, downJob); promotionJob.getBuildSteps().add(new FixedResultBuilder(Result.FAILURE)); promotionJob.getBuildSteps().add(new KeepBuildForeverAction()); fireItemListeners(); FreeStyleBuild upBuild = assertBuildStatusSuccess(upJob.scheduleBuild2(0).get()); assertFalse(upBuild.isKeepLog()); assertBuildStatusSuccess(downJob.scheduleBuild2(0).get()); waitForBuild(promotionJob, 1); assertFalse(upBuild.isKeepLog()); }
Source:
protected String getSource(String geneId) { if (!geneId.startsWith("ENS")) { return "refseq"; } return "ensembl"; }

Target:
protected String getSource(String geneId) { if (!geneId.startsWith("ENS")) { return VariantDBAdaptor.QueryParams.REFSEQ.key(); } return VariantDBAdaptor.QueryParams.ENSEMBL.key(); }
Source:
public void setUp() throws InjectionException { final Injector injector1 = Tang.Factory.getTang().newInjector(); final String masterHostname = injector1.getNamedInstance(MasterHostname.class); final int taskToMasterPort = injector1.getNamedInstance(TaskToMasterPort.class); final TaskToMasterMessage message = new MockTaskToMasterServer(); mockMasterServer = AvroUtils.createAvroServer(TaskToMasterMessage.class, message, new InetSocketAddress(masterHostname, taskToMasterPort)); final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); jcb.bindNamedParameter(DefaultNumEventProcessors.class, Integer.toString(DEFAULT_NUM_THREADS)); jcb.bindNamedParameter(EventProcessorUpperBound.class, Integer.toString(MAX_NUM_THREADS)); jcb.bindNamedParameter(EventProcessorLowerBound.class, Integer.toString(MIN_NUM_THREADS)); jcb.bindNamedParameter(GracePeriod.class, Integer.toString(0)); jcb.bindImplementation(EventProcessorFactory.class, TestEventProcessorFactory.class); groupRebalancer = mock(GroupRebalancer.class); groupBalancer = new TestGroupAssigner(); final Injector injector2 = Tang.Factory.getTang().newInjector(jcb.build()); injector2.bindVolatileInstance(GroupRebalancer.class, groupRebalancer); injector2.bindVolatileInstance(GroupAssigner.class, groupBalancer); eventProcessorManager = injector2.getInstance(DefaultEventProcessorManager.class); groupAllocationTableModifier = injector2.getInstance(GroupAllocationTableModifier.class); }

Target:
public void setUp() throws InjectionException { final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); jcb.bindNamedParameter(DefaultNumEventProcessors.class, Integer.toString(DEFAULT_NUM_THREADS)); jcb.bindNamedParameter(EventProcessorUpperBound.class, Integer.toString(MAX_NUM_THREADS)); jcb.bindNamedParameter(EventProcessorLowerBound.class, Integer.toString(MIN_NUM_THREADS)); jcb.bindNamedParameter(GracePeriod.class, Integer.toString(0)); jcb.bindImplementation(EventProcessorFactory.class, TestEventProcessorFactory.class); groupRebalancer = mock(GroupRebalancer.class); groupBalancer = new TestGroupAssigner(); groupIdRequestor = mock(GroupIdRequestor.class); final Injector injector = Tang.Factory.getTang().newInjector(jcb.build()); injector.bindVolatileInstance(GroupRebalancer.class, groupRebalancer); injector.bindVolatileInstance(GroupAssigner.class, groupBalancer); injector.bindVolatileInstance(GroupIdRequestor.class, groupIdRequestor); eventProcessorManager = injector.getInstance(DefaultEventProcessorManager.class); groupAllocationTableModifier = injector.getInstance(GroupAllocationTableModifier.class); }
Source:
public static LicenseInformation getLicenseInformation(GitHub gitHub, String repositoryName) { LicenseInformation licenseInformation = new LicenseInformation(); try { GHRepository repository = gitHub.getRepository(repositoryName); GHLicense license = repository.getLicense(); if (license == null) { return new LicenseInformation(); } licenseInformation.setLicenseName(license.getName()); return licenseInformation; } catch (IOException e) { return new LicenseInformation(); } }

Target:
public static LicenseInformation getLicenseInformation(GitHub gitHub, String repositoryName) { try { GHRepository repository = gitHub.getRepository(repositoryName); GHLicense license = repository.getLicense(); if (license == null) { return new LicenseInformation(); } LicenseInformation licenseInformation = new LicenseInformation(); licenseInformation.setLicenseName(license.getName()); return licenseInformation; } catch (IOException e) { LOG.info("Could not get license information from GitHub for repository: " + repositoryName, e); return new LicenseInformation(); } }
Source:
private void addPendingData(Collection<Data> data) { Collection<Data> filteredData = data; if (distributed) { filteredData = new ArrayList<>(data); for (Iterator<Data> i = filteredData.iterator(); i.hasNext(); ) { Data d = i.next(); if (!alertsEngineCache.isDataIdActive(d.getId())) { i.remove(); } } } else synchronized (pendingData) { pendingData.addAll(filteredData); } }

Target:
private void addPendingData(Collection<Data> data) { Collection<Data> filteredData = data; if (distributed) { filteredData = new ArrayList<>(data); for (Iterator<Data> i = filteredData.iterator(); i.hasNext(); ) { Data d = i.next(); if (!alertsEngineCache.isDataIdActive(d.getId())) { i.remove(); } } } synchronized (pendingData) { pendingData.addAll(filteredData); } }
Source:
protected String retrieveResponseFromServer(final URL validationUrl, final String ticket) { final String request = String.format( SAML_REQUEST_TEMPLATE, generateId(), CommonUtils.formatForUtcTime(new Date()), ticket); HttpURLConnection conn = null; try { conn = this.getURLConnectionFactory().buildHttpURLConnection(validationUrl.openConnection()); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "text/xml"); conn.setRequestProperty("Content-Type", "text/xml"); conn.setRequestProperty("Content-Length", Integer.toString(request.length())); conn.setRequestProperty("SOAPAction", "<LINK_0>"); conn.setUseCaches(false); conn.setDoInput(true); conn.setDoOutput(true); final Charset charset = CommonUtils.isNotBlank(getEncoding()) ? Charset.forName(getEncoding()) : IOUtils.UTF8; conn.getOutputStream().write(request.getBytes(charset)); conn.getOutputStream().flush(); return IOUtils.readString(conn.getInputStream(), charset); } catch (final IOException e) { throw new RuntimeException("IO error sending HTTP request to /samlValidate", e); } finally { if (conn != null) { conn.disconnect(); } } }

Target:
protected String retrieveResponseFromServer(final URL validationUrl, final String ticket) { final String request = String.format( SAML_REQUEST_TEMPLATE, generateId(), SamlUtils.formatForUtcTime(new Date()), ticket); HttpURLConnection conn = null; try { conn = this.getURLConnectionFactory().buildHttpURLConnection(validationUrl.openConnection()); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "text/xml"); conn.setRequestProperty("Content-Length", Integer.toString(request.length())); conn.setRequestProperty("SOAPAction", "<LINK_0>"); conn.setUseCaches(false); conn.setDoInput(true); conn.setDoOutput(true); final Charset charset = CommonUtils.isNotBlank(getEncoding()) ? Charset.forName(getEncoding()) : IOUtils.UTF8; conn.getOutputStream().write(request.getBytes(charset)); conn.getOutputStream().flush(); return IOUtils.readString(conn.getInputStream(), charset); } catch (final IOException e) { throw new RuntimeException("IO error sending HTTP request to /samlValidate", e); } finally { if (conn != null) { conn.disconnect(); } } }
Source:
private void fillReferencePointManager( IReferencePointManager referencePointManager, IProject project) { referencePointManager.putIfAbsent(project.getReferencePoint(), project); intelliJReferencePointManager.putIfAbsent( project.getReferencePoint(), ((IntelliJProjectImpl) project).getModule()); }

Target:
private void fillReferencePointManager( IReferencePointManager referencePointManager, IProject project) { referencePointManager.putIfAbsent(project.getReferencePoint(), project); intelliJReferencePointManager.putIfAbsent( project.getReferencePoint(), project.adaptTo(IntelliJProjectImpl.class).getModule()); }
Source:
static Settings filter(Settings originalSettings) { Settings.Builder settings = Settings.builder().put(originalSettings); settings.remove(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey()); settings.remove(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey()); settings.remove(IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey()); settings.remove(IndexMetadata.SETTING_INDEX_UUID); settings.remove(IndexMetadata.SETTING_RESTORE_UUID); settings.remove(IndexMetadata.SETTING_INDEX_PROVIDED_NAME); settings.remove(IndexMetadata.SETTING_CREATION_DATE); settings.remove(IndexMetadata.SETTING_VERSION_UPGRADED); settings.remove(IndexMetadata.SETTING_VERSION_UPGRADED_STRING); Iterator<String> iterator = settings.keys().iterator(); while (iterator.hasNext()) { String key = iterator.next(); for (Setting<?> whitelistedSetting : NON_REPLICATED_SETTINGS) { if (whitelistedSetting.match(key)) { iterator.remove(); break; } } } return settings.build(); }

Target:
static Settings filter(Settings originalSettings) { Settings.Builder settings = Settings.builder().put(originalSettings); settings.remove(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey()); settings.remove(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey()); settings.remove(IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey()); settings.remove(IndexMetadata.SETTING_INDEX_UUID); settings.remove(IndexMetadata.SETTING_HISTORY_UUID); settings.remove(IndexMetadata.SETTING_INDEX_PROVIDED_NAME); settings.remove(IndexMetadata.SETTING_CREATION_DATE); settings.remove(IndexMetadata.SETTING_VERSION_UPGRADED); settings.remove(IndexMetadata.SETTING_VERSION_UPGRADED_STRING); Iterator<String> iterator = settings.keys().iterator(); while (iterator.hasNext()) { String key = iterator.next(); for (Setting<?> whitelistedSetting : NON_REPLICATED_SETTINGS) { if (whitelistedSetting.match(key)) { iterator.remove(); break; } } } return settings.build(); }
Source:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("<replace-with-your-text-analytics-key-here>") .endpoint("<replace-with-your-text-analytics-endpoint-here>") .buildClient(); String text = "The hotel was dark and unclean."; final AnalyzeSentimentResult sentimentResult = client.analyzeSentiment(text); final TextSentiment documentSentiment = sentimentResult.getDocumentSentiment(); System.out.printf( "Recognized sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", documentSentiment.getTextSentimentClass(), documentSentiment.getPositiveScore(), documentSentiment.getNeutralScore(), documentSentiment.getNegativeScore()); final List<TextSentiment> sentiments = sentimentResult.getSentenceSentiments(); for (TextSentiment textSentiment : sentiments) { System.out.printf( "Recognized sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", textSentiment.getTextSentimentClass(), textSentiment.getPositiveScore(), textSentiment.getNeutralScore(), textSentiment.getNegativeScore()); } }

Target:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("{subscription_key}") .endpoint("https://{servicename}.cognitiveservices.azure.com/") .buildClient(); String text = "The hotel was dark and unclean."; final AnalyzeSentimentResult sentimentResult = client.analyzeSentiment(text); final TextSentiment documentSentiment = sentimentResult.getDocumentSentiment(); System.out.printf( "Recognized sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", documentSentiment.getTextSentimentClass(), documentSentiment.getPositiveScore(), documentSentiment.getNeutralScore(), documentSentiment.getNegativeScore()); for (TextSentiment textSentiment : sentimentResult.getSentenceSentiments()) { System.out.printf( "Recognized sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", textSentiment.getTextSentimentClass(), textSentiment.getPositiveScore(), textSentiment.getNeutralScore(), textSentiment.getNegativeScore()); } }
Source:
public static void purgeExpiredJobs(String workflow, Set<String> expiredJobs, HelixManager manager, RebalanceScheduler rebalanceScheduler) { Set<String> failedJobRemovals = new HashSet<>(); for (String job : expiredJobs) { if (!TaskUtil .removeJob(manager.getHelixDataAccessor(), manager.getHelixPropertyStore(), job)) { failedJobRemovals.add(job); LOG.warn("Failed to clean up expired and completed jobs from workflow " + workflow); } rebalanceScheduler.removeScheduledRebalance(job); } expiredJobs.removeAll(failedJobRemovals); if (!TaskUtil.removeJobsFromDag(manager.getHelixDataAccessor(), workflow, expiredJobs, true)) { LOG.warn("Error occurred while trying to remove jobs + " + expiredJobs + " from the workflow " + workflow); } if (expiredJobs.size() > 0) { HelixDataAccessor accessor = manager.getHelixDataAccessor(); List<String> resourceConfigs = accessor.getChildNames(accessor.keyBuilder().resourceConfigs()); if (resourceConfigs.size() > 0) { RebalanceUtil.scheduleOnDemandPipeline(manager.getClusterName(), 0L); } else { LOG.warn("No resource config to trigger rebalance for clean up contexts for" + expiredJobs); } } }

Target:
public static void purgeExpiredJobs(String workflow, Set<String> expiredJobs, HelixManager manager, RebalanceScheduler rebalanceScheduler) { Set<String> failedJobRemovals = new HashSet<>(); for (String job : expiredJobs) { if (!TaskUtil .removeJob(manager.getHelixDataAccessor(), manager.getHelixPropertyStore(), job)) { failedJobRemovals.add(job); LOG.warn("Failed to clean up expired and completed jobs from workflow {}!", workflow); } rebalanceScheduler.removeScheduledRebalance(job); } expiredJobs.removeAll(failedJobRemovals); if (!TaskUtil.removeJobsFromDag(manager.getHelixDataAccessor(), workflow, expiredJobs, true)) { LOG.warn("Error occurred while trying to remove jobs from the workflow {}!", expiredJobs, workflow); } if (expiredJobs.size() > 0) { HelixDataAccessor accessor = manager.getHelixDataAccessor(); List<String> resourceConfigs = accessor.getChildNames(accessor.keyBuilder().resourceConfigs()); if (resourceConfigs.size() > 0) { RebalanceUtil.scheduleOnDemandPipeline(manager.getClusterName(), 0L); } else { LOG.warn("No resource config to trigger rebalance for clean up contexts for {}!", expiredJobs); } } }
Source:
public synchronized void close() throws IOException { if (closed) { return; } closeData(); BCFile.Writer.BlockAppender mba = fileWriter.prepareMetaBlock("RFile.index"); mba.writeInt(RINDEX_MAGIC); mba.writeInt(RINDEX_VER_8); if (currentLocalityGroup != null) { localityGroups.add(currentLocalityGroup); sampleGroups.add(sampleLocalityGroup); } mba.writeInt(localityGroups.size()); for (LocalityGroupMetadata lc : localityGroups) { lc.write(mba); } if (samplerConfig == null) { mba.writeBoolean(false); } else { mba.writeBoolean(true); for (LocalityGroupMetadata lc : sampleGroups) { lc.write(mba); } samplerConfig.write(mba); } mba.close(); fileWriter.close(); length = fileWriter.getLength(); closed = true; }

Target:
public synchronized void close() throws IOException { if (closed) { return; } closeData(); BlockAppender mba = fileWriter.prepareMetaBlock("RFile.index"); mba.writeInt(RINDEX_MAGIC); mba.writeInt(RINDEX_VER_8); if (currentLocalityGroup != null) { localityGroups.add(currentLocalityGroup); sampleGroups.add(sampleLocalityGroup); } mba.writeInt(localityGroups.size()); for (LocalityGroupMetadata lc : localityGroups) { lc.write(mba); } if (samplerConfig == null) { mba.writeBoolean(false); } else { mba.writeBoolean(true); for (LocalityGroupMetadata lc : sampleGroups) { lc.write(mba); } samplerConfig.write(mba); } mba.close(); fileWriter.close(); length = fileWriter.getLength(); closed = true; }
Source:
public void testIllegalClassessRegularExpression() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IllegalImportCheck.class); checkConfig.addAttribute("illegalClasses", "^java\\.util\\.(List|Arrays).*"); checkConfig.addAttribute("regexp", "true"); final String[] expected = { "12:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "13:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "17:1: " + getCheckMessage(MSG_KEY, "java.util.Arrays"), }; verify(checkConfig, getPath("InputIllegalImport.java"), expected); }

Target:
public void testIllegalClassessRegularExpression() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IllegalImportCheck.class); checkConfig.addAttribute("illegalPkgs", ""); checkConfig.addAttribute("illegalClasses", "^java\\.util\\.(List|Arrays)"); checkConfig.addAttribute("regexp", "true"); final String[] expected = { "12:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "13:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "17:1: " + getCheckMessage(MSG_KEY, "java.util.Arrays"), }; verify(checkConfig, getPath("InputIllegalImport.java"), expected); }
Source:
DruidErrorCode(int code, ErrorType type) { errorCode = new ErrorCode(code + 0x0100_0000, name(), type); }

Target:
DruidErrorCode(int code, ErrorType type) { errorCode = new ErrorCode(code + 0x0506_0000, name(), type); }
Source:
public List<PartitionDescProto> getPartitionsByAlgebra(PartitionsByAlgebraProto request) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException, UndefinedOperatorException { try { final BlockingInterface stub = getStub(); GetPartitionsResponse response = stub.getPartitionsByAlgebra(null, request); ensureOk(response.getState()); return response.getPartitionList(); } catch (ServiceException e) { LOG.error(e.getMessage(), e); return null; } }

Target:
public List<PartitionDescProto> getPartitionsByAlgebra(PartitionsByAlgebraProto request) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException { try { final BlockingInterface stub = getStub(); GetPartitionsResponse response = stub.getPartitionsByAlgebra(null, request); throwsIfThisError(response.getState(), UndefinedDatabaseException.class); throwsIfThisError(response.getState(), UndefinedTableException.class); throwsIfThisError(response.getState(), UndefinedPartitionMethodException.class); ensureOk(response.getState()); return response.getPartitionList(); } catch (ServiceException e) { LOG.error(e.getMessage(), e); return null; } }
Source:
public void requestBegin(HttpClientRequest request) { if (!isEnabled()) return; timings.put(request, time(null, null)); }

Target:
public void requestBegin(HttpClientRequest request) { if (!isEnabled()) return; timings.put(request, time(request.method(), request.uri())); }
Source:
private void handleMessageWaiting(EslEvent event) { logger.debug(String.format("MWI event\\n %s", event.toString())); for(String key : event.getEventHeaders().keySet()){ logger.debug(String.format("MWI Message header %s : %s", key,event.getEventHeaders().get(key))); } String account = null; try { account = URLDecoder.decode(getHeader(event, FS_MWI_ACCOUNT), "UTF-8"); } catch (UnsupportedEncodingException e) { logger.error("Could not decode account", e); return; } boolean waiting = "yes".equalsIgnoreCase(getHeader(event, FS_MWI_WAITING)); String messagesString = getHeader(event, FS_MWI_MESSAGE); logger.debug(String.format("Message header: %s", messagesString)); if(StringUtils.isBlank(messagesString)){ logger.warn("Invalid message string, aborting"); return; } Pattern pattern = Pattern.compile("([0-9]+)/([0-9]+)\\s\\([0-9]+\\/[0-9]+\\)"); Matcher matcher = pattern.matcher(messagesString); int messages = 0; if(matcher.matches()){ logger.debug("trying to parse message number"); try { messages = Integer.parseInt(matcher.group(1)); } catch (Exception e) { logger.warn("Could not parse message number", e); } } logger.debug(String.format("Updating MWI to %d VMs", messages)); mwiCache.put(account, new MWIModel(waiting, messages)); updateMessageWaitingItems(); }

Target:
private void handleMessageWaiting(EslEvent event) { logger.debug("MWI event\\n {}", event.toString()); for(String key : event.getEventHeaders().keySet()){ logger.debug("MWI Message header : {}", key,event.getEventHeaders().get(key)); } String account = null; try { account = URLDecoder.decode(getHeader(event, MWI_ACCOUNT), "UTF-8"); } catch (UnsupportedEncodingException e) { logger.error("Could not decode account for event : {}", event, e); return; } boolean waiting = "yes".equalsIgnoreCase(getHeader(event, MWI_WAITING)); String messagesString = getHeader(event, MWI_MESSAGE); logger.debug("Message header: {}", messagesString); if(StringUtils.isBlank(messagesString)){ logger.debug("message is not for us."); return; } Pattern pattern = Pattern.compile("([0-9]+)/([0-9]+)\\s\\([0-9]+\\/[0-9]+\\)"); Matcher matcher = pattern.matcher(messagesString); int messages = 0; if(matcher.matches()){ logger.debug("trying to parse message number ", matcher.group(1)); try { messages = Integer.parseInt(matcher.group(1)); } catch (Exception e) { logger.warn("Could not parse message number from message : {}", messagesString, e); } } logger.debug("Updating MWI to VMs", messages); mwiCache.put(account, new MWIModel(waiting, messages)); updateMessageWaitingItems(); }
Source:
public IContext2D toContext2D(final AbstractCanvasHandler canvasHandler, final CanvasExportSettings settings) { final LienzoLayer layer = getLayer(canvasHandler); final com.ait.lienzo.client.core.shape.Layer lienzoLayer = layer.getLienzoLayer(); final int[] bounds = boundsProvider.compute(layer, settings); final IContext2D svgContext2D = Context2DFactory.create(new SvgExportSettings(bounds[0], bounds[1], lienzoLayer.getContext())); lienzoLayer.draw(); lienzoLayer.draw(new Context2D(new DelegateNativeContext2D(svgContext2D, canvasHandler))); lienzoLayer.draw(); return svgContext2D; }

Target:
public IContext2D toContext2D(final AbstractCanvasHandler canvasHandler, final CanvasExportSettings settings) { final LienzoLayer layer = getLayer(canvasHandler); final com.ait.lienzo.client.core.shape.Layer lienzoLayer = layer.getLienzoLayer(); final Viewport viewport = lienzoLayer.getViewport(); final int[] bounds = boundsProvider.compute(layer, settings); final IContext2D svgContext2D = Context2DFactory.create(new SvgExportSettings(bounds[2], bounds[3], lienzoLayer.getContext())); final Transform transform = viewport.getTransform(); viewport.setTransform(new Transform()); lienzoLayer.draw(new Context2D(new DelegateNativeContext2D(svgContext2D, canvasHandler))); viewport.setTransform(transform); return svgContext2D; }
Source:
public StoredProcExecutor(DataSource dataSource) { Assert.notNull(dataSource, "dataSource must not be null."); this.dataSource = dataSource; if (!guavaPresent) { this.jdbcCallOperationsMap = new LinkedHashMap<String, SimpleJdbcCallOperations>() { @Override protected boolean removeEldestEntry(Entry<String, SimpleJdbcCallOperations> eldest) { return size() > jdbcCallOperationsCacheSize; } }; } else { this.jdbcCallOperationsMap = null; } }

Target:
public StoredProcExecutor(DataSource dataSource) { Assert.notNull(dataSource, "dataSource must not be null."); this.dataSource = dataSource; }
Source:
private void postError(final ObjectServerError error) { if (callback != null) { handler.post(new Runnable() { @Override public void run() { try { callback.onError(error); } catch (Exception e) { RealmLog.debug("onError has thrown an exception that is being ignored: %s", Util.getStackTrace(e)); } } }); } }

Target:
private void postError(final ObjectServerError error) { boolean errorHandled = false; if (callback != null) { Runnable action = new Runnable() { @Override public void run() { callback.onError(error); } }; errorHandled = handler.post(action); } if (!errorHandled) { RealmLog.error(error, "An error was thrown, but could not be handled."); } }
Source:
private Flavor getFlavor() { return flavorApi.list().iterator().next(); }

Target:
private Flavor getFlavor() { return Iterables.getFirst(flavorApi.list(), null); }
Source:
public boolean isOpened() { switchToAuthModalHandle(); boolean isOpenedResult = registerAuthModal.isDisplayed(); switchToMainWindowHandle(); return isOpenedResult; }

Target:
public boolean isOpened() { switchToAuthModalHandle(); try { wait.forElementVisible(registerAuthModal); } catch (NoSuchElementException e) { PageObjectLogging.logInfo("Register Auth Modal is not displayed"); return false; } switchToMainWindowHandle(); return true; }
Source:
public void afterAdded(@NotNull RangeHighlighterEx rangeHighlighterEx) { if (rangeHighlighterEx.getLayer() == HighlighterLayer.WARNING) { addCreatedWarning(StaticAnalysisType.UNKNOWN); } }

Target:
public void afterAdded(@NotNull RangeHighlighterEx rangeHighlighterEx) { if (rangeHighlighterEx.getLayer() == HighlighterLayer.WARNING) { this.generatedWarnings.add(rangeHighlighterEx); } }
Source:
private Boolean hasJoinedCluster() { return Optional.fromNullable(entity.getAttribute(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER)).or(Boolean.FALSE); }

Target:
private Boolean hasJoinedCluster() { return ((RiakNode) entity).hasJoinedCluster(); }
Source:
private void prepareDnsTlsMeasurement(String hostname, InetAddress target) { if (!mDnsTlsChecks.containsKey(target) || !TextUtils.isEmpty(hostname)) { Measurement measurement = new Measurement(); measurement.thread = new Thread(new DnsTlsCheck(hostname, target, measurement)); mDnsTlsChecks.put(target, measurement); } }

Target:
private void prepareDnsTlsMeasurement(String hostname, InetAddress target) { if (mDnsTlsChecks.containsKey(target) && TextUtils.isEmpty(hostname)) return; Measurement measurement = new Measurement(); measurement.thread = new Thread(new DnsTlsCheck(hostname, target, measurement)); mDnsTlsChecks.put(target, measurement); }
Source:
public void testScheduleWork() throws WorkException, InterruptedException { log.info("Running testScheduleWork()"); long startTime = System.currentTimeMillis(); int scheduleWorkAcceptedServer1 = server1Proxy.getScheduleWorkAccepted(); int scheduleWorkAcceptedServer2 = server2Proxy.getScheduleWorkAccepted(); int distributedScheduleWorkAccepted = server2Proxy.getDistributedScheduleWorkAccepted(); for (int i = 0; i < SRT_MAX_THREADS + 1; i++) { server1Proxy.scheduleWork(new LongWork().setName("testScheduleWork-work" + (i + 1))); } Assert.assertTrue("Expected time < " + (startTime + LongWork.WORK_TIMEOUT) + ", actual: " + System.currentTimeMillis(), startTime + LongWork.WORK_TIMEOUT > System.currentTimeMillis()); Thread.sleep(LongWork.WORK_TIMEOUT * 2 + 100); logWorkStats(); Assert.assertTrue("Expected scheduleWorkAccepted = " + (scheduleWorkAcceptedServer1 + SRT_MAX_THREADS + 1) + " but was: " + server1Proxy.getScheduleWorkAccepted(), (server1Proxy.getScheduleWorkAccepted() == scheduleWorkAcceptedServer1 + SRT_MAX_THREADS + 1) && (server2Proxy.getScheduleWorkAccepted() == scheduleWorkAcceptedServer2)); }

Target:
public void testScheduleWork() throws WorkException, InterruptedException { int scheduleWorkAcceptedServer1 = server1Proxy.getScheduleWorkAccepted(); int distributedScheduleWorkAccepted = server2Proxy.getDistributedScheduleWorkAccepted(); for (int i = 0; i < SRT_MAX_THREADS + 1; i++) { server1Proxy.scheduleWork(new LongWork()); } Assert.assertTrue("Work did not finish in the expected time on the expected node", waitForScheduleWork(server1Proxy, scheduleWorkAcceptedServer1 + SRT_MAX_THREADS + 1, TimeoutUtil.adjust(WORK_FINISH_MAX_TIMEOUT))); Assert.assertTrue("Expected distributedScheduleWorkAccepted = " + (distributedScheduleWorkAccepted + SRT_MAX_THREADS + 1) + " but was: " + server2Proxy.getDistributedScheduleWorkAccepted(), server2Proxy.getDistributedScheduleWorkAccepted() == distributedScheduleWorkAccepted + SRT_MAX_THREADS + 1); }
Source:
public Map<String, Resource> exportReportsOf(final Object source) { final Map<String, Resource> reportResources = new HashMap<>(); final Map<String, ExportReportInstruction> instructions = getScopedExportInstruction(); instructions.entrySet() .forEach(config -> { final File destination = IO.getFile(_processor.getBase(), cleanKey(config.getKey())); final ExportReportInstruction instruction = config.getValue(); final Map.Entry<String, Resource> templateResource = getTemplateResource(instruction, destination, _processor.getBase()); if (templateResource != null) { reportResources.put(destination.getPath(), new EmbeddedResource(transform(source, instruction.locale() .orElse(""), config.getValue() .configName() .orElse(""), templateResource.getValue(), templateResource.getKey(), instruction.parameters()), 0L)); } else { reportResources.put(destination.getPath(), new EmbeddedResource(getGeneratedReport(source, config.getValue() .locale() .orElse(""), config.getValue() .configName() .orElse(""), FileHelper.getExtension(destination)), 0L)); } }); return reportResources; }

Target:
public Map<String, Resource> exportReportsOf(final Object source) { final Map<String, Resource> reportResources = new HashMap<>(); final Map<String, ExportReportInstruction> instructions = getScopedExportInstruction(); instructions.entrySet() .forEach(config -> { final File destination = IO.getFile(_processor.getBase(), Processor.removeDuplicateMarker(config.getKey())); final ExportReportInstruction instruction = config.getValue(); final Map.Entry<String, Resource> templateResource = getTemplateResource(instruction, destination, _processor.getBase()); if (templateResource != null) { reportResources.put(destination.getPath(), new EmbeddedResource(transform(source, instruction.locale() .orElse(""), config.getValue() .configName() .orElse(""), templateResource.getValue(), templateResource.getKey(), instruction.parameters()), 0L)); } else { reportResources.put(destination.getPath(), new EmbeddedResource(getGeneratedReport(source, config.getValue() .locale() .orElse(""), config.getValue() .configName() .orElse(""), FileHelper.getExtension(destination)), 0L)); } }); return reportResources; }
Source:
public void serialize(T value, DataOutputView target) throws IOException { this.writer = new Output((OutputStream)target); this.kryoSerializer.register(type); this.kryoSerializer.writeClassAndObject(this.writer, value); this.writer.close(); }

Target:
public void serialize(T value, DataOutputView target) throws IOException { this.writer = new Output((OutputStream)target); this.kryoSerializer.writeClassAndObject(this.writer, value); this.writer.close(); }
Source:
public EmailSendingStatus sendEmail(EmailWrapper email) { sentEmails.add(email); return new EmailSendingStatus(200, null); }

Target:
public EmailSendingStatus sendEmail(EmailWrapper email) { sentEmails.add(email); return new EmailSendingStatus(HttpStatus.SC_OK, null); }
Source:
public static Collection<Object[]> data() { System.setProperty(OCS_ENABLED, "true"); final ClassLoader classLoader = ExtensionModelJsonGeneratorTestCase.class.getClassLoader(); final ServiceRegistry serviceRegistry = mock(ServiceRegistry.class); when(serviceRegistry.lookupProviders(DeclarationEnricher.class, classLoader)) .thenReturn(asList(new JavaXmlDeclarationEnricher())); List<ExtensionJsonGeneratorTestUnit> extensions; extensions = asList(newTestUnit(javaLoader, TestOAuthExtension.class, "test-oauth-ocs.json")); BiFunction<Class<?>, ExtensionModelLoader, ExtensionModel> createExtensionModel = (extension, loader) -> { ExtensionModel model = loadExtension(extension, loader); if (extensionModels.put(model.getName(), model) != null) { throw new IllegalArgumentException(format("Extension names must be unique. Name [%s] for extension [%s] was already used", model.getName(), extension.getName())); } return model; }; return extensions.stream() .map(e -> e.toTestParams(createExtensionModel)) .collect(toList()); }

Target:
public static Collection<Object[]> data() { List<ExtensionJsonGeneratorTestUnit> extensions = Collections.singletonList(newTestUnit(javaLoader, TestOAuthExtension.class, "test-oauth-ocs.json")); try { return callWithProperty(OCS_ENABLED, "true", () -> createExtensionModels(extensions)); } catch (Throwable t) { throw new RuntimeException("Failed to create the extension models for the test.", t); } }
Source:
private BiPredicate<PendingCertificationResultTestToolDTO, PendingCertificationResultTestToolDTO> getPredicate() { return new BiPredicate<PendingCertificationResultTestToolDTO, PendingCertificationResultTestToolDTO>() { @Override public boolean test(final PendingCertificationResultTestToolDTO dto1, final PendingCertificationResultTestToolDTO dto2) { if (dto1.getName() != null && dto2.getName() != null && dto1.getVersion() != null && dto2.getVersion() != null) { return dto1.getName().equals(dto2.getName()) && dto1.getVersion().equals(dto2.getVersion()); } else { return false; } } }; }

Target:
private BiPredicate<PendingCertificationResultTestToolDTO, PendingCertificationResultTestToolDTO> getPredicate() { return new BiPredicate<PendingCertificationResultTestToolDTO, PendingCertificationResultTestToolDTO>() { @Override public boolean test(final PendingCertificationResultTestToolDTO dto1, final PendingCertificationResultTestToolDTO dto2) { return ObjectUtils.allNotNull(dto1.getName(), dto2.getName(), dto1.getVersion(), dto2.getVersion()) && dto1.getName().equals(dto2.getName()) && dto1.getVersion().equals(dto2.getVersion()); } }; }