auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void putMultiparts(List<MultipartAttachmentWriter> multiparts) { Log.v(LOG_TAG, "putMultiparts(), parts: " + multiparts); for (MultipartAttachmentWriter mpw : multiparts) { couchClient.putMultipart(mpw); } }

Target:
public List<Response> putMultiparts(List<MultipartAttachmentWriter> multiparts) { Log.v(LOG_TAG, "putMultiparts(), parts: " + multiparts); ArrayList<Response> responses = new ArrayList<Response>(); for (MultipartAttachmentWriter mpw : multiparts) { Response r = couchClient.putMultipart(mpw); responses.add(r); } return responses; }
Source:
private static PrivateKey readPrivateKey(File file) throws IOException, GeneralSecurityException { DataInputStream input = new DataInputStream(new FileInputStream(file)); try { byte[] bytes = new byte[(int) file.length()]; input.read(bytes); PKCS8EncodedKeySpec spec = decryptPrivateKey(bytes, file); if (spec == null) { spec = new PKCS8EncodedKeySpec(bytes); } @SuppressWarnings("resource") ASN1InputStream bIn = new ASN1InputStream(new ByteArrayInputStream(spec.getEncoded())); PrivateKeyInfo pki = PrivateKeyInfo.getInstance(bIn.readObject()); String algOid = pki.getPrivateKeyAlgorithm().getAlgorithm().getId(); return KeyFactory.getInstance(algOid).generatePrivate(spec); } finally { input.close(); } }

Target:
private static PrivateKey readPrivateKey(File file) throws IOException, GeneralSecurityException { DataInputStream input = new DataInputStream(new FileInputStream(file)); try { byte[] bytes = new byte[(int) file.length()]; input.read(bytes); PKCS8EncodedKeySpec spec = decryptPrivateKey(bytes, file); if (spec == null) { spec = new PKCS8EncodedKeySpec(bytes); } PrivateKeyInfo pki; try (ASN1InputStream bIn = new ASN1InputStream(new ByteArrayInputStream(spec.getEncoded()))) { pki = PrivateKeyInfo.getInstance(bIn.readObject()); } String algOid = pki.getPrivateKeyAlgorithm().getAlgorithm().getId(); return KeyFactory.getInstance(algOid).generatePrivate(spec); } finally { input.close(); } }
Source:
public void removeLaunches(ILaunch[] launches) { List<ILaunch> removed = new ArrayList<>(launches.length); for (ILaunch launche : launches) { if (internalRemoveLaunch(launche)) { removed.add(launche); } } if (!removed.isEmpty()) { ILaunch[] removedLaunches = removed.toArray(new ILaunch[removed.size()]); fireUpdate(removedLaunches, REMOVED); for (ILaunch removedLaunche : removedLaunches) { fireUpdate(removedLaunche, REMOVED); } } }

Target:
public void removeLaunches(ILaunch[] launches) { List<ILaunch> removed = new ArrayList<>(launches.length); for (ILaunch launch : launches) { if (internalRemoveLaunch(launch)) { removed.add(launch); } } if (!removed.isEmpty()) { ILaunch[] removedLaunches = removed.toArray(new ILaunch[removed.size()]); fireUpdate(removedLaunches, REMOVED); for (ILaunch launch : removedLaunches) { fireUpdate(launch, REMOVED); } } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); EZ.setContext(this); FileStatusNotificationsManager.get().showFilesLocking(); FileStatusNotificationsManager.get().showFilesUnlocking(); FileStatusNotificationsManager.get().showFilesUnlocked(); mSharing = new APSharing(this); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); PackageManager pm = getPackageManager(); ComponentName homeName = new ComponentName(this, HomeActivity.class); if (pm.getComponentEnabledSetting(homeName) == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT){ Log.w("Hiding: Disable", "Disabling app drawer icon."); pm.setComponentEnabledSetting(homeName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Utils.setContext(this); mSharing = new APSharing(this); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); PackageManager pm = getPackageManager(); ComponentName homeName = new ComponentName(this, HomeActivity.class); if (pm.getComponentEnabledSetting(homeName) == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT){ Log.w("Hiding: Disable", "Disabling app drawer icon."); pm.setComponentEnabledSetting(homeName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } }
Source:
public SetDataRequestDto(final List<SetDataSystemIdentifierDto> setDataSystemIdentifiers) { super(); this.setDataSystemIdentifiers = setDataSystemIdentifiers; }

Target:
public SetDataRequestDto(final List<SetDataSystemIdentifierDto> setDataSystemIdentifiers) { this.setDataSystemIdentifiers = new ArrayList<>(setDataSystemIdentifiers); }
Source:
public void randomSleepDelay(){ try{ TimeUnit.SECONDS.sleep((long)(Math.random() * range + offset)); }catch(InterruptedException e){ e.printStackTrace(); } }

Target:
public void randomSleepDelay(){ try{ TimeUnit.SECONDS.sleep((long)(Math.random() * range)); }catch(InterruptedException e){ e.printStackTrace(); } }
Source:
public void writeAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) throws BulkCacheWritingException, Exception { System.out.println("WriteAll " + entries); lock.writeLock().lock(); try { for (Entry<? extends K, ? extends V> entry : entries) { data.put(entry.getKey(), new Pair<K, V>(entry.getKey(), entry.getValue())); if(latch != null) latch.countDown(); } } finally { lock.writeLock().unlock(); } }

Target:
public void writeAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) throws BulkCacheWritingException, Exception { lock.writeLock().lock(); try { for (Entry<? extends K, ? extends V> entry : entries) { data.put(entry.getKey(), new Pair<K, V>(entry.getKey(), entry.getValue())); if(latch != null) latch.countDown(); } } finally { lock.writeLock().unlock(); } }
Source:
public MobileSpecialUserLogin(WebDriver driver) { super(driver); PageFactory.initElements(driver, this); }

Target:
public MobileSpecialUserLogin(WebDriver driver) { super(driver); }
Source:
private String formatProxyAddress(String consoleProxyUrlDomain, String proxyIpAddress) { StringBuffer sb = new StringBuffer(); if (consoleProxyUrlDomain != null && consoleProxyUrlDomain.startsWith("*")) { sb.append(proxyIpAddress.replaceAll("\\.", "-")); sb.append(consoleProxyUrlDomain.substring(1)); } else if (StringUtils.isNotBlank(consoleProxyUrlDomain)) { sb.append(consoleProxyUrlDomain); } else { sb.append(proxyIpAddress); } return sb.toString(); }

Target:
private String formatProxyAddress(String consoleProxyUrlDomain, String proxyIpAddress) { StringBuffer sb = new StringBuffer(); if (StringUtils.isBlank(consoleProxyUrlDomain)) { sb.append(proxyIpAddress); } else if (consoleProxyUrlDomain.startsWith("*")) { sb.append(proxyIpAddress.replaceAll("\\.", "-")); sb.append(consoleProxyUrlDomain.substring(1)); } else { sb.append(consoleProxyUrlDomain); } return sb.toString(); }
Source:
public boolean equals(Object o) { if (o instanceof Vector2d) { Vector2d v = (Vector2d) o; return (Math.abs(x - v.getX()) < .001) && (Math.abs(y - v.getY()) < .001); } return false; }

Target:
public boolean equals(Object o) { if (o instanceof Vector2d) { Vector2d v = (Vector2d) o; return (Math.abs(x - v.getX()) < DBL_EPSILON) && (Math.abs(y - v.getY()) < DBL_EPSILON); } return false; }
Source:
protected Control createControl(Composite parent) { CTConfiguration config = new CTConfiguration(parent, CTConfiguration.STYLE_GRID); config.setHorizontalAlignment(SWT.CENTER); config.setCellSelectionEnabled(false); config.setColumnSelectionEnabled(false); config.setRowSelectionEnabled(false); config.setColumnHeaderLayout(CTConfiguration.COLUMN_HEADER_LAYOUT_FILL_EQUAL); config.setRowHeaderLayout(CTConfiguration.ROW_HEADER_LAYOUT_DEFAULT); this.table = new ComponentTable(parent, SWT.FULL_SELECTION, config); return this.table.getControl(); }

Target:
protected Control createControl(Composite parent) { CTConfiguration config = new CTConfiguration(parent, CTConfiguration.STYLE_GRID); config.setHorizontalAlignment(SWT.CENTER); config.setCellSelectionEnabled(false); config.setColumnSelectionEnabled(false); config.setRowSelectionEnabled(false); config.setColumnHeaderLayout(CTConfiguration.COLUMN_HEADER_LAYOUT_FILL_EQUAL); config.setRowHeaderLayout(CTConfiguration.ROW_HEADER_LAYOUT_DEFAULT); this.table = new ComponentTable(parent, SWT.NONE, config); return this.table.getControl(); }
Source:
public List<QuotaConsumptionParameter> getQuotaVdsConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); list.add(new QuotaVdsGroupConsumptionParameter( getParameters().getVmStaticData().getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, getParameters().getVmStaticData().getvds_group_id(), 0, 0)); return list; }

Target:
public List<QuotaConsumptionParameter> getQuotaVdsConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); list.add(new QuotaSanityParameter(getParameters().getVmStaticData().getQuotaId(), null)); return list; }
Source:
public OnePassDataIndexer(ObjectStream<Event> eventStream, int cutoff, boolean sort) throws IOException { Map<String, Integer> predicateIndex = new HashMap<>(); LinkedList<Event> events; List<ComparableEvent> eventsToCompare; System.out.println("Indexing events using cutoff of " + cutoff + "\n"); System.out.print("\tComputing event counts... "); events = computeEventCounts(eventStream, predicateIndex, cutoff); System.out.println("done. " + events.size() + " events"); System.out.print("\tIndexing... "); eventsToCompare = index(events, predicateIndex); events = null; predicateIndex = null; System.out.println("done."); System.out.print("Sorting and merging events... "); sortAndMerge(eventsToCompare, sort); System.out.println("Done indexing."); }

Target:
public OnePassDataIndexer(ObjectStream<Event> eventStream, int cutoff, boolean sort) throws IOException { Map<String, Integer> predicateIndex = new HashMap<>(); List<Event> events; List<ComparableEvent> eventsToCompare; System.out.println("Indexing events using cutoff of " + cutoff + "\n"); System.out.print("\tComputing event counts... "); events = computeEventCounts(eventStream, predicateIndex, cutoff); System.out.println("done. " + events.size() + " events"); System.out.print("\tIndexing... "); eventsToCompare = index(events, predicateIndex); events = null; predicateIndex = null; System.out.println("done."); System.out.print("Sorting and merging events... "); sortAndMerge(eventsToCompare, sort); System.out.println("Done indexing."); }
Source:
public String convertToNormalizedHTML(String inputHTML) { Document doc = Jsoup.parse(inputHTML); doc.quirksMode(QuirksMode.noQuirks); OutputSettings outputSettings = doc.outputSettings(); outputSettings.charset(CHARSET); outputSettings.escapeMode(EscapeMode.xhtml); outputSettings.prettyPrint(true); outputSettings.outline(true); outputSettings.indentAmount(INDENT_AMOUNT); doc.outputSettings(outputSettings); Elements bold = doc.select("b"); for (Element e : bold) { e.tagName("strong"); } Elements italic = doc.select("i"); for (Element e : italic) { e.tagName("em"); } Elements underline = doc.select("u"); for (Element e : underline) { e.tagName("span"); e.attr("style", "text-decoration: underline;"); } Elements strike = doc.select("strike"); for (Element e : strike) { e.tagName("span"); e.attr("style", "text-decoration: line-through;"); } processFontTags(doc); String output = processText(doc); return output; }

Target:
public String convertToNormalizedHTML(String inputHTML) { Document doc = Jsoup.parse(inputHTML); doc.quirksMode(QuirksMode.noQuirks); OutputSettings outputSettings = doc.outputSettings(); outputSettings.charset(CHARSET); outputSettings.escapeMode(EscapeMode.xhtml); outputSettings.prettyPrint(true); outputSettings.outline(true); outputSettings.indentAmount(INDENT_AMOUNT); doc.outputSettings(outputSettings); Elements bold = doc.select("b"); for (Element e : bold) { e.tagName("strong"); } Elements italic = doc.select("i"); for (Element e : italic) { e.tagName("em"); } Elements underline = doc.select("u"); for (Element e : underline) { e.tagName("span"); e.attr("style", "text-decoration: underline;"); } Elements strike = doc.select("strike"); for (Element e : strike) { e.tagName("span"); e.attr("style", "text-decoration: line-through;"); } processFontTags(doc); return processText(doc); }
Source:
private void emit(CodeWriter codeWriter) throws IOException { codeWriter.pushPackage(packageName); if (!fileComment.isEmpty()) { codeWriter.emitComment(fileComment); } if (!packageName.isEmpty()) { codeWriter.emit("package $L;\n", packageName); codeWriter.emit("\n"); } if (!staticImports.isEmpty()) { for (String signature : staticImports) { codeWriter.emit("import static $L;\n", signature); } codeWriter.emit("\n"); } int importedTypesCount = 0; for (ClassName className : new TreeSet<>(codeWriter.importedTypes().values())) { if (skipJavaLangImports && className.packageName().equals("java.lang")) continue; codeWriter.emit("import $L;\n", className.withoutAnnotations()); importedTypesCount++; } if (importedTypesCount > 0) { codeWriter.emit("\n"); } for (TypeSpec ts : typeSpecs) { ts.emit(codeWriter, null, Collections.emptySet()); } codeWriter.popPackage(); }

Target:
private void emit(CodeWriter codeWriter) throws IOException { codeWriter.pushPackage(packageName); if (!fileComment.isEmpty()) { codeWriter.emitComment(fileComment); } if (!packageName.isEmpty()) { codeWriter.emit("package $L;\n", packageName); codeWriter.emit("\n"); } if (!staticImports.isEmpty()) { for (String signature : staticImports) { codeWriter.emit("import static $L;\n", signature); } codeWriter.emit("\n"); } int importedTypesCount = 0; for (ClassName className : new TreeSet<>(codeWriter.importedTypes().values())) { if (skipJavaLangImports && className.packageName().equals("java.lang")) continue; codeWriter.emit("import $L;\n", className.withoutAnnotations()); importedTypesCount++; } if (importedTypesCount > 0) { codeWriter.emit("\n"); } typeSpec.emit(codeWriter, null, Collections.emptySet()); for (TypeSpec additionalTypeSpec : additionalTypeSpecs) { additionalTypeSpec.emit(codeWriter, null, Collections.emptySet()); } codeWriter.popPackage(); }
Source:
public HostJobsReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); Object temp = innerMap.get(JOBS_KEY); if (temp != null) { hostJobsInfo = (Map<String, Object>) innerMap.get(JOBS_KEY); } }

Target:
public HostJobsReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); hostJobsInfo = (Map<String, Object>) innerMap.get(JOBS_KEY); }
Source:
public static boolean isConvertible(Aggregate input) { if (PhoenixAbstractAggregate.isSingleValueCheckAggregate(input)) return true; if (input.getGroupSets().size() > 1) return false; if (input.getGroupType() != Group.SIMPLE) return false; for (AggregateCall aggCall : input.getAggCallList()) { if (!CalciteUtils.isAggregateFunctionSupported(aggCall.getAggregation())) { return false; } } return true; }

Target:
public static boolean isConvertible(Aggregate input) { if (PhoenixAbstractAggregate.isSingleValueCheckAggregate(input)) return true; if (input.getGroupSets().size() > 1) return false; if (input.getGroupType() != Group.SIMPLE) return false; for (AggregateCall aggCall : input.getAggCallList()) { if(!SqlKind.COUNT.equals(aggCall.getAggregation().getKind()) && aggCall.isDistinct()) { return false; } if (!CalciteUtils.isAggregateFunctionSupported(aggCall.getAggregation())) { return false; } } return true; }
Source:
public void set(String name, String value) { String attribute = (name != null ? name.trim() : "") + ": " + (value != null ? value.trim() : ""); lines.clear(); while (attribute.indexOf(',') > 0 || attribute.length() > 71) { int split = attribute.indexOf(',') + 1; if (split == 0) { split = 70; } lines.add(attribute.substring(0, split)); attribute = " " + attribute.substring(split); } lines.add(attribute); }

Target:
public void set(String name, String value) { lines.clear(); try { ManifestElement[] elements = ManifestElement.parseHeader(name, value); String firstLine = (name != null ? name.trim() : "") + ": " + elements[0]; if (elements.length > 1) { firstLine = firstLine + ","; } lines.add(firstLine); for (int i = 1; i < elements.length - 1; i++) { lines.add(" " + elements[i] + ","); } if (elements.length > 1) { lines.add(" " + elements[elements.length - 1]); } } catch (BundleException e) { throw new RuntimeException(e); } }
Source:
private JsonNode parseRequestResponse (Response response) throws IOException { response.bufferEntity(); String body = response.readEntity(String.class); ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readTree(body); }

Target:
private JsonNode parseRequestResponse (Response response) throws IOException { String body = response.readEntity(String.class); ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readTree(body); }
Source:
public void run() throws Exception { CamusHourlySweeper.this.metrics.runnerStartTimeByTopic.put(this.topicAndHour, System.currentTimeMillis()); job.getConfiguration().setBoolean(MAPRED_COMPRESS_MAP_OUTPUT, DEFAULT_MAPRED_COMPRESS_MAP_OUTPUT); ((CamusSweeperJob) Class.forName(props.getProperty(CAMUS_SWEEPER_IO_CONFIGURER_CLASS)).newInstance()).setLogger( LOG).configureJob(topicName, job); setNumOfReducersAndSplitSizes(); submitMrJob(); moveTmpPathToOutputPath(); CamusHourlySweeper.this.metrics.mrFinishTimeByTopic.put(this.topicAndHour, System.currentTimeMillis()); }

Target:
public void run() throws Exception { CamusHourlySweeper.this.metrics.recordRunnerStartTimeByTopic(this.topicAndHour, System.currentTimeMillis()); job.getConfiguration().setBoolean(MAPRED_COMPRESS_MAP_OUTPUT, DEFAULT_MAPRED_COMPRESS_MAP_OUTPUT); ((CamusSweeperJob) Class.forName(props.getProperty(CAMUS_SWEEPER_IO_CONFIGURER_CLASS)).newInstance()).setLogger( LOG).configureJob(topicName, job); setNumOfReducersAndSplitSizes(); submitMrJob(); moveTmpPathToOutputPath(); }
Source:
public String loadPluginSettings(String pluginId) { GoPluginApiResponse response; try { response = submitTo(pluginId, new DefaultGoPluginApiRequest("", "", "load-settings")); } catch (GoPluginFrameworkException e) { throw new RuntimeException(format("Plugin %s does not support this operation", pluginId)); } if (SUCCESS_RESPONSE_CODE == response.responseCode()) { return response.responseBody(); } throw new RuntimeException(format("Error while loading settings for plugin %s. [%s]", pluginId, response.responseBody())); }

Target:
public String loadPluginSettings(String pluginId) { GoPluginApiResponse response; try { response = submitTo(pluginId, new DefaultGoPluginApiRequest("", "", "load-settings")); } catch (Exception e) { LOGGER.warn(format("Could not load settings for Plugin %s", pluginId), e); throw new RuntimeException(format("Could not load settings for Plugin %s. %s", pluginId, e.getMessage())); } if (SUCCESS_RESPONSE_CODE == response.responseCode()) { return response.responseBody(); } throw new RuntimeException(format("Error while loading settings for plugin %s. [%s]", pluginId, response.responseBody())); }
Source:
public ComponentQuery(@Nullable String nameOrKeyQuery, String... qualifiers) { this.nameOrKeyQuery = nameOrKeyQuery; this.qualifiers = Builder.validateQualifiers(qualifiers); this.language = null; this.componentIds = null; this.isPrivate = null; this.lastAnalysisBefore = null; }

Target:
public ComponentQuery(@Nullable String nameOrKeyQuery, String... qualifiers) { this.nameOrKeyQuery = nameOrKeyQuery; this.qualifiers = Builder.validateQualifiers(qualifiers); this.language = null; this.componentIds = null; this.isPrivate = null; this.analyzedBefore = null; }
Source:
public boolean waitInvisibility(By elementLocator) { return waitInvisibility(elementLocator, DEFAULT_TIMEOUT); }

Target:
public void waitInvisibility(By elementLocator) { waitInvisibility(elementLocator, DEFAULT_TIMEOUT); }
Source:
public WorkflowVersion addAliasesAndCheck(User user, Long id, String aliases, boolean blockFormat) { WorkflowVersion c = getAndCheckResource(user, id); Set<String> oldAliases = c.getAliases().keySet(); Set<String> newAliases = Sets.newHashSet(Arrays.stream(aliases.split(",")).map(String::trim).toArray(String[]::new)); AliasableResourceInterface.checkAliases(newAliases, user, blockFormat); Set<String> duplicateAliasesToAdd = Sets.intersection(newAliases, oldAliases); if (!duplicateAliasesToAdd.isEmpty()) { String dupAliasesString = String.join(", ", duplicateAliasesToAdd); throw new CustomWebApplicationException("Aliases " + dupAliasesString + " already exist; please use unique aliases", HttpStatus.SC_BAD_REQUEST); } newAliases.forEach(alias -> c.getAliases().put(alias, new Alias())); return c; }

Target:
public WorkflowVersion addAliasesAndCheck(User user, Long id, String aliases, boolean blockFormat) { WorkflowVersion workflowVersion = getAndCheckResource(user, id); Set<String> oldAliases = workflowVersion.getAliases().keySet(); Set<String> newAliases = Sets.newHashSet(Arrays.stream(aliases.split(",")).map(String::trim).toArray(String[]::new)); AliasableResourceInterface.checkAliases(newAliases, user, blockFormat); Set<String> duplicateAliasesToAdd = Sets.intersection(newAliases, oldAliases); if (!duplicateAliasesToAdd.isEmpty()) { String dupAliasesString = String.join(", ", duplicateAliasesToAdd); throw new CustomWebApplicationException("Aliases " + dupAliasesString + " already exist; please use unique aliases", HttpStatus.SC_BAD_REQUEST); } newAliases.forEach(alias -> workflowVersion.getAliases().put(alias, new Alias())); return workflowVersion; }
Source:
public MonstrousStep(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}"); this.getSpellAbility().addEffect(new BoostTargetEffect(7,7, Duration.EndOfTurn)); this.getSpellAbility().addEffect(new MonstrousStepEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterMustBlock)); this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterToBeBlocked)); this.getSpellAbility().addWatcher(new BlockedAttackerWatcher()); this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); }

Target:
public MonstrousStep(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}"); this.getSpellAbility().addEffect(new BoostTargetEffect(7,7, Duration.EndOfTurn) .setText("Target creature gets +7/+7 until end of turn.")); this.getSpellAbility().addEffect(new MonstrousStepEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterMustBlock)); this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterToBeBlocked)); this.getSpellAbility().addWatcher(new BlockedAttackerWatcher()); this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); }
Source:
public String solveProblemForAll() { for (Task task : this.steps) { this.currentStep = task; this.solution.setId(getIdForCorrection(this.solutionTask)); serviceManager.getWorkflowService().setSolution(getSolution()); try { setCurrentStep(serviceManager.getWorkflowService().solveProblem(this.currentStep)); saveStep(); } catch (DAOException | DataException e) { Helper.setFehlerMeldung("correctionSolveProblem"); logger.error(e.getMessage(), e); } } setSolution(serviceManager.getWorkflowService().getSolution()); this.solutionTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }

Target:
public String solveProblemForAll() { for (Task task : this.steps) { this.currentStep = task; this.solution.setId(getIdForCorrection(this.solutionTask)); serviceManager.getWorkflowControllerService().setSolution(getSolution()); try { setCurrentStep(serviceManager.getWorkflowControllerService().solveProblem(this.currentStep)); saveStep(); } catch (DAOException | DataException e) { Helper.setErrorMessage("correctionSolveProblem", logger, e); } } setSolution(serviceManager.getWorkflowControllerService().getSolution()); this.solutionTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }
Source:
public boolean shouldTriggerOn(GerritTriggeredEvent event) { if (!super.shouldTriggerOn(event)) { return false; } if (excludeDrafts && ((PatchsetCreated)event).getPatchSet().isDraft()) { return false; } if (excludeTrivialRebase && new String("TRIVIAL_REBASE").equals(((PatchsetCreated)event).getPatchSet().getKind())) { return false; } if (excludeNoCodeChange && new String("NO_CODE_CHANGE").equals(((PatchsetCreated)event).getPatchSet().getKind())) { return false; } return true; }

Target:
public boolean shouldTriggerOn(GerritTriggeredEvent event) { if (!super.shouldTriggerOn(event)) { return false; } if (excludeDrafts && ((PatchsetCreated)event).getPatchSet().isDraft()) { return false; } if (excludeTrivialRebase && GerritChangeKind.TRIVIAL_REBASE == ((PatchsetCreated)event).getPatchSet().getKind()) { return false; } if (excludeNoCodeChange && GerritChangeKind.NO_CODE_CHANGE == ((PatchsetCreated)event).getPatchSet().getKind()) { return false; } return true; }
Source:
public PartitionReleaseStrategy createInstance(final SchedulingTopology schedulingStrategy) { final Set<? extends Set<? extends SchedulingExecutionVertex>> distinctRegions = PipelinedRegionComputeUtil.computePipelinedRegions(schedulingStrategy); return new RegionPartitionReleaseStrategy( schedulingStrategy, PipelinedRegionComputeUtil.toPipelinedRegionsSet(distinctRegions)); }

Target:
public PartitionReleaseStrategy createInstance(final SchedulingTopology schedulingStrategy) { final Set<? extends Set<SchedulingExecutionVertex>> distinctRegions = PipelinedRegionComputeUtil.computePipelinedRegions(schedulingStrategy); return new RegionPartitionReleaseStrategy( schedulingStrategy, PipelinedRegionComputeUtil.toPipelinedRegionsSet(distinctRegions)); }
Source:
public HelixCloudProperty(CloudConfig cloudConfig) { this.setCloudEndabled(cloudConfig.isCloudEnabled()); this.setCloudId(cloudConfig.getCloudID()); this.setCloudProvider(cloudConfig.getCloudProvider()); switch (cloudConfig.getCloudProvider()) { case "AZURE": Properties azureProperties = new Properties(); try { InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(AZURE_CLOUD_PROPERTY_FILE); azureProperties.load(stream); } catch (Exception e) { String errMsg = "fail to open properties file: " + AZURE_CLOUD_PROPERTY_FILE; throw new IllegalArgumentException(errMsg, e); } logger.info("load helix Azure cloud properties: " + azureProperties); this.setCloudInfoSources(Collections.singletonList(azureProperties.getProperty("CLOUD_INFO_SOURCE"))); this.setCloudInfoProcessorName(azureProperties.getProperty("CLOUD_INFO_PROCESSFOR_NAME")); this.setCloudMaxRetry(azureProperties.getProperty("RETRY_MAX")); this.setCloudConnectionTimeout(azureProperties.getProperty("CONNECTION_TIMEOUT_MS")); this.setCloudRequestTimeout(azureProperties.getProperty("REQUEST_TIMEOUT_MS")); case "CUSTOMIZED": setCloudInfoSources(cloudConfig.getCloudInfoSources()); this.setCloudInfoProcessorName(cloudConfig.getCloudInfoProcessorName()); } }

Target:
public HelixCloudProperty(CloudConfig cloudConfig) { setCloudEndabled(cloudConfig.isCloudEnabled()); if (cloudConfig.isCloudEnabled()) { setCloudId(cloudConfig.getCloudID()); setCloudProvider(cloudConfig.getCloudProvider()); switch (CloudProvider.valueOf(cloudConfig.getCloudProvider())) { case AZURE: Properties azureProperties = new Properties(); try { InputStream stream = Thread.currentThread().getContextClassLoader() .getResourceAsStream(AZURE_CLOUD_PROPERTY_FILE); azureProperties.load(stream); } catch (IOException e) { String errMsg = "failed to open Helix Azure cloud properties file: " + AZURE_CLOUD_PROPERTY_FILE; throw new IllegalArgumentException(errMsg, e); } LOG.info("Successfully loaded Helix Azure cloud properties: {}", azureProperties); setCloudInfoSources( Collections.singletonList(azureProperties.getProperty(CLOUD_INFO_SOURCE))); setCloudInfoProcessorName(azureProperties.getProperty(CLOUD_INFO_PROCESSFOR_NAME)); setCloudMaxRetry(Integer.valueOf(azureProperties.getProperty(CLOUD_MAX_RETRY))); setCloudConnectionTimeout(Long.valueOf(azureProperties.getProperty(CONNECTION_TIMEOUT_MS))); setCloudRequestTimeout(Long.valueOf(azureProperties.getProperty(REQUEST_TIMEOUT_MS))); break; case CUSTOMIZED: setCloudInfoSources(cloudConfig.getCloudInfoSources()); setCloudInfoProcessorName(cloudConfig.getCloudInfoProcessorName()); break; default: throw new HelixException( String.format("Unsupported cloud provider: %s", cloudConfig.getCloudProvider())); } } }
Source:
protected void buildAndTag(ServiceHub hub, ImageConfiguration imageConfig) throws MojoExecutionException, DockerAccessException { EnvUtil.storeTimestamp(getBuildTimestampFile(), getBuildTimestamp()); BuildService.BuildContext buildContext = getBuildContext(); hub.getBuildService().pullAndBuildImage(imageConfig, buildContext); if (!skipTag) { tagImage(imageConfig.getName(), imageConfig, hub.getDockerAccess()); } }

Target:
protected void buildAndTag(ServiceHub hub, ImageConfiguration imageConfig) throws MojoExecutionException, DockerAccessException { EnvUtil.storeTimestamp(getBuildTimestampFile(), getBuildTimestamp()); BuildService.BuildContext buildContext = getBuildContext(); BuildService buildService = hub.getBuildService(); buildService.buildImage(imageConfig, buildContext); if (!skipTag) { buildService.tagImage(imageConfig.getName(), imageConfig); } }
Source:
public void setTabs() { List<Fragment> fragmentList = new ArrayList<>(); List<String> titleList = new ArrayList<>(); searchImageFragment = new SearchImageFragment(); searchCategoryFragment= new SearchCategoryFragment(); fragmentList.add(searchImageFragment); titleList.add(getResources().getString(R.string.search_tab_title_media)); fragmentList.add(searchCategoryFragment); titleList.add(getResources().getString(R.string.search_tab_title_categories)); viewPagerAdapter.setTabData(fragmentList, titleList); viewPagerAdapter.notifyDataSetChanged(); searchDisposable = RxSearchView.queryTextChanges(searchView) .takeUntil(RxView.detaches(searchView)) .debounce(500, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribe(query -> { this.query = query.toString(); if (!TextUtils.isEmpty(query)) { viewPager.setVisibility(View.VISIBLE); tabLayout.setVisibility(View.VISIBLE); searchHistoryContainer.setVisibility(View.GONE); if (searchImageFragment != null && searchImageFragment.isAdded() && !searchImageFragment.isDetached()) { searchImageFragment.updateImageList(query.toString()); } if (searchCategoryFragment != null && searchCategoryFragment.isAdded() && !searchCategoryFragment.isDetached()) { searchCategoryFragment.updateCategoryList(query.toString()); } } else { viewPager.setVisibility(View.GONE); tabLayout.setVisibility(View.GONE); searchHistoryContainer.setVisibility(View.VISIBLE); recentSearchesFragment.updateRecentSearches(); } }); }

Target:
public void setTabs() { List<Fragment> fragmentList = new ArrayList<>(); List<String> titleList = new ArrayList<>(); searchImageFragment = new SearchImageFragment(); searchCategoryFragment= new SearchCategoryFragment(); fragmentList.add(searchImageFragment); titleList.add(getResources().getString(R.string.search_tab_title_media)); fragmentList.add(searchCategoryFragment); titleList.add(getResources().getString(R.string.search_tab_title_categories)); viewPagerAdapter.setTabData(fragmentList, titleList); viewPagerAdapter.notifyDataSetChanged(); searchDisposable = RxSearchView.queryTextChanges(searchView) .takeUntil(RxView.detaches(searchView)) .debounce(500, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribe(query -> { this.query = query.toString(); if (!TextUtils.isEmpty(query)) { viewPager.setVisibility(View.VISIBLE); tabLayout.setVisibility(View.VISIBLE); searchHistoryContainer.setVisibility(View.GONE); if (FragmentUtils.isFragmentUIActive(searchImageFragment)) { searchImageFragment.updateImageList(query.toString()); } if (FragmentUtils.isFragmentUIActive(searchCategoryFragment)) { searchCategoryFragment.updateCategoryList(query.toString()); } } else { viewPager.setVisibility(View.GONE); tabLayout.setVisibility(View.GONE); searchHistoryContainer.setVisibility(View.VISIBLE); recentSearchesFragment.updateRecentSearches(); } }); }
Source:
public void maybeThrottle(double observed) throws InterruptedException { synchronized (lock) { observedSoFar += observed; long now = time.nanoseconds(); long elapsedNs = now - periodStartNs; if (elapsedNs > checkIntervalMs * Time.NsPerMs && observedSoFar > 0) { double rateInSecs = (observedSoFar * Time.NsPerSec) / elapsedNs; boolean needAdjustment = !(throttleDown ^ (rateInSecs > desiredRatePerSec)); if (needAdjustment) { double desiredRateMs = desiredRatePerSec / Time.MsPerSec; double elapsedMs = elapsedNs / Time.NsPerMs; long sleepTime = Math.round(observedSoFar / desiredRateMs - elapsedMs); if (sleepTime > 0) { logger.trace("Natural rate is per second but desired rate is {}, sleeping for ms to compensate.", rateInSecs, desiredRatePerSec, sleepTime); synchronized (waitGuard) { if (awakeCount == 0) { waiting = true; time.wait(waitGuard, sleepTime); waiting = false; } if (awakeCount > 0) { awakeCount--; } } } } periodStartNs = now; observedSoFar = 0; } } }

Target:
public void maybeThrottle(double observed) throws InterruptedException { synchronized (lock) { observedSoFar += observed; long now = time.nanoseconds(); long elapsedNs = now - periodStartNs; if (elapsedNs > checkIntervalMs * Time.NsPerMs && observedSoFar > 0) { double rateInSecs = (observedSoFar * Time.NsPerSec) / elapsedNs; boolean needAdjustment = !(throttleDown ^ (rateInSecs > desiredRatePerSec)); if (needAdjustment) { double desiredRateMs = desiredRatePerSec / Time.MsPerSec; double elapsedMs = elapsedNs / Time.NsPerMs; long sleepTime = Math.round(observedSoFar / desiredRateMs - elapsedMs); if (sleepTime > 0) { logger.trace("Natural rate is per second but desired rate is {}, sleeping for ms to compensate.", rateInSecs, desiredRatePerSec, sleepTime); synchronized (waitGuard) { if (enabled) { time.wait(waitGuard, sleepTime); } } } } periodStartNs = now; observedSoFar = 0; } } }
Source:
private void setFactionIcon(Faction faction) { if (faction == null) { return; } switch (faction) { case AEON: factionIcon.setVisible(true); factionIcon.setText("\uE900"); factionIcon.getStyleClass().add("aeon"); break; case CYBRAN: factionIcon.setVisible(true); factionIcon.setText("\uE902"); factionIcon.getStyleClass().add("cybran"); break; case SERAPHIM: factionIcon.setVisible(true); factionIcon.setText("\uE903"); factionIcon.getStyleClass().add("seraphim"); break; case UEF: factionIcon.setVisible(true); factionIcon.setText("\uE904"); factionIcon.getStyleClass().add("uef"); break; default: factionImage.setVisible(true); factionImage.setImage(randomImage); break; } }

Target:
private void setFactionIcon(Faction faction) { if (faction == null) { return; } factionIcon.setVisible(true); switch (faction) { case AEON: factionIcon.setText("\uE900"); factionIcon.getStyleClass().add(AEON); break; case CYBRAN: factionIcon.setText("\uE902"); factionIcon.getStyleClass().add(CYBRAN); break; case SERAPHIM: factionIcon.setText("\uE903"); factionIcon.getStyleClass().add(SERAPHIM); break; case UEF: factionIcon.setText("\uE904"); factionIcon.getStyleClass().add(UEF); break; default: factionIcon.setVisible(false); factionImage.setVisible(true); factionImage.setImage(RANDOM_IMAGE); break; } }
Source:
public void show(@NonNull PageTitle title) { ReadingList.DAO.anyListContainsTitleAsync(ReadingListDaoProxy.key(title), new CallbackTask.Callback<ReadingListPage>() { @Override public void success(@Nullable ReadingListPage page) { if (!ViewCompat.isAttachedToWindow(anchorView)) { return; } ReadingListBookmarkMenu.this.page = page; PopupMenu menu = new PopupMenu(anchorView.getContext(), anchorView); menu.getMenuInflater().inflate(R.menu.menu_reading_list_page_toggle, menu.getMenu()); menu.setOnMenuItemClickListener(new PageSaveMenuClickListener()); menu.show(); } }); }

Target:
public void show(@NonNull PageTitle title) { ReadingList.DAO.anyListContainsTitleAsync(ReadingListDaoProxy.key(title), new CallbackTask.Callback<ReadingListPage>() { @Override public void success(@Nullable ReadingListPage page) { if (!ViewCompat.isAttachedToWindow(anchorView)) { return; } ReadingListBookmarkMenu.this.page = page; showMenu(); } }); }
Source:
public void writeToFile(String msg, String fileName, StudySubject ss) { logger.debug("writing report to File"); File file = new File(fileName); PrintWriter writer = null; try { file.createNewFile(); writer = new PrintWriter(file.getPath(), "UTF-8"); String subStr = ""; writer.println("SubjectKey,ParticipantID,Status,Timestamp,Message"); SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); Date date = new Date(System.currentTimeMillis()); writer.println(ss.getOcOid()+","+ss.getLabel()+","+"Failed"+","+formatter.format(date)+","+"Error Detail:"); msg = msg.replaceAll("\"", ""); if(msg.length() > 100) { while(msg.length() > 100) { int endIndex = msg.indexOf(" ", 100); subStr = msg.substring(0, endIndex); writer.println(", , , ," + subStr); msg = msg.substring(endIndex); } writer.println(", , , ," +msg); }else { writer.println(", , , ," +msg); } } catch (IOException e) { logger.error("Error while accessing file to start writing: ",e); } finally { writer.close();; } }

Target:
public void writeToFile(String msg, String fileName, StudySubject ss) { logger.debug("writing report to File"); File file = new File(fileName); PrintWriter writer = null; try { file.createNewFile(); writer = new PrintWriter(file.getPath(), "UTF-8"); String subStr = ""; writer.println("SubjectKey|ParticipantID|Status|Timestamp|Message"); SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); Date date = new Date(System.currentTimeMillis()); writer.println(ss.getOcOid()+"|"+ss.getLabel()+"|"+"Failed"+"|"+formatter.format(date)+"|"+"Error Detail: "+ msg); } catch (IOException e) { logger.error("Error while accessing file to start writing: ",e); } finally { writer.close();; } }
Source:
public void filter(Filter filter) throws NoTestsRemainException { synchronized (fLock) { List<T> sortedChildren = new ArrayList<T>(getFilteredChildren()); try { for (Iterator<T> iter = sortedChildren.iterator(); iter.hasNext(); ) { T each = iter.next(); if (shouldRun(filter, each)) { try { filter.apply(each); } catch (NoTestsRemainException e) { iter.remove(); } } else { iter.remove(); } } } finally { setFilteredChildren(sortedChildren); } } if (getFilteredChildren().isEmpty()) { throw new NoTestsRemainException(); } }

Target:
public void filter(Filter filter) throws NoTestsRemainException { synchronized (fChildrenLock) { List<T> filteredChildren = new ArrayList<T>(getFilteredChildren()); for (Iterator<T> iter = filteredChildren.iterator(); iter.hasNext(); ) { T each = iter.next(); if (shouldRun(filter, each)) { try { filter.apply(each); } catch (NoTestsRemainException e) { iter.remove(); } } else { iter.remove(); } } fFilteredChildren = Collections.unmodifiableCollection(filteredChildren); if (fFilteredChildren.isEmpty()) { throw new NoTestsRemainException(); } } }
Source:
private static <T> List<T> extractList(Map<String, Object> xmlRpcStruct, String propertyName, boolean returnNullOnEmpty) { if (!xmlRpcStruct.containsKey(propertyName)){ return returnNullOnEmpty ? null : Collections.emptyList(); } Object[] items = (Object[]) xmlRpcStruct.get(propertyName); if (items.length == 0) { return returnNullOnEmpty ? null : Collections.emptyList(); } List<T> list = new ArrayList<>(); Arrays.stream(items).forEach(item -> list.add((T) item)); return list; }

Target:
private static <T> List<T> extractList(Map<String, Object> xmlRpcStruct, String propertyName, boolean returnNullOnEmpty) { if (!xmlRpcStruct.containsKey(propertyName)){ return returnNullOnEmpty ? null : Collections.emptyList(); } Object[] items = (Object[]) xmlRpcStruct.get(propertyName); if (items.length == 0) { return returnNullOnEmpty ? null : Collections.emptyList(); } return Arrays.stream(items).map(item -> (T) item).collect(Collectors.toList()); }
Source:
public void UseLegacy(boolean useLegacy) { this.useLegacy = useLegacy; }

Target:
public void UseLegacy(boolean useLegacy) { this.useLegacy = useLegacy; Stop(); if (useLegacy == true || Build.VERSION.SDK_INT<8) { speechRecognizerController = new IntentBasedSpeechRecognizer(container, recognizerIntent); } else { speechRecognizerController = new ServiceBasedSpeechRecognizer(container, recognizerIntent); } }
Source:
public String getSearchTransformedNetwork(@ProjectIdentifier @PathVariable("projectUnixName") String projectUnixName, @RequestParam("conceptId") String conceptId, @CheckAccess @InjectProject IProject project, Model model) throws QuadrigaStorageException { String lemma = ""; String searchNodeLabel = ""; ConceptpowerReply reply = conceptpowerConnector.getById(conceptId); List<String> alternativeIdsForConcept = null; if (reply != null && reply.getConceptEntry().size() > 0) { searchNodeLabel = reply.getConceptEntry().get(0).getLemma(); lemma = reply.getConceptEntry().get(0).getDescription(); alternativeIdsForConcept = reply.getConceptEntry().get(0).getAlternativeIdList(); } if(alternativeIdsForConcept == null){ alternativeIdsForConcept = new ArrayList<String>(); } ITransformedNetwork transformedNetwork = transformationManager .getSearchTransformedNetwork(project.getProjectId(), conceptId, alternativeIdsForConcept, INetworkStatus.APPROVED); String json = null; if (transformedNetwork != null) { json = jsonCreator.getJson(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } if (transformedNetwork == null || transformedNetwork.getNodes().size() == 0) { model.addAttribute("isNetworkEmpty", true); } model.addAttribute("jsonstring", json); model.addAttribute("networkid", "\"\""); model.addAttribute("project", project); model.addAttribute("searchNodeLabel", searchNodeLabel); model.addAttribute("description", lemma); model.addAttribute("unixName", projectUnixName); return "sites/networks/searchednetwork"; }

Target:
public String getSearchTransformedNetwork(@ProjectIdentifier @PathVariable("projectUnixName") String projectUnixName, @RequestParam("conceptId") String conceptId, @CheckAccess @InjectProject IProject project, Model model) throws QuadrigaStorageException { String lemma = ""; String searchNodeLabel = ""; ConceptpowerReply reply = conceptpowerConnector.getById(conceptId); if (reply != null && reply.getConceptEntry().size() > 0) { searchNodeLabel = reply.getConceptEntry().get(0).getLemma(); lemma = reply.getConceptEntry().get(0).getDescription(); } ITransformedNetwork transformedNetwork = transformationManager .getSearchTransformedNetwork(project.getProjectId(), conceptId, INetworkStatus.APPROVED); String json = null; if (transformedNetwork != null) { json = jsonCreator.getJson(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } if (transformedNetwork == null || transformedNetwork.getNodes().size() == 0) { model.addAttribute("isNetworkEmpty", true); } model.addAttribute("jsonstring", json); model.addAttribute("networkid", "\"\""); model.addAttribute("project", project); model.addAttribute("searchNodeLabel", searchNodeLabel); model.addAttribute("description", lemma); model.addAttribute("unixName", projectUnixName); return "sites/networks/searchednetwork"; }
Source:
public PluginUploadResponse addPlugin(File uploadedPlugin, String filename) { if (!validateJar(filename)) { Map<Integer, String> errors = new HashMap<Integer, String>(); errors.put(HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE, "Please upload a jar."); return PluginUploadResponse.create(false, null, errors); } return uploadPlugin(uploadedPlugin, filename); }

Target:
public PluginUploadResponse addPlugin(File uploadedPlugin, String filename) { if (!pluginValidator.namecheckForJar(filename)) { Map<Integer, String> errors = new HashMap<Integer, String>(); errors.put(HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE, "Please upload a jar."); return PluginUploadResponse.create(false, null, errors); } return pluginWriter.addPlugin(uploadedPlugin, filename); }
Source:
public void toStart() { log.debug(String.format("toStart: %s", id)); cqTailer.toStart(); if (! cqTailer.state().equals(TailerState.FOUND_CYCLE)) { log.warn("Unable to move to start because the tailer is not initialized, " + this); } }

Target:
public void toStart() { log.debug(String.format("toStart: %s", id)); cqTailer.toStart(); if (!cqTailer.state().equals(TailerState.FOUND_CYCLE)) { log.info("Unable to move to start because the tailer is not initialized, " + this); } }
Source:
public void shouldDeleteUsers() { User john = new User("john"); john.disable(); User joan = new User("joan"); joan.disable(); List<String> userNames = new ArrayList<String>() {{ add("john"); add("joan"); }}; userDao.saveOrUpdate(john); userDao.saveOrUpdate(joan); boolean result = userDao.deleteUsers(userNames); assertThat(result, is(true)); Users users = userDao.allUsers(); assertThat(users, is(empty())); }

Target:
public void shouldDeleteUsers() { User john = new User("john"); john.disable(); User joan = new User("joan"); joan.disable(); List<String> userNames = Arrays.asList("john", "joan"); userDao.saveOrUpdate(john); userDao.saveOrUpdate(joan); boolean result = userDao.deleteUsers(userNames); assertThat(result, is(true)); Users users = userDao.allUsers(); assertThat(users, is(empty())); }
Source:
public List<String> listTopics() { Seq<String> topics = zkUtils.getAllTopics(); return scala.collection.JavaConversions.seqAsJavaList(topics); }

Target:
public List<String> listTopics() { Seq<String> topics = zkUtils.getAllTopics(); return JavaConversions.seqAsJavaList(topics); }
Source:
static void validateDetectedLanguages(List<DetectedLanguage> expectedLanguageList, List<DetectedLanguage> actualLanguageList) { for (int i = 0; i < expectedLanguageList.size(); i++) { DetectedLanguage expectedDetectedLanguage = expectedLanguageList.get(i); DetectedLanguage actualDetectedLanguage = actualLanguageList.get(i); validatePrimaryLanguage(expectedDetectedLanguage, actualDetectedLanguage); } }

Target:
static void validateDetectedLanguages(List<DetectedLanguage> expectedLanguageList, List<DetectedLanguage> actualLanguageList) { assertEquals(expectedLanguageList.size(), actualLanguageList.size()); expectedLanguageList.sort(Comparator.comparing(DetectedLanguage::getName)); actualLanguageList.sort(Comparator.comparing(DetectedLanguage::getName)); for (int i = 0; i < expectedLanguageList.size(); i++) { DetectedLanguage expectedDetectedLanguage = expectedLanguageList.get(i); DetectedLanguage actualDetectedLanguage = actualLanguageList.get(i); validatePrimaryLanguage(expectedDetectedLanguage, actualDetectedLanguage); } }
Source:
public void testSummaryOutput() throws IOException { Summary labelsAndQuantiles = Summary.build() .quantile(0.5, 0.05).quantile(0.9, 0.01).quantile(0.99, 0.001) .labelNames("l").name("labelsAndQuantiles").help("help").register(registry); labelsAndQuantiles.labels("a").observe(2); writer = new StringWriter(); TextFormat.write004(writer, registry.metricFamilySamples()); assertEquals("# HELP labelsAndQuantiles help\n" + "# TYPE labelsAndQuantiles summary\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.5\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.9\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.99\",} 2.0\n" + "labelsAndQuantiles_count{l=\"a\",} 1.0\n" + "labelsAndQuantiles_sum{l=\"a\",} 2.0\n", writer.toString()); }

Target:
public void testSummaryOutput() throws IOException { Summary noLabels = (Summary) Summary.build().name("nolabels").help("help").register(registry); noLabels.observe(2); TextFormat.write004(writer, registry.metricFamilySamples()); assertEquals("# HELP nolabels help\n" + "# TYPE nolabels summary\n" + "nolabels_count 1.0\n" + "nolabels_sum 2.0\n", writer.toString()); }