auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CompletableFuture<URL> getAddress(final String name) { final URL cachedURL = cache.get(name); if(cachedURL != null) { final CompletableFuture<URL> future = new CompletableFuture<>(); future.complete(cachedURL); return future; } else { return httpClient.get(discoveryServiceEndpoint + "/services/" + name).withoutContent().readString().execute().handle((r, e) -> { if (e != null) { throw new DolphinRuntimeException("Can not get address for name " + name, e); } try { URL url = new URL(r.getContent()); cache.put(name, url); return url; } catch (MalformedURLException e1) { throw new DolphinRuntimeException("Can not get address for name " + name, e); } }); } }

Target:
public CompletableFuture<URL> getAddress(final String name) { final URL cachedURL = cache.get(name); if(cachedURL != null) { final CompletableFuture<URL> future = new CompletableFuture<>(); future.complete(cachedURL); return future; } else { return httpClient.get(discoveryServiceEndpoint + "/services/" + name).withoutContent().readString().execute().handle((r, e) -> { if (e != null) { throw new DolphinRuntimeException("Can not get address for name " + name, e); } try { final URL url = new URL(r.getContent()); cache.put(name, url); return url; } catch (final MalformedURLException e1) { throw new DolphinRuntimeException("Can not get address for name " + name, e); } }); } }
Source:
public void testSimpleQuery() throws Exception { indexTweeterDocument(1); assertArrayEquals(new String[] { DEFAULT_TABLE_NAME }, dataContext .getDefaultSchema() .getTableNames() .toArray()); final Table table = dataContext.getDefaultSchema().getTableByName(DEFAULT_TABLE_NAME); assertThat(table.getColumnNames(), containsInAnyOrder("_id", "message", "postDate", "user")); assertEquals(ColumnType.STRING, table.getColumnByName("user").getType()); assertEquals(ColumnType.DATE, table.getColumnByName("postDate").getType()); assertEquals(ColumnType.BIGINT, table.getColumnByName("message").getType()); dataContext.refreshSchemas(); try (DataSet ds = dataContext.query().from(DEFAULT_TABLE_NAME).select("user").and("message").execute()) { assertEquals(ElasticSearchRestDataSet.class, ds.getClass()); assertTrue(ds.next()); assertEquals("Row[values=[user1, 1]]", ds.getRow().toString()); } }

Target:
public void testSimpleQuery() throws Exception { indexTweeterDocument(1); assertArrayEquals(new String[] { DEFAULT_TABLE_NAME }, dataContext .getDefaultSchema() .getTableNames() .toArray()); final Table table = dataContext.getDefaultSchema().getTableByName(DEFAULT_TABLE_NAME); assertThat(table.getColumnNames(), containsInAnyOrder("_id", "message", "postDate", "user")); assertEquals(ColumnType.STRING, table.getColumnByName("user").getType()); assertEquals(ColumnType.DATE, table.getColumnByName("postDate").getType()); assertEquals(ColumnType.BIGINT, table.getColumnByName("message").getType()); dataContext.refreshSchemas(); try (final DataSet dataSet = dataContext .query() .from(DEFAULT_TABLE_NAME) .select("user") .and("message") .execute()) { assertEquals(ElasticSearchRestDataSet.class, dataSet.getClass()); assertTrue(dataSet.next()); assertEquals("Row[values=[user1, 1]]", dataSet.getRow().toString()); } }
Source:
protected void executeCommand() { storage_server_connections currConnection = getConnection(); boolean isValidConnection = true; if (getParameters().getVdsId().equals(Guid.Empty)) { for (VDS vds : getAllRunningVdssInPool()) { isValidConnection = isValidConnection && Connect(vds.getId()).getFirst(); } } else { isValidConnection = Connect(getVds().getId()).getFirst(); } if (isValidConnection && (StringUtils.isNotEmpty(currConnection.getid()) || getDbFacade().getStorageServerConnectionDAO().get(currConnection.getid()) == null)) { currConnection.setid(Guid.NewGuid().toString()); getDbFacade().getStorageServerConnectionDAO().save(currConnection); } getReturnValue().setActionReturnValue(getConnection().getid()); setSucceeded(true); }

Target:
protected void executeCommand() { storage_server_connections currConnection = getConnection(); boolean isValidConnection = true; if (getParameters().getVdsId().equals(Guid.Empty)) { for (VDS vds : getAllRunningVdssInPool()) { if (Connect(vds.getId()).getFirst()) { break; } } } else { isValidConnection = Connect(getVds().getId()).getFirst(); } if (isValidConnection && (StringUtils.isNotEmpty(currConnection.getid()) || getDbFacade().getStorageServerConnectionDAO().get(currConnection.getid()) == null)) { currConnection.setid(Guid.NewGuid().toString()); getDbFacade().getStorageServerConnectionDAO().save(currConnection); } getReturnValue().setActionReturnValue(getConnection().getid()); setSucceeded(true); }
Source:
private static boolean docTypeIsPossible(ProzesskopieForm dialog, String docType) { Boolean fieldIsUsed = dialog.getStandardFields().get("doctype"); if (fieldIsUsed == null || fieldIsUsed.equals(Boolean.FALSE)) { logger.warn("Bad argument “docType”: Selected template doesn’t provide the standard field “doctype”."); return false; } boolean valueIsValid; Iterator<ConfigOpacDoctype> configOpacDoctypeIterator = dialog.getAllDoctypes().iterator(); do { ConfigOpacDoctype option = configOpacDoctypeIterator.next(); valueIsValid = docType.equals(option.getTitle()); } while (!valueIsValid && configOpacDoctypeIterator.hasNext()); if (valueIsValid) { return true; } logger.warn("Bad argument “docType”: Selected template doesn’t provide " + "a docType “{0}”.".replace("{0}", docType)); return false; }

Target:
private static boolean docTypeIsPossible(ProzesskopieForm dialog, String docType) { Boolean fieldIsUsed = dialog.getStandardFields().get("doctype"); if (fieldIsUsed == null || fieldIsUsed.equals(Boolean.FALSE)) { throw new IllegalArgumentException( "Bad argument “docType”: Selected template doesn’t provide " + "the standard field “doctype”."); } boolean valueIsValid; Iterator<ConfigOpacDoctype> configOpacDoctypeIterator = dialog.getAllDoctypes().iterator(); do { ConfigOpacDoctype option = configOpacDoctypeIterator.next(); valueIsValid = docType.equals(option.getTitle()); } while (!valueIsValid && configOpacDoctypeIterator.hasNext()); if (valueIsValid) { return true; } throw new IllegalArgumentException("Bad argument “docType”: Selected template doesn’t provide " + "a docType “{0}”.".replace("{0}", docType)); }
Source:
private boolean matchesMethod(HttpMethod method, Entry<HttpMethod, ZuulRoute> zuulRoute) { if (method == null) { return true; } return method.equals(zuulRoute.getKey()); }

Target:
private boolean matchesMethod(HttpMethod method, Entry<HttpMethod, ZuulRoute> zuulRoute) { return method.equals(zuulRoute.getKey()); }
Source:
public byte[] getKey(ZooKeeperServer zks) { ZKDatabase db = zks.getZKDatabase(); if (db != null) { try { Stat stat = new Stat(); return db.getData("/key", stat, null); } catch (NoNodeException e) { } } return null; }

Target:
private byte[] getKey(ZooKeeperServer zks) { ZKDatabase db = zks.getZKDatabase(); if (db != null) { try { Stat stat = new Stat(); return db.getData("/key", stat, null); } catch (NoNodeException e) { LOG.error("getData failed", e); } } return null; }
Source:
private String createTopic(Datastream datastream) throws TransportException { Properties datastreamProperties = new Properties(); if (datastream.hasMetadata()) { datastreamProperties.putAll(datastream.getMetadata()); } Properties topicProperties = new VerifiableProperties(datastreamProperties).getDomainProperties("topic"); int numberOfPartitions = DEFAULT_NUMBER_PARTITIONS; if (datastream.hasDestination() && datastream.getDestination().hasPartitions()) { numberOfPartitions = datastream.getDestination().getPartitions(); } else if (datastream.hasSource() && datastream.getSource().hasPartitions()) { numberOfPartitions = datastream.getSource().getPartitions(); } String connectionString = _transportProvider.createTopic(getTopicName(datastream), numberOfPartitions, topicProperties); DatastreamDestination destination = new DatastreamDestination(); destination.setConnectionString(connectionString); destination.setPartitions(numberOfPartitions); datastream.setDestination(destination); datastream.getMetadata().put(DatastreamMetadataConstants.DESTINATION_CREATION_MS, String.valueOf(Instant.now().toEpochMilli())); Duration retention = _transportProvider.getRetention(connectionString); if (retention != null) { datastream.getMetadata().put(DatastreamMetadataConstants.DESTINATION_RETENION_MS, String.valueOf(retention.toMillis())); } return connectionString; }

Target:
private String createTopic(Datastream datastream) throws TransportException { Properties datastreamProperties = new Properties(); if (datastream.hasMetadata()) { datastreamProperties.putAll(datastream.getMetadata()); } Properties topicProperties = new VerifiableProperties(datastreamProperties).getDomainProperties(DESTINATION_DOMAIN); int numberOfPartitions = DEFAULT_NUMBER_PARTITIONS; if (datastream.hasDestination() && datastream.getDestination().hasPartitions()) { numberOfPartitions = datastream.getDestination().getPartitions(); } else if (datastream.hasSource() && datastream.getSource().hasPartitions()) { numberOfPartitions = datastream.getSource().getPartitions(); } String connectionString = _transportProvider.createTopic(getTopicName(datastream), numberOfPartitions, topicProperties); DatastreamDestination destination = new DatastreamDestination(); destination.setConnectionString(connectionString); destination.setPartitions(numberOfPartitions); datastream.setDestination(destination); datastream.getMetadata().put(DatastreamMetadataConstants.DESTINATION_CREATION_MS, String.valueOf(Instant.now().toEpochMilli())); Duration retention = _transportProvider.getRetention(connectionString); if (retention != null) { datastream.getMetadata().put(DatastreamMetadataConstants.DESTINATION_RETENION_MS, String.valueOf(retention.toMillis())); } return connectionString; }
Source:
public void updateDocument(String entityType, int entityId, int documentId, String name, String desc, File file) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerDocument.updateDocument(entityType, entityId, documentId, name, desc, getRequestFileBody(file)) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<DocumentRelatedResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); if (e instanceof HttpException) { try { String errorMessage = ((HttpException) e).response().errorBody() .string(); getMvpView().showUpdationError(MFErrorParser .parseError(errorMessage) .getErrors().get(0).getDefaultUserMessage()); } catch (Throwable throwable) { RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } } else { getMvpView().showUpdationError(e.getLocalizedMessage()); } } @Override public void onNext(DocumentRelatedResponse documentUpdateResponse) { getMvpView().showProgressbar(false); getMvpView().showDocumentUpdatedSuccessfully(documentUpdateResponse); } }) ); }

Target:
public void updateDocument(String entityType, int entityId, int documentId, String name, String desc, File file) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerDocument.updateDocument(entityType, entityId, documentId, name, desc, getRequestFileBody(file)) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<DocumentRelatedResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showUpdationError(MFErrorParser.errorMessage(e)); } @Override public void onNext(DocumentRelatedResponse documentUpdateResponse) { getMvpView().showProgressbar(false); getMvpView().showDocumentUpdatedSuccessfully(documentUpdateResponse); } }) ); }
Source:
StopModel getReverseStopID(String stopId, String routeShortName) { List<Criteria> criteria = new ArrayList<>(2); criteria.add(new Criteria("route_short_name", Criteria.Operation.EQ, routeShortName)); criteria.add(new Criteria("stop_id", Criteria.Operation.EQ, stopId)); Cursor cursor = reverseStopCursorAdapterSupplier.getCursor(context, criteria); if (cursor.moveToFirst()) { return reverseStopCursorAdapterSupplier.getCurrentItemFromCursor(cursor); } else { return null; } }

Target:
private StopModel getReverseStopID(String stopId, String routeShortName) { List<Criteria> criteria = new ArrayList<>(2); criteria.add(new Criteria("route_short_name", Criteria.Operation.EQ, routeShortName)); criteria.add(new Criteria("stop_id", Criteria.Operation.EQ, stopId)); Cursor cursor = reverseStopCursorAdapterSupplier.getCursor(context, criteria); if (cursor.moveToFirst()) { return reverseStopCursorAdapterSupplier.getCurrentItemFromCursor(cursor); } else { return null; } }
Source:
private void loadState() { String dependValuesStr = OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_ONESIGNAL_USERSTATE_DEPENDVALYES_ + persistKey,null); if (dependValuesStr == null) { dependValues = new JSONObject(); try { int subscribableStatus; boolean userSubscribePref = true; if (persistKey.equals("CURRENT_STATE")) subscribableStatus = OneSignalPrefs.getInt(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_ONESIGNAL_SUBSCRIPTION,1); else subscribableStatus = OneSignalPrefs.getInt(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_ONESIGNAL_SYNCED_SUBSCRIPTION,1); if (subscribableStatus == PUSH_STATUS_UNSUBSCRIBE) { subscribableStatus = 1; userSubscribePref = false; } dependValues.put("subscribableStatus", subscribableStatus); dependValues.put("userSubscribePref", userSubscribePref); } catch (JSONException e) } else { try { dependValues = new JSONObject(dependValuesStr); } catch (JSONException e) { e.printStackTrace(); } } String syncValuesStr = OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_ONESIGNAL_USERSTATE_SYNCVALYES_ + persistKey,null); try { if (syncValuesStr == null) { syncValues = new JSONObject(); String gtRegistrationId = OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_GT_REGISTRATION_ID,null); syncValues.put("identifier", gtRegistrationId); } else syncValues = new JSONObject(syncValuesStr); } catch (JSONException e) { e.printStackTrace(); } }

Target:
private void loadState() { String dependValuesStr = OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_ONESIGNAL_USERSTATE_DEPENDVALYES_ + persistKey, null); if (dependValuesStr == null) { dependValues = new JSONObject(); try { int subscribableStatus; boolean userSubscribePref = true; if (persistKey.equals(CURRENT_STATE)) subscribableStatus = OneSignalPrefs.getInt(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_ONESIGNAL_SUBSCRIPTION, 1); else subscribableStatus = OneSignalPrefs.getInt(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_ONESIGNAL_SYNCED_SUBSCRIPTION, 1); if (subscribableStatus == PUSH_STATUS_UNSUBSCRIBE) { subscribableStatus = 1; userSubscribePref = false; } dependValues.put(SUBSCRIBABLE_STATUS, subscribableStatus); dependValues.put(UNSUBSCRIBE_PREF, userSubscribePref); } catch (JSONException e) { } } else { try { dependValues = new JSONObject(dependValuesStr); } catch (JSONException e) { e.printStackTrace(); } } String syncValuesStr = OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_ONESIGNAL_USERSTATE_SYNCVALYES_ + persistKey, null); try { if (syncValuesStr == null) { syncValues = new JSONObject(); String gtRegistrationId = OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_GT_REGISTRATION_ID, null); syncValues.put(IDENTIFIER, gtRegistrationId); } else syncValues = new JSONObject(syncValuesStr); } catch (JSONException e) { e.printStackTrace(); } }
Source:
public void testNullInterfaceReturnsNull() { assertTrue(null == InterfaceParams.getByName(null)); }

Target:
public void testNullInterfaceReturnsNull() { assertNull(InterfaceParams.getByName(null)); }
Source:
public void setContent(Simulation simulation) { scenarioGridPanel.getScenarioGrid().setContent(simulation); selectLeftTopCell(); focusGrid(); }

Target:
public void setContent(Simulation simulation) { scenarioGridPanel.getScenarioGrid().setContent(simulation); scenarioGridPanel.setFocus(true); }
Source:
public TargetReference build() { String targetName = mapping.getTargetName(); if ( targetName == null ) { return null; } String targetNameTrimmed = targetName.trim(); if ( !targetName.equals( targetNameTrimmed ) ) { messager.printMessage( method.getExecutable(), mapping.getMirror(), mapping.getSourceAnnotationValue(), Message.PROPERTYMAPPING_WHITESPACE_TRIMMED, mapping.getTargetName() ); } String[] segments = targetNameTrimmed.split( "\\." ); Parameter parameter = method.getMappingTargetParameter(); boolean foundEntryMatch; Type resultType = method.getResultType(); String[] targetPropertyNames = segments; List<PropertyEntry> entries = getTargetEntries( resultType, targetPropertyNames ); foundEntryMatch = (entries.size() == targetPropertyNames.length); if ( !foundEntryMatch && segments.length > 1 && matchesSourceOrTargetParameter( segments[0], parameter, reverseSourceParameter, isReverse ) ) { targetPropertyNames = Arrays.copyOfRange( segments, 1, segments.length ); entries = getTargetEntries( resultType, targetPropertyNames ); foundEntryMatch = (entries.size() == targetPropertyNames.length); } if ( !foundEntryMatch && errorMessage != null) { errorMessage.report( isReverse ); } return new TargetReference( parameter, entries, foundEntryMatch ); }

Target:
public TargetReference build() { String targetName = mapping.getTargetName(); if ( targetName == null ) { return null; } String targetNameTrimmed = targetName.trim(); if ( !targetName.equals( targetNameTrimmed ) ) { messager.printMessage( method.getExecutable(), mapping.getMirror(), mapping.getTargetAnnotationValue(), Message.PROPERTYMAPPING_WHITESPACE_TRIMMED, targetName, targetNameTrimmed ); } String[] segments = targetNameTrimmed.split( "\\." ); Parameter parameter = method.getMappingTargetParameter(); boolean foundEntryMatch; Type resultType = method.getResultType(); String[] targetPropertyNames = segments; List<PropertyEntry> entries = getTargetEntries( resultType, targetPropertyNames ); foundEntryMatch = (entries.size() == targetPropertyNames.length); if ( !foundEntryMatch && segments.length > 1 && matchesSourceOrTargetParameter( segments[0], parameter, reverseSourceParameter, isReverse ) ) { targetPropertyNames = Arrays.copyOfRange( segments, 1, segments.length ); entries = getTargetEntries( resultType, targetPropertyNames ); foundEntryMatch = (entries.size() == targetPropertyNames.length); } if ( !foundEntryMatch && errorMessage != null) { errorMessage.report( isReverse ); } return new TargetReference( parameter, entries, foundEntryMatch ); }
Source:
public String addMetadaFromOpacPpn() { StringTokenizer tokenizer = new StringTokenizer(this.additionalOpacPpns, "\r\n"); while (tokenizer.hasMoreTokens()) { String tok = tokenizer.nextToken(); try { FileformatInterface addrdf = CataloguePlugin.getFirstHit(opacCatalog, QueryBuilder.restrictToField(opacSearchField, tok), myPrefs); if (addrdf != null) { List<MetadataTypeInterface> addableMetadataTypes = this.docStruct.getAddableMetadataTypes(); List<String> allowed = new ArrayList<>(); if (addableMetadataTypes != null && addableMetadataTypes.size() > 0) { for (MetadataTypeInterface metadataTypeInterface : addableMetadataTypes) { allowed.add(metadataTypeInterface.getName()); } } for (MetadataInterface metadataInterface : addrdf.getDigitalDocument().getLogicalDocStruct() .getAllMetadata()) { if (allowed.contains(metadataInterface.getMetadataType().getName())) { this.docStruct.addMetadata(metadataInterface); } } for (PersonInterface personInterface : addrdf.getDigitalDocument().getLogicalDocStruct() .getAllPersons()) { if (allowed.contains(personInterface.getMetadataType().getName())) { this.docStruct.addPerson(personInterface); } } readMetadataAsFirstTree(); } else { Helper.setMeldung(null, "Opac abgefragt: ", "kein Ergebnis"); } } catch (Exception e) { logger.error(e); } } saveMetadataAsBean(this.docStruct); this.modeView = "Metadaten"; return ""; }

Target:
public String addMetadaFromOpacPpn() { StringTokenizer tokenizer = new StringTokenizer(this.additionalOpacPpns, "\r\n"); while (tokenizer.hasMoreTokens()) { String tok = tokenizer.nextToken(); try { FileformatInterface addrdf = CataloguePlugin.getFirstHit(opacCatalog, QueryBuilder.restrictToField(opacSearchField, tok), myPrefs); if (addrdf != null) { List<MetadataTypeInterface> addableMetadataTypes = this.docStruct.getAddableMetadataTypes(); List<String> allowed = new ArrayList<>(); if (addableMetadataTypes != null && addableMetadataTypes.size() > 0) { for (MetadataTypeInterface metadataType : addableMetadataTypes) { allowed.add(metadataType.getName()); } } for (MetadataInterface metadata : addrdf.getDigitalDocument().getLogicalDocStruct() .getAllMetadata()) { if (allowed.contains(metadata.getMetadataType().getName())) { this.docStruct.addMetadata(metadata); } } for (PersonInterface person : addrdf.getDigitalDocument().getLogicalDocStruct().getAllPersons()) { if (allowed.contains(person.getMetadataType().getName())) { this.docStruct.addPerson(person); } } readMetadataAsFirstTree(); } else { Helper.setMeldung(null, "Opac abgefragt: ", "kein Ergebnis"); } } catch (Exception e) { logger.error(e); } } saveMetadataAsBean(this.docStruct); this.modeView = "Metadaten"; return ""; }
Source:
public BlockBuilder closeEntry() { if (!currentEntryOpened) { throw new IllegalStateException("Expected entry to be opened but was closed"); } entryAdded(false); currentEntryOpened = false; ensureHashTableSize(); int previousAggregatedEntryCount = offsets[positionCount - 1]; int aggregatedEntryCount = offsets[positionCount]; int entryCount = aggregatedEntryCount - previousAggregatedEntryCount; int[] rawHashTables = hashTables.get(); verify(rawHashTables != null, "rawHashTables is empty"); buildHashTable( keyBlockBuilder, previousAggregatedEntryCount, entryCount, keyBlockHashCode, rawHashTables, previousAggregatedEntryCount * HASH_MULTIPLIER, entryCount * HASH_MULTIPLIER); return this; }

Target:
public BlockBuilder closeEntry() { if (!currentEntryOpened) { throw new IllegalStateException("Expected entry to be opened but was closed"); } entryAdded(false); currentEntryOpened = false; ensureHashTableSize(); int previousAggregatedEntryCount = offsets[positionCount - 1]; int aggregatedEntryCount = offsets[positionCount]; int entryCount = aggregatedEntryCount - previousAggregatedEntryCount; int[] rawHashTables = hashTables.get(); verify(rawHashTables != null, "rawHashTables is null"); buildHashTable( keyBlockBuilder, previousAggregatedEntryCount, entryCount, keyBlockHashCode, rawHashTables, previousAggregatedEntryCount * HASH_MULTIPLIER, entryCount * HASH_MULTIPLIER); return this; }
Source:
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.cards.clear(); this.targets.clearChosen(); Player player = game.getPlayer(controllerId); if (player == null) { return false; } int amount = this.getTargets().get(0).getNumberOfTargets(); if (randomDiscard) { this.cards.addAll(player.discard(amount, true, ability, game).getCards(game)); } else if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { Cards toDiscard = new CardsImpl(); toDiscard.addAll(targets.get(0).getTargets()); Cards discarded = player.discard(toDiscard, ability, game); if (discarded != null) { cards.addAll(discarded.getCards(game)); } } paid = cards.size() >= amount; return paid; }

Target:
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.cards.clear(); this.targets.clearChosen(); Player player = game.getPlayer(controllerId); if (player == null) { return false; } int amount = this.getTargets().get(0).getNumberOfTargets(); if (randomDiscard) { this.cards.addAll(player.discard(amount, true, ability, game).getCards(game)); } else if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { Cards toDiscard = new CardsImpl(); toDiscard.addAll(targets.get(0).getTargets()); Cards discarded = player.discard(toDiscard, ability, game); if (!discarded.isEmpty()) { cards.addAll(discarded.getCards(game)); } } paid = cards.size() >= amount; return paid; }
Source:
private Mac getMacInstance() { int masterKeyLatestHashCode = this.credential.getKey().hashCode(); if (masterKeyLatestHashCode != this.masterKeyHashCode) { synchronized (this.credential) { if (masterKeyLatestHashCode != this.masterKeyHashCode) { byte[] masterKeyBytes = this.credential.getKey().getBytes(StandardCharsets.UTF_8); byte[] masterKeyDecodedBytes = Utils.Base64Decoder.decode(masterKeyBytes); SecretKey signingKey = new SecretKeySpec(masterKeyDecodedBytes, "HMACSHA256"); try { Mac macInstance = Mac.getInstance("HMACSHA256"); macInstance.init(signingKey); this.masterKeyHashCode = masterKeyLatestHashCode; this.macInstance = macInstance; } catch (NoSuchAlgorithmException | InvalidKeyException e) { throw new IllegalStateException(e); } } } } try { return (Mac)this.macInstance.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException(e); } }

Target:
private Mac getMacInstance() { reInitializeIfPossible(); try { return (Mac)this.macInstance.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException(e); } }
Source:
protected void step(Document document) throws GenDocException { if (document == null) { this.worked(1); return; } do { if (document.getXMLParser() == null || document.getXMLParser().getKind() != CONFIGURATION.metadata) continue; IDocumentMetadataService propertyService = ((IDocumentMetadataService)GendocServices.getDefault().getService(IDocumentMetadataService.class)); if (propertyService != null) { boolean modify = false; List<String> propertyNames = propertyService.getMetadataProperties(document); for (String prop : propertyNames) { String value = propertyService.getMetadataValue(document, prop); String newValue = replaceValue(value); if (newValue != null && newValue.equals(value)) continue; propertyService.setMetadataValue(document, prop, newValue); modify = true; } if (modify) { propertyService.saveMetadata(document); } } } while (document.jumpToNextFile()); document.getXMLParser().setCurrentNode(null); this.worked(1); }

Target:
protected void step(Document document) throws GenDocException { if (document == null) { this.worked(1); return; } do { if (document.getXMLParser() == null || document.getXMLParser().getKind() != CONFIGURATION.metadata) continue; IDocumentMetadataService propertyService = ((IDocumentMetadataService)GendocServices.getDefault().getService(IDocumentMetadataService.class)); if (propertyService != null) { boolean modify = false; List<String> propertyNames = propertyService.getMetadataProperties(document); for (String prop : propertyNames) { String value = propertyService.getMetadataValue(document, prop); String newValue = replaceValue(value); if (newValue != null && newValue.equals(value)) { continue; } propertyService.setMetadataValue(document, prop, newValue); modify = true; } if (modify) { propertyService.saveMetadata(document); } } } while (document.jumpToNextFile()); document.getXMLParser().setCurrentNode(null); this.worked(1); }
Source:
static boolean isBPMNFile(final String fileName) { return fileName.endsWith("." + FormsMigrationConstants.BPMN_EXTENSION) || fileName.endsWith("." + FormsMigrationConstants.BPMN2_EXTENSION) || fileName.endsWith("." + FormsMigrationConstants.BPMN_CM_EXTENSION); }

Target:
static boolean isBPMNFile(final String fileName) { return ResourceType.getResourceType("BPMN2").matchesExtension(fileName); }
Source:
public double getMajorCompactionThreshold() { return getDouble(MAJOR_COMPACTION_THRESHOLD, 0.6f); }

Target:
public double getMajorCompactionThreshold() { return getDouble(MAJOR_COMPACTION_THRESHOLD, 0.8f); }
Source:
public Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result) { Assert.notNull(result, "'result' must not be null"); return (Mono<Void>) result.getReturnValue(); }

Target:
public Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result) { Object returnValue = result.getReturnValue(); return returnValue == null ? Mono.empty() : (Mono<Void>) returnValue; }
Source:
private void findInjectionTargetForSuperTypeWithInjectExtra(TypeElement typeElement, InjectionTarget injectionTarget, boolean shouldAddInjectionMaps, boolean shouldStopAtFirstParent) { while (true) { TypeMirror superType = typeElement.getSuperclass(); if (superType.getKind() == TypeKind.NONE) { return; } final TypeElement superTypeElement = (TypeElement) ((DeclaredType) superType).asElement(); final InjectionTarget superInjectionTarget = scanTypeForInjectExtras(superTypeElement); if (!superInjectionTarget.injectionMap.isEmpty()) { if (injectionTarget.parentTarget == null) { final String packageName = getPackageName(superTypeElement); final String parentFqcn = packageName + "." + getClassName(superTypeElement, packageName); injectionTarget.parentTarget = parentFqcn; if (shouldAddInjectionMaps && !superInjectionTarget.injectionMap.isEmpty()) { injectionTarget.injectionMap.putAll(superInjectionTarget.injectionMap); } } if (shouldStopAtFirstParent) { return; } } typeElement = superTypeElement; } }

Target:
private void findInjectionTargetForSuperTypeWithInjectExtra(TypeElement typeElement, InjectionTarget injectionTarget, boolean shouldAddInjectionMaps, boolean shouldStopAtFirstParent) { while (true) { TypeMirror superType = typeElement.getSuperclass(); if (superType.getKind() == TypeKind.NONE) { return; } final TypeElement superTypeElement = (TypeElement) ((DeclaredType) superType).asElement(); final InjectionTarget superInjectionTarget = scanTypeForInjectExtras(superTypeElement); if (!superInjectionTarget.injectionMap.isEmpty()) { if (injectionTarget.parentTarget == null) { final String packageName = getPackageName(superTypeElement); injectionTarget.parentTarget = packageName + "." + getClassName(superTypeElement, packageName); } if (shouldAddInjectionMaps) { injectionTarget.injectionMap.putAll(superInjectionTarget.injectionMap); } if (shouldStopAtFirstParent) { return; } } typeElement = superTypeElement; } }
Source:
public Set<String> getFreeVariables() { Set<String> freeVars = toReplace.getFreeVariables(); freeVars.addAll(inExpr.getFreeVariables()); freeVars.remove(varName); return freeVars; }

Target:
public Set<String> getFreeVariables() { return toReplace.getFreeVariables(); }
Source:
protected static ConsumerMethodModel.AsyncMethodInfo convertMethodConfig2AyncInfo(MethodConfig methodConfig) { if (methodConfig == null || (methodConfig.getOninvoke() == null && methodConfig.getOnreturn() == null && methodConfig.getOnthrow() == null)) { return null; } if (Boolean.FALSE.equals(methodConfig.isReturn()) && (methodConfig.getOnreturn() != null || methodConfig.getOnthrow() != null)) { throw new IllegalStateException("method config error : return attribute must be set true when onreturn or onthrow has been setted."); } ConsumerMethodModel.AsyncMethodInfo asyncMethodInfo = new ConsumerMethodModel.AsyncMethodInfo(); asyncMethodInfo.setOninvokeInstance(methodConfig.getOninvoke()); asyncMethodInfo.setOnreturnInstance(methodConfig.getOnreturn()); asyncMethodInfo.setOnthrowInstance(methodConfig.getOnthrow()); try { String oninvokeMethod = methodConfig.getOninvokeMethod(); if (StringUtils.isNotEmpty(oninvokeMethod)) { asyncMethodInfo.setOninvokeMethod(getMethodByName(methodConfig.getOninvoke().getClass(), oninvokeMethod)); } String onreturnMethod = methodConfig.getOnreturnMethod(); if (StringUtils.isNotEmpty(onreturnMethod)) { asyncMethodInfo.setOnreturnMethod(getMethodByName(methodConfig.getOnreturn().getClass(), onreturnMethod)); } String onthrowMethod = methodConfig.getOnthrowMethod(); if (StringUtils.isNotEmpty(onthrowMethod)) { asyncMethodInfo.setOnthrowMethod(getMethodByName(methodConfig.getOnthrow().getClass(), onthrowMethod)); } } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } return asyncMethodInfo; }

Target:
protected static ConsumerMethodModel.AsyncMethodInfo convertMethodConfig2AyncInfo(MethodConfig methodConfig) { if (methodConfig == null || (methodConfig.getOninvoke() == null && methodConfig.getOnreturn() == null && methodConfig.getOnthrow() == null)) { return null; } if (Boolean.FALSE.equals(methodConfig.isReturn()) && (methodConfig.getOnreturn() != null || methodConfig.getOnthrow() != null)) { throw new IllegalStateException("method config error : return attribute must be set true when onreturn or onthrow has been set."); } ConsumerMethodModel.AsyncMethodInfo asyncMethodInfo = new ConsumerMethodModel.AsyncMethodInfo(); asyncMethodInfo.setOninvokeInstance(methodConfig.getOninvoke()); asyncMethodInfo.setOnreturnInstance(methodConfig.getOnreturn()); asyncMethodInfo.setOnthrowInstance(methodConfig.getOnthrow()); try { String oninvokeMethod = methodConfig.getOninvokeMethod(); if (StringUtils.isNotEmpty(oninvokeMethod)) { asyncMethodInfo.setOninvokeMethod(getMethodByName(methodConfig.getOninvoke().getClass(), oninvokeMethod)); } String onreturnMethod = methodConfig.getOnreturnMethod(); if (StringUtils.isNotEmpty(onreturnMethod)) { asyncMethodInfo.setOnreturnMethod(getMethodByName(methodConfig.getOnreturn().getClass(), onreturnMethod)); } String onthrowMethod = methodConfig.getOnthrowMethod(); if (StringUtils.isNotEmpty(onthrowMethod)) { asyncMethodInfo.setOnthrowMethod(getMethodByName(methodConfig.getOnthrow().getClass(), onthrowMethod)); } } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } return asyncMethodInfo; }
Source:
public synchronized void flush() throws IOException { if (closed) { throw new IllegalStateException("Cannot flush when the BufferedMutator is closed."); } if (!writeBuffer.isEmpty()) { List<Row> copy = Lists.<Row> newArrayList(writeBuffer); for (List<Row> partition : Lists.partition(copy, 30)) { writeBuffer.removeAll(partition); try { batchExecutor.batch(partition); } catch (RetriesExhaustedWithDetailsException e) { listener.onException(e, this); } catch (IOException e) { List<Throwable> problems = Lists.<Throwable> newArrayList(e); ArrayList<String> hostnames = new ArrayList<String>(1); listener.onException( new RetriesExhaustedWithDetailsException(problems, partition, hostnames), this); } } currentWriteBufferSize = 0; for (Mutation m : writeBuffer) { currentWriteBufferSize += m.heapSize(); } } }

Target:
public synchronized void flush() throws IOException { if (closed) { throw new IllegalStateException("Cannot flush when the BufferedMutator is closed."); } if (!writeBuffer.isEmpty()) { List<Row> copy = Lists.<Row> newArrayList(writeBuffer); for (List<Row> partition : Lists.partition(copy, this.maxInflightRpcCount)) { writeBuffer.removeAll(partition); try { batchExecutor.batch(partition); } catch (RetriesExhaustedWithDetailsException e) { listener.onException(e, this); } catch (IOException e) { List<Throwable> problems = Lists.<Throwable> newArrayList(e); ArrayList<String> hostnames = new ArrayList<String>(1); listener.onException( new RetriesExhaustedWithDetailsException(problems, partition, hostnames), this); } } currentWriteBufferSize = 0; for (Mutation m : writeBuffer) { currentWriteBufferSize += m.heapSize(); } } }
Source:
public Properties getConsumerProperties(String inputChannelName) { Properties channelConsumerProperties = new Properties(); BindingProperties bindingProperties = this.bindings.get(inputChannelName); if (bindingProperties != null) { if (bindingProperties.getConcurrency() != null) { channelConsumerProperties.setProperty(BinderPropertyKeys.CONCURRENCY, Integer.toString(bindingProperties.getConcurrency())); } if (Boolean.TRUE.equals(bindingProperties.isDurableSubscription())) { channelConsumerProperties.setProperty(BinderPropertyKeys.DURABLE, Boolean.toString(bindingProperties.isDurableSubscription())); } updateConsumerPartitionProperties(inputChannelName, channelConsumerProperties); } return channelConsumerProperties; }

Target:
public Properties getConsumerProperties(String inputChannelName) { Properties channelConsumerProperties = new Properties(); BindingProperties bindingProperties = this.bindings.get(inputChannelName); if (bindingProperties != null) { if (bindingProperties.getConcurrency() != null) { channelConsumerProperties.setProperty(BinderPropertyKeys.CONCURRENCY, Integer.toString(bindingProperties.getConcurrency())); } if (bindingProperties.isDurableSubscription() != null) { channelConsumerProperties.setProperty(BinderPropertyKeys.DURABLE, Boolean.toString(bindingProperties.isDurableSubscription())); } updateConsumerPartitionProperties(inputChannelName, channelConsumerProperties); } return channelConsumerProperties; }
Source:
HtmlElementTransformation(String tagName, String attributeName) { this.matchingTagName = tagName; this.matchingAttributeName = attributeName; }

Target:
private HtmlElementTransformation(String tagName, String attributeName) { this.matchingTagName = tagName; this.matchingAttributeName = attributeName; }
Source:
public FileReplacer(final File file) throws IOException { this.file = checkNotNull(file); this.filePrefix = file.getName() + "-" + UUID.randomUUID().toString() + "-" + counter.getAndIncrement(); this.tempFile = new File(file.getParentFile(), filePrefix + ".tmp"); this.backupFile = new File(file.getParentFile(), filePrefix + ".bak"); file.getParentFile().mkdirs(); if (tempFile.exists()) { log.warn("Temporary file already exists; removing: {}", tempFile); delete(tempFile); } tempFile.createNewFile(); }

Target:
public FileReplacer(final File file) throws IOException { this.file = checkNotNull(file); this.filePrefix = file.getName() + "-" + UUID.randomUUID() + "-" + counter.getAndIncrement(); this.tempFile = new File(file.getParentFile(), filePrefix + ".tmp"); this.backupFile = new File(file.getParentFile(), filePrefix + ".bak"); file.getParentFile().mkdirs(); if (tempFile.exists()) { log.warn("Temporary file already exists; removing: {}", tempFile); delete(tempFile); } tempFile.createNewFile(); }
Source:
public HttpResponse doIndex( final HttpServletRequest request, @QueryParameter(required = true) @Nonnull final VstsHookEventName event, @StringBodyParameter @Nonnull final String body) { LOGGER.log(Level.FINER, "{}/?event={}\n{}", new String[]{URL_NAME, event.name(), body}); final Object parsedBody = event.parse(body); List<? extends GitStatus.ResponseContributor> contributors = null; switch (event) { case PING: final String message = "Pong from the Jenkins TFS plugin! Here's your body:\n" + parsedBody; final GitStatus.MessageResponseContributor contributor; contributor = new GitStatus.MessageResponseContributor(message); contributors = Collections.singletonList(contributor); case BUILD_COMPLETED: break; case GIT_CODE_PUSHED: break; case TFVC_CODE_CHECKED_IN: break; case PULL_REQUEST_MERGE_COMMIT_CREATED: break; case DEPLOYMENT_COMPLETED: break; case RELEASE_CREATED: break; } if (contributors == null) { return HttpResponses.error(SC_BAD_REQUEST, "Not implemented"); } else { final List<? extends GitStatus.ResponseContributor> finalContributors = contributors; return new HttpResponse() { public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { rsp.setStatus(SC_OK); rsp.setContentType("text/plain"); for (GitStatus.ResponseContributor c : finalContributors) { c.addHeaders(req, rsp); } PrintWriter w = rsp.getWriter(); for (GitStatus.ResponseContributor c : finalContributors) { c.writeBody(req, rsp, w); } } }; } }

Target:
public HttpResponse doIndex( final HttpServletRequest request, @QueryParameter(required = true) @Nonnull final VstsHookEventName event, @StringBodyParameter @Nonnull final String body) { LOGGER.log(Level.FINER, "{}/?event={}\n{}", new String[]{URL_NAME, event.name(), body}); final Object parsedBody = event.parse(body); List<? extends GitStatus.ResponseContributor> contributors = null; switch (event) { case PING: final String message = "Pong from the Jenkins TFS plugin! Here's your body:\n" + parsedBody; final GitStatus.MessageResponseContributor contributor; contributor = new GitStatus.MessageResponseContributor(message); contributors = Collections.singletonList(contributor); case BUILD_COMPLETED: break; case GIT_CODE_PUSHED: break; case TFVC_CODE_CHECKED_IN: break; case PULL_REQUEST_MERGE_COMMIT_CREATED: break; case DEPLOYMENT_COMPLETED: break; } if (contributors == null) { return HttpResponses.error(SC_BAD_REQUEST, "Not implemented"); } else { final List<? extends GitStatus.ResponseContributor> finalContributors = contributors; return new HttpResponse() { public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { rsp.setStatus(SC_OK); rsp.setContentType(MediaType.TEXT_PLAIN); for (GitStatus.ResponseContributor c : finalContributors) { c.addHeaders(req, rsp); } rsp.setCharacterEncoding(MediaType.UTF_8.name()); PrintWriter w = rsp.getWriter(); for (GitStatus.ResponseContributor c : finalContributors) { c.writeBody(req, rsp, w); } } }; } }
Source:
public static Boolean isString(Schema.Type type) { return Schema.Type.STRING.equals(type); }

Target:
public static boolean isString(Schema.Type type) { return Schema.Type.STRING.equals(type); }
Source:
private User makeTicketReceiver(){ User receiver = new User("receiver", new BCryptPasswordEncoder().encode("password"), "receiver@gmail.com"); receiver.getProfile() .setAllFields("receiver", " of tickets", "GotYaTicket", Gender.MALE, "Money Owner 4", "2826GJ", "Tomorrowland", "0906-1111", null); userRepository.saveAndFlush(receiver); return receiver; }

Target:
private User makeTicketReceiver(){ User receiver = new User("receiver", new BCryptPasswordEncoder().encode("password"), "receiver@gmail.com"); receiver.getProfile() .setAllFields("receiver", " of tickets", "GotYaTicket", Gender.MALE, "Money Owner 4", "2826GJ", "Tomorrowland", "0906-1111", null); return userRepository.saveAndFlush(receiver); }
Source:
public static boolean isRecoveryProblems() { return recoveryProblems.get(); }

Target:
boolean isRecoveryProblems() { return this.recoveryProblems.get(); }
Source:
private File[] getPathsToScan() { String lastKnownCczLocation = HiddenPreferences.getLastKnownCczLocation(); ArrayList<File> filePathsToScan = new ArrayList<>(3); if (!StringUtils.isEmpty(lastKnownCczLocation)) { filePathsToScan.add(new File(lastKnownCczLocation)); } Logger.log(LogTypes.SOFT_ASSERT, "Access outside scoped storage in scanning cczs."); filePathsToScan.add(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)); filePathsToScan.add(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)); return filePathsToScan.toArray(new File[filePathsToScan.size()]); }

Target:
private File[] getPathsToScan() { String lastKnownCczLocation = HiddenPreferences.getLastKnownCczLocation(); ArrayList<File> filePathsToScan = new ArrayList<>(3); if (!StringUtils.isEmpty(lastKnownCczLocation)) { filePathsToScan.add(new File(lastKnownCczLocation)); } filePathsToScan.add(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)); filePathsToScan.add(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)); return filePathsToScan.toArray(new File[filePathsToScan.size()]); }
Source:
public String render(final PutBulkResult result) throws JsonProcessingException { final CommonJsonView view = CommonJsonView.newView(CommonJsonView.Status.OK); if (result.getIgnoredFiles() == null || result.getIgnoredFiles().isEmpty()) { view.message(result.getResult()); } else { view.data(result); } return JsonMapper.toJson(view); }

Target:
public String render(final PutBulkResult result) throws JsonProcessingException { final CommonJsonView view = CommonJsonView.newView(CommonJsonView.Status.OK); if (Guard.isNullOrEmpty(result.getIgnoredFiles())) { view.message(result.getResult()); } else { view.data(result); } return JsonMapper.toJson(view); }
Source:
public void tearDown() throws Exception { this.mTranslateSpecialChar = null; this.mTestStr.clear(); this.mVerifyStr.clear(); }

Target:
public void tearDown() throws Exception { mTranslateSpecialChar = null; mTestStr.clear(); mVerifyStr.clear(); }
Source:
protected static List<PermissionSet> buildListOfSelectableRoles(WebappDaoFactory wadf) { List<PermissionSet> list = new ArrayList<PermissionSet>(); for (PermissionSet ps: wadf.getUserAccountsDao().getAllPermissionSets()) { if (!ps.isForPublic()) { list.add(ps); } } list.sort(new Comparator<PermissionSet>() { @Override public int compare(PermissionSet ps1, PermissionSet ps2) { return ps1.getUri().compareTo(ps2.getUri()); } }); for (PermissionSet ps: wadf.getUserAccountsDao().getAllPermissionSets()) { if (ps.isForPublic()) { list.add(ps); } } return list; }

Target:
private static List<PermissionSet> buildListOfSelectableRoles(WebappDaoFactory wadf) { List<PermissionSet> list = new ArrayList<>(); for (PermissionSet ps: wadf.getUserAccountsDao().getAllPermissionSets()) { if (!ps.isForPublic()) { list.add(ps); } } list.sort(new Comparator<PermissionSet>() { @Override public int compare(PermissionSet ps1, PermissionSet ps2) { return ps1.getUri().compareTo(ps2.getUri()); } }); for (PermissionSet ps: wadf.getUserAccountsDao().getAllPermissionSets()) { if (ps.isForPublic()) { list.add(ps); } } return list; }
Source:
public static void setUpJenkins() throws Exception { store = CredentialsProvider.lookupStores(r.jenkins).iterator().next(); appCredentials = new GitHubAppCredentials( CredentialsScope.GLOBAL, myAppCredentialsId, "sample", "54321", Secret.fromString(JwtHelperTest.PKCS8_PRIVATE_KEY)); appCredentials.setOwner("cloudbeers"); store.addCredentials(Domain.global(), appCredentials); LogRecorderManager mgr = r.jenkins.getLog(); logRecorder = new LogRecorder(GitHubAppCredentials.class.getName()); mgr.logRecorders.put(GitHubAppCredentials.class.getName(), logRecorder); LogRecorder.Target t = new LogRecorder.Target(GitHubAppCredentials.class.getName(), Level.FINER); logRecorder.targets.add(t); logRecorder.save(); t.enable(); agent = r.createOnlineSlave(); agent.setLabelString("my-agent"); }

Target:
public static void setUpJenkins() throws Exception { store = CredentialsProvider.lookupStores(r.jenkins).iterator().next(); appCredentials = new GitHubAppCredentials( CredentialsScope.GLOBAL, myAppCredentialsId, "sample", "54321", Secret.fromString(JwtHelperTest.PKCS8_PRIVATE_KEY)); appCredentials.setOwner("cloudbeers"); store.addCredentials(Domain.global(), appCredentials); agent = r.createOnlineSlave(); agent.setLabelString("my-agent"); LogRecorderManager mgr = r.jenkins.getLog(); logRecorder = new LogRecorder(GitHubAppCredentials.class.getName()); mgr.logRecorders.put(GitHubAppCredentials.class.getName(), logRecorder); LogRecorder.Target t = new LogRecorder.Target(GitHubAppCredentials.class.getName(), Level.FINE); logRecorder.targets.add(t); logRecorder.save(); t.enable(); }
Source:
public void testEmptyParameter() { PhoneHomeParameterCreator phoneHomeParameterCreator = new PhoneHomeParameterCreator(); Map<String, String> map = phoneHomeParameterCreator.getParameters(); assertNotNull(map); assertEquals(map, new HashMap<>()); assertEquals(phoneHomeParameterCreator.build(), "?"); }

Target:
public void testEmptyParameter() { PhoneHomeParameterCreator phoneHomeParameterCreator = new PhoneHomeParameterCreator(); Map<String, String> map = phoneHomeParameterCreator.getParameters(); assertEquals(Collections.emptyMap(), map); assertEquals(phoneHomeParameterCreator.build(), "?"); }
Source:
public void testGenerate() throws IOException{ final LabelsGeneratorInput input = new LabelsGeneratorInput(); input.setAllAvailablefields(this.mockAvailableFields()); input.setFileName("filename"); input.setBarcodeRequired(false); input.setNumberOfRowsPerPageOfLabel("7"); input.setSizeOfLabelSheet("1"); final LabelsData data = new LabelsData(TermId.OBS_UNIT_ID.getId(), Arrays.asList(this.mockLabels())); final File file = this.pdfLabelsFileGenerator.generate(input, data); Assert.assertNotNull(file); Assert.assertEquals("filename.pdf", file.getName()); }

Target:
public void testGenerate() throws IOException{ final LabelsGeneratorInput input = new LabelsGeneratorInput(); input.setAllAvailablefields(this.mockAvailableFields()); input.setFileName("filename"); input.setBarcodeRequired(false); input.setNumberOfRowsPerPageOfLabel("7"); input.setSizeOfLabelSheet("1"); final LabelsData data = new LabelsData(TermId.OBS_UNIT_ID.getId(), Arrays.asList(this.mockLabels())); final File file = this.pdfLabelsFileGenerator.generate(input, data); Assert.assertNotNull(file); Assert.assertEquals("filename.pdf", file.getName()); file.delete(); }