auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<String> getTumorNamesBySpecialTumorType(String cancerType){ List<String> tumorTypes = new ArrayList<>(); String url = "<LINK_0>"; RestTemplate restTemplate = new RestTemplate(); ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); JSONParser parser = new JSONParser(); try{ JSONArray typesArray = (JSONArray) parser.parse(response.getBody()); TumorType[] mainTypes = new TumorType[typesArray.size()]; for (int i = 0; i < typesArray.size(); i++){ JSONObject type = (JSONObject)typesArray.get(i); mainTypes[i] = new TumorType(); mainTypes[i].setName((String)type.get("name")); mainTypes[i].setTumorForm((String)type.get("tumorForm")); if (mainTypes[i].getTumorForm() != null && mainTypes[i].getTumorForm().equals(TumorFormMap.get(cancerType))){ tumorTypes.add(mainTypes[i].getName().split(",")[0]); } } } catch(ParseException e){ } return tumorTypes; }

Target:
private Set<String> getTumorNamesBySpecialTumorType(String cancerType){ Set<String> tumorTypes = new HashSet<>(); List<TumorType> allOncoTreeTypes = TumorTypeUtils.getAllOncoTreeTypes(); for (TumorType type: allOncoTreeTypes){ if (type.getMainType() != null && type.getMainType().getTumorForm() != null && TumorFormMap.get(cancerType).equalsIgnoreCase(type.getMainType().getTumorForm().toString())){ String name = TumorTypeUtils.getTumorTypeName(type); if (name.length()>0) tumorTypes.add(name); } } return tumorTypes; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_gallery_deselect_selected: this.onResume(); return true; case R.id.menu_gallery_load_more: if (turnsNeeded > 1) { turnsNeeded -= 1; turnsDone += 1; localImagesPerTurn += PER_TURN; resumeLocalPhoto(); } else { localImagesPerTurn += loadLeft; turnsNeeded -= 1; turnsDone += 1; resumeLocalPhoto(); galleryMenu.findItem(R.id.menu_gallery_load_more).setVisible(false); } return true; case R.id.menu_gallery_delete_selected: AlertDialog.Builder deleteAlert = new AlertDialog.Builder(ctx); deleteAlert.setMessage(R.string.delete_images) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteCheckedImages(); } }) .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); deleteAlert.create().show(); case R.id.menu_gallery_select_all: photosAdapter.selectAllImages(); int imgCount = localImageList.size(); String newTitle; if (imgCount > 0) { newTitle = imgCount + " images" + " selected"; } else { newTitle = getResources().getString(R.string.application_title); } getActivity().setTitle(newTitle); getActivity().invalidateOptionsMenu(); return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_gallery_deselect_selected: this.onResume(); return true; case R.id.menu_gallery_load_more: if (turnsNeeded > 1) { turnsNeeded -= 1; turnsDone += 1; localImagesPerTurn += PER_TURN; resumeLocalPhoto(); } else { localImagesPerTurn += loadLeft; turnsNeeded -= 1; turnsDone += 1; resumeLocalPhoto(); galleryMenu.findItem(R.id.menu_gallery_load_more).setVisible(false); } return true; case R.id.menu_gallery_delete_selected: AlertDialog.Builder deleteAlert = new AlertDialog.Builder(ctx); deleteAlert.setMessage(R.string.delete_images) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteCheckedImages(); } }) .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); deleteAlert.create().show(); case R.id.menu_gallery_select_all: photosAdapter.selectAllImages(); int imgCount = localImageList.size(); String newTitle; if (imgCount > 0) { newTitle = imgCount == 1 ? getResources().getString(R.string.single_image_selected) : String.format(getString(R.string.images_selected), imgCount); } else { newTitle = getResources().getString(R.string.application_title); } getActivity().setTitle(newTitle); getActivity().invalidateOptionsMenu(); return true; default: return super.onOptionsItemSelected(item); } }
Source:
private void onDiscordReady(DiscordUser discordUser) { log.info("Discord is ready, with user: ''{}''", discordUser.username); }

Target:
private void onDiscordReady(DiscordUser discordUser) { log.info("Discord is ready with user '{}'", discordUser.username); }
Source:
public void sourceMappingChangesHelper(boolean withBackend) throws Throwable { doMappingAndLaunch(EXEC_AC_NAME, withBackend); MapEntrySourceContainer incorrectMapEntry = new MapEntrySourceContainer(BUILD_ABSPATH + "/incorrectsubpath", new Path(SOURCE_ABSPATH)); if (withBackend) { assertSourceFound(); } else { assertSourceFoundByDirectorOnly(); } ISourceContainer[][] containers = new ISourceContainer[1][]; MappingSourceContainer[] mappingSourceContainer = new MappingSourceContainer[1]; updateSourceDirector(director -> { containers[0] = director.getSourceContainers(); mappingSourceContainer[0] = (MappingSourceContainer) containers[0][1]; mappingSourceContainer[0].removeMapEntry(fMapEntrySourceContainerC); mappingSourceContainer[0].addMapEntry(incorrectMapEntry); director.setSourceContainers(containers[0]); }); if (withBackend) { doCdToBinDir(); } assertSourceNotFound(); updateSourceDirector(director -> { containers[0] = director.getSourceContainers(); mappingSourceContainer[0] = (MappingSourceContainer) containers[0][1]; mappingSourceContainer[0].removeMapEntry(incorrectMapEntry); mappingSourceContainer[0].addMapEntry(fMapEntrySourceContainerC); director.setSourceContainers(containers[0]); }); if (withBackend) { assertSourceFound(); } else { assertSourceFoundByDirectorOnly(); } }

Target:
public void sourceMappingChangesHelper(boolean withBackend) throws Throwable { doMappingAndLaunch(EXEC_AC_NAME, withBackend); MapEntrySourceContainer incorrectMapEntry = new MapEntrySourceContainer(BUILD_ABSPATH + "/incorrectsubpath", new Path(SOURCE_ABSPATH)); if (withBackend) { assertSourceFound(); } else { assertSourceFoundByDirectorOnly(); } final ISourceContainer[][] containers = new ISourceContainer[1][]; final MappingSourceContainer[] mappingSourceContainer = new MappingSourceContainer[1]; updateSourceDirector(director -> { containers[0] = director.getSourceContainers(); mappingSourceContainer[0] = (MappingSourceContainer) containers[0][1]; mappingSourceContainer[0].removeMapEntry(fMapEntrySourceContainerC); mappingSourceContainer[0].addMapEntry(incorrectMapEntry); director.setSourceContainers(containers[0]); }); if (withBackend) { doCdToBinDir(); } assertSourceNotFound(); updateSourceDirector(director -> { containers[0] = director.getSourceContainers(); mappingSourceContainer[0] = (MappingSourceContainer) containers[0][1]; mappingSourceContainer[0].removeMapEntry(incorrectMapEntry); mappingSourceContainer[0].addMapEntry(fMapEntrySourceContainerC); director.setSourceContainers(containers[0]); }); if (withBackend) { assertSourceFound(); } else { assertSourceFoundByDirectorOnly(); } }
Source:
public void postProcessAdminWithOptionsSuccess() throws Exception { LinkedList<DSpaceCommandLineParameter> parameters = new LinkedList<>(); parameters.add(new DSpaceCommandLineParameter("-r", "test")); parameters.add(new DSpaceCommandLineParameter("-i", null)); List<ParameterValueRest> list = parameters.stream() .map(dSpaceCommandLineParameter -> dSpaceRunnableParameterConverter .convert(dSpaceCommandLineParameter, Projection.DEFAULT)) .collect(Collectors.toList()); String token = getAuthToken(admin.getEmail(), password); List<ProcessStatus> acceptableProcessStatuses = new LinkedList<>(); acceptableProcessStatuses.addAll(Arrays.asList(ProcessStatus.SCHEDULED, ProcessStatus.RUNNING, ProcessStatus.COMPLETED)); MvcResult mvcResult = getClient(token) .perform(post("/api/system/scripts/mock-script/processes").contentType("multipart/form-data") .param("properties", new Gson().toJson(list))) .andExpect(status().isAccepted()) .andExpect(jsonPath("$", is( ProcessMatcher.matchProcess("mock-script", String.valueOf(admin.getID()), parameters, acceptableProcessStatuses)))).andReturn(); ObjectMapper mapper = new ObjectMapper(); String content = mvcResult.getResponse().getContentAsString(); Map<String, Object> map = mapper.readValue(content, Map.class); Integer processId = Integer.valueOf(String.valueOf(map.get("processId"))); getClient(token).perform(delete("/api/system/processes/" + processId)); }

Target:
public void postProcessAdminWithOptionsSuccess() throws Exception { LinkedList<DSpaceCommandLineParameter> parameters = new LinkedList<>(); parameters.add(new DSpaceCommandLineParameter("-r", "test")); parameters.add(new DSpaceCommandLineParameter("-i", null)); List<ParameterValueRest> list = parameters.stream() .map(dSpaceCommandLineParameter -> dSpaceRunnableParameterConverter .convert(dSpaceCommandLineParameter, Projection.DEFAULT)) .collect(Collectors.toList()); String token = getAuthToken(admin.getEmail(), password); List<ProcessStatus> acceptableProcessStatuses = new LinkedList<>(); acceptableProcessStatuses.addAll(Arrays.asList(ProcessStatus.SCHEDULED, ProcessStatus.RUNNING, ProcessStatus.COMPLETED)); AtomicReference<Integer> idRef = new AtomicReference<>(); try { getClient(token) .perform(post("/api/system/scripts/mock-script/processes").contentType("multipart/form-data") .param("properties", new Gson().toJson(list))) .andExpect(status().isAccepted()) .andExpect(jsonPath("$", is( ProcessMatcher.matchProcess("mock-script", String.valueOf(admin.getID()), parameters, acceptableProcessStatuses)))) .andDo(result -> idRef .set(read(result.getResponse().getContentAsString(), "$.processId"))); } finally { ProcessBuilder.deleteProcess(idRef.get()); } }
Source:
public Response getRunningTasksByDataSource(@PathParam("dataSource") String dataSource, @Context HttpServletRequest request) { List<TaskRunnerWorkItem> taskRunnerWorkItemList = new ArrayList<>(); Optional<TaskRunner> ts = taskMaster.getTaskRunner(); if (ts.isPresent()) { Collection<? extends TaskRunnerWorkItem> runningTasks = ts.get().getRunningTasks(); if (runningTasks == null || runningTasks.isEmpty()) { return Response.ok("No running tasks found").build(); } for (TaskRunnerWorkItem taskRunnerWorkItem : runningTasks) { if (taskRunnerWorkItem.getDataSource().equals(dataSource)) { taskRunnerWorkItemList.add(taskRunnerWorkItem); } } } return Response.ok(taskRunnerWorkItemList).build(); }

Target:
public Response getRunningTasksByDataSource(@PathParam("dataSource") String dataSource, @Context HttpServletRequest request) { Optional<TaskRunner> ts = taskMaster.getTaskRunner(); if (!ts.isPresent()) { return Response.status(Response.Status.NOT_FOUND).entity("No tasks are running").build(); } Collection<? extends TaskRunnerWorkItem> runningTasks = ts.get().getRunningTasks(); if (runningTasks == null || runningTasks.isEmpty()) { return Response.status(Response.Status.NOT_FOUND) .entity("No running tasks found for the datasource : " + dataSource).build(); } List<TaskRunnerWorkItem> taskRunnerWorkItemList = runningTasks.stream() .filter(task -> dataSource.equals(task.getDataSource())).collect(Collectors.toList()); return Response.ok(taskRunnerWorkItemList).build(); }
Source:
public OneUuidReturnForXmlRpc glusterSnapshotCreate(String volumeName, String snapshotName, String description, boolean force) { JsonRpcRequest request = new RequestBuilder("GlusterSnapshot.create").withOptionalParameter("volumeName", volumeName) .withParameter("snapName", snapshotName) .withParameter("description", description) .withParameter("force", force) .build(); Map<String, Object> response = new FutureMap(this.client, request).withIgnoreResponseKey(); return new OneUuidReturnForXmlRpc(response); }

Target:
public OneUuidReturnForXmlRpc glusterSnapshotCreate(String volumeName, String snapshotName, String description, boolean force) { JsonRpcRequest request = new RequestBuilder("GlusterSnapshot.create").withParameter("volumeName", volumeName) .withParameter("snapName", snapshotName) .withOptionalParameter("description", description) .withParameter("force", force) .build(); Map<String, Object> response = new FutureMap(this.client, request).withIgnoreResponseKey(); return new OneUuidReturnForXmlRpc(response); }
Source:
public void migratePrimaryKeyTableIfNeeded_first() throws IOException { configFactory.copyRealmFromAssets(context, "080_annotationtypes.realm", "default.realm"); sharedRealm = SharedRealm.getInstance(config); sharedRealm.beginTransaction(); assertTrue(Table.migratePrimaryKeyTableIfNeeded(sharedRealm)); sharedRealm.commitTransaction(); Table t = sharedRealm.getTable("class_AnnotationTypes"); assertEquals(t.getColumnIndex("id"), t.getPrimaryKey()); assertTrue(t.hasPrimaryKey()); assertEquals(RealmFieldType.STRING, sharedRealm.getTable("pk").getColumnType(0)); }

Target:
public void migratePrimaryKeyTableIfNeeded_first() throws IOException { configFactory.copyRealmFromAssets(context, "080_annotationtypes.realm", "default.realm"); sharedRealm = SharedRealm.getInstance(config); sharedRealm.beginTransaction(); assertTrue(Table.migratePrimaryKeyTableIfNeeded(sharedRealm)); sharedRealm.commitTransaction(); Table t = sharedRealm.getTable("class_AnnotationTypes"); assertTrue(t.hasPrimaryKey()); assertEquals(t.getColumnIndex("id"), t.getPrimaryKey()); assertEquals(RealmFieldType.STRING, sharedRealm.getTable("pk").getColumnType(0)); }
Source:
public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, int newVersion) { if (newVersion <= 2) { db.execSQL(QUERY_TABLE_DROP); onCreate(context, db); } else if (newVersion >= 3) { final String ALTER_TBL = "ALTER TABLE " + TABLENAME + " ADD COLUMN " + COLUMN_IS_PAID_ACCOUNT + " integer default 0;"; db.execSQL(ALTER_TBL); } }

Target:
public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion <= 2) { final String ALTER_TBL = "ALTER TABLE " + TABLENAME + " ADD COLUMN " + COLUMN_IS_PAID_ACCOUNT + " integer default 0;"; db.execSQL(ALTER_TBL); } }
Source:
public CommandCallback getCallback() { if (getParameters().isUseCinderCommandCallback()) { return new ConcurrentChildCommandsExecutionCallback(); } return new SerialChildCommandsExecutionCallback(); }

Target:
public CommandCallback getCallback() { return getParameters().isUseCinderCommandCallback() ? new ConcurrentChildCommandsExecutionCallback() : new SerialChildCommandsExecutionCallback(); }
Source:
private void stopWithSavepointStreamTaskTestHelper(final boolean withMaxWatermark) throws Exception { final long syncSavepointId = 34L; final StreamTaskTestHarness<Long> srcTaskTestHarness = getSourceStreamTaskTestHarness(); final Thread executionThread = srcTaskTestHarness.invoke(); final StreamTask<Long, ?> srcTask = srcTaskTestHarness.getTask(); waitForLatchSetByTask(ready, srcTaskTestHarness); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 1L); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 2L); srcTask.triggerCheckpointAsync( new CheckpointMetaData(31L, 900), CheckpointOptions.forCheckpointWithDefaultLocation(), false) .get(); verifyCheckpointBarrier(srcTaskTestHarness.getOutput(), 31L); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 3L); srcTask.triggerCheckpointAsync( new CheckpointMetaData(syncSavepointId, 900), new CheckpointOptions(CheckpointType.SYNC_SAVEPOINT, CheckpointStorageLocationReference.getDefault()), withMaxWatermark) .get(); if (withMaxWatermark) { verifyWatermark(srcTaskTestHarness.getOutput(), Watermark.MAX_WATERMARK); } verifyCheckpointBarrier(srcTaskTestHarness.getOutput(), syncSavepointId); waitForSynchronousSavepointIdToBeSet(srcTask); assertTrue(srcTask.getSynchronousSavepointId().isPresent()); srcTask.notifyCheckpointCompleteAsync(syncSavepointId).get(); assertFalse(srcTask.getSynchronousSavepointId().isPresent()); executionThread.join(); }

Target:
private void stopWithSavepointStreamTaskTestHelper(final boolean withMaxWatermark) throws Exception { final long syncSavepointId = 34L; final StreamTaskTestHarness<Long> srcTaskTestHarness = getSourceStreamTaskTestHarness(); final Thread executionThread = srcTaskTestHarness.invoke(); final StreamTask<Long, ?> srcTask = srcTaskTestHarness.getTask(); ready.await(); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 1L); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 2L); srcTask.triggerCheckpointAsync( new CheckpointMetaData(31L, 900), CheckpointOptions.forCheckpointWithDefaultLocation(), false) .get(); verifyCheckpointBarrier(srcTaskTestHarness.getOutput(), 31L); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 3L); srcTask.triggerCheckpointAsync( new CheckpointMetaData(syncSavepointId, 900), new CheckpointOptions(CheckpointType.SYNC_SAVEPOINT, CheckpointStorageLocationReference.getDefault()), withMaxWatermark) .get(); if (withMaxWatermark) { verifyWatermark(srcTaskTestHarness.getOutput(), Watermark.MAX_WATERMARK); } verifyCheckpointBarrier(srcTaskTestHarness.getOutput(), syncSavepointId); waitForSynchronousSavepointIdToBeSet(srcTask); assertTrue(srcTask.getSynchronousSavepointId().isPresent()); srcTask.notifyCheckpointCompleteAsync(syncSavepointId).get(); assertFalse(srcTask.getSynchronousSavepointId().isPresent()); executionThread.join(); }
Source:
public void writeInfoRefs() throws IOException { final StringWriter w = new StringWriter(); final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; for (final Ref r : refs) { if (Constants.HEAD.equals(r.getName())) { continue; } ObjectId objectId = r.getObjectId(); if (objectId == null) { throw new TransportException(MessageFormat .format(JGitText.get().cannotRead, r.getName())); } objectId.copyTo(tmp, w); w.write('\t'); w.write(r.getName()); w.write('\n'); ObjectId peeledObjectId = r.getPeeledObjectId(); if (peeledObjectId != null) { peeledObjectId.copyTo(tmp, w); w.write('\t'); w.write(r.getName()); w.write("^{}\n"); } } writeFile(Constants.INFO_REFS, Constants.encode(w.toString())); }

Target:
public void writeInfoRefs() throws IOException { final StringWriter w = new StringWriter(); final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; for (final Ref r : refs) { if (Constants.HEAD.equals(r.getName())) { continue; } ObjectId objectId = r.getObjectId(); if (objectId == null) { continue; } objectId.copyTo(tmp, w); w.write('\t'); w.write(r.getName()); w.write('\n'); ObjectId peeledObjectId = r.getPeeledObjectId(); if (peeledObjectId != null) { peeledObjectId.copyTo(tmp, w); w.write('\t'); w.write(r.getName()); w.write("^{}\n"); } } writeFile(Constants.INFO_REFS, Constants.encode(w.toString())); }
Source:
public ProjectileSource getShooter() { if (this.shootingEntity instanceof ProjectileSource) { return (ProjectileSource) this.shootingEntity; } if (this.projectileSource != null) { return projectileSource; } return ProjectileSource.UNKNOWN; }

Target:
public ProjectileSource getShooter() { if (this.shootingEntity instanceof ProjectileSource) { return (ProjectileSource) this.shootingEntity; } if (this.projectileSource != null) { return this.projectileSource; } return ProjectileSource.UNKNOWN; }
Source:
public void repairInstances(String accountId, RepairInstancesRequest request) { Stack stack = stackService.getByEnvironmentCrnAndAccountIdWithLists(request.getEnvironmentCrn(), accountId); MDCBuilder.buildMdcContext(stack); Map<String, InstanceMetaData> allInstancesByInstanceId = getAllInstancesFromStack(stack); Map<String, InstanceMetaData> instancesToRepair = getInstancesToRepair(allInstancesByInstanceId, accountId, request); if (instancesToRepair.keySet().size() > 0) { Operation operation = operationService.startOperation(accountId, OperationType.DOWNSCALE, Set.of(stack.getEnvironmentCrn()), Collections.emptySet()); flowManager.notify(DOWNSCALE_EVENT.event(), new DownscaleEvent(DOWNSCALE_EVENT.event(), stack.getId(), instancesToRepair.keySet().stream().collect(Collectors.toList()), operation.getOperationId())); } else { throw new NotFoundException("No unhealthy instances to repair. Maybe use the force option."); } }

Target:
public OperationStatus repairInstances(String accountId, RepairInstancesRequest request) { Stack stack = stackService.getByEnvironmentCrnAndAccountIdWithLists(request.getEnvironmentCrn(), accountId); MDCBuilder.buildMdcContext(stack); if (request.isForceRepair() && CollectionUtils.isEmpty(request.getInstanceIds())) { throw new UnsupportedOperationException("Force repair requires the instance IDs to be provided."); } Map<String, InstanceStatus> healthMap = request.isForceRepair() ? Collections.emptyMap() : getInstanceHealthMap(accountId, request.getEnvironmentCrn()); Map<String, InstanceMetaData> allInstancesByInstanceId = getAllInstancesFromStack(stack); Map<String, InstanceMetaData> instancesToRepair = getInstancesToRepair(healthMap, allInstancesByInstanceId, request.getInstanceIds(), request.isForceRepair(), false); if (instancesToRepair.keySet().isEmpty()) { throw new NotFoundException("No unhealthy instances to repair. Maybe use the force option."); } Set<InstanceMetaData> remainingInstances = allInstancesByInstanceId.values().stream() .filter(instanceMetaData -> !instancesToRepair.containsKey(instanceMetaData.getInstanceId())) .filter(instanceMetaData -> { if (request.isForceRepair()) { return !INVALID_REPAIR_STATUSES.contains(instanceMetaData.getInstanceStatus()); } else { return healthMap.containsKey(instanceMetaData.getInstanceId()) && healthMap.get(instanceMetaData.getInstanceId()).isAvailable(); } }) .collect(Collectors.toSet()); if (remainingInstances.isEmpty()) { throw new BadRequestException("At least one instance must remain running during a repair."); } Operation operation = operationService.startOperation(accountId, OperationType.REPAIR, Set.of(stack.getEnvironmentCrn()), Collections.emptySet()); flowManager.notify(DOWNSCALE_EVENT.event(), new DownscaleEvent(DOWNSCALE_EVENT.event(), stack.getId(), instancesToRepair.keySet().stream().collect(Collectors.toList()), operation.getOperationId())); return operationToOperationStatusConverter.convert(operation); }
Source:
private HttpClientBuilder lookupHttpClientBuilder(final URL url) { Map<String, HttpClientBuilder> builderMap = this.httpClientBuildersByUri .entrySet().stream().filter(entry -> { String key = entry.getKey(); String spec = getUrlWithPlaceholders(url, key); if (spec.equals(key)) { return true; } int index = spec.lastIndexOf("/"); while (index != -1) { spec = spec.substring(0, index); if (spec.equals(key)) { return true; } index = spec.lastIndexOf("/"); } return false; }).collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); if (builderMap.isEmpty()) { this.log.warn(String.format("No custom http config found for URL: %s", url)); return HttpClients.custom(); } if (builderMap.size() > 1) { List<String> keys = builderMap.keySet().stream().filter( key -> !Pattern.compile(PLACEHOLDER_PATTERN).matcher(key).find()) .collect(Collectors.toList()); if (keys.size() == 1) { return builderMap.get(keys.get(0)); } this.log.error(String.format( "More than one git repo URL template matched URL:" + " %s, proxy and skipSslValidation config won't be applied. Matched templates: %s", url, builderMap.keySet().stream().collect(Collectors.joining(", ")))); return HttpClients.custom(); } return new ArrayList<>(builderMap.values()).get(0); }

Target:
private HttpClientBuilder lookupHttpClientBuilder(final URL url) { Map<String, HttpClientBuilder> builderMap = this.httpClientBuildersByUri .entrySet().stream().filter(entry -> { String key = entry.getKey(); String spec = getUrlWithPlaceholders(url, key); if (spec.equals(key)) { return true; } int index = spec.lastIndexOf("/"); while (index != -1) { spec = spec.substring(0, index); if (spec.equals(key)) { return true; } index = spec.lastIndexOf("/"); } return false; }).collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); if (builderMap.isEmpty()) { this.log.warn(String.format("No custom http config found for URL: %s", url)); return HttpClients.custom(); } if (builderMap.size() > 1) { List<String> keys = builderMap.keySet().stream() .filter(key -> !PLACEHOLDER_PATTERN.matcher(key).find()) .collect(Collectors.toList()); if (keys.size() == 1) { return builderMap.get(keys.get(0)); } this.log.error(String.format( "More than one git repo URL template matched URL:" + " %s, proxy and skipSslValidation config won't be applied. Matched templates: %s", url, builderMap.keySet().stream().collect(Collectors.joining(", ")))); return HttpClients.custom(); } return new ArrayList<>(builderMap.values()).get(0); }
Source:
public void progress() { if (!bPlayer.canBendIgnoreBindsCooldowns(this)) { remove(); return; } getFloor(); if (floorblock == null) { remove(); return; } Vector velocity = player.getEyeLocation().getDirection().clone().normalize(); velocity.setY(0); velocity = velocity.clone().normalize().multiply(speed); if (System.currentTimeMillis() > getStartTime() + interval) { if (player.getVelocity().length() < speed * 0.3) { remove(); return; } spinScooter(); } double distance = player.getLocation().getY() - (double) floorblock.getY(); double dx = Math.abs(distance - 2.4); if (distance > 2.75) { velocity.setY(-.25 * dx * dx); } else if (distance < 2) { velocity.setY(.25 * dx * dx); } Vector v = velocity.clone().setY(0); Block b = floorblock.getLocation().clone().add(v.multiply(1.2)).getBlock(); if (!GeneralMethods.isSolid(b) && !b.isLiquid()) { velocity.add(new Vector(0, -0.6, 0)); } else if (GeneralMethods.isSolid(b.getRelative(BlockFace.UP)) || b.getRelative(BlockFace.UP).isLiquid()) { velocity.add(new Vector(0, 0.6, 0)); } Location loc = player.getLocation(); if (!WaterAbility.isWater(player.getLocation().add(0, 2, 0).getBlock())) { loc.setY((double) floorblock.getY() + 1.5); } else { return; } player.removePotionEffect(PotionEffectType.SPEED); player.setVelocity(velocity); if (random.nextInt(4) == 0) { playAirbendingSound(player.getLocation()); } }

Target:
public void progress() { if (!bPlayer.canBendIgnoreBindsCooldowns(this)) { remove(); return; } getFloor(); if (floorblock == null) { remove(); return; } Vector velocity = player.getEyeLocation().getDirection().clone().normalize(); velocity.setY(0); velocity = velocity.clone().normalize().multiply(speed); if (System.currentTimeMillis() > getStartTime() + interval) { if (player.getVelocity().length() < speed * 0.3) { remove(); return; } spinScooter(); } double distance = player.getLocation().getY() - (double) floorblock.getY(); double dx = Math.abs(distance - 2.4); if (distance > 2.75) { velocity.setY(-.25 * dx * dx); } else if (distance < 2) { velocity.setY(.4 * dx * dx); } Vector v = velocity.clone().setY(0); Block b = floorblock.getLocation().clone().add(v.multiply(1.2)).getBlock(); if (!GeneralMethods.isSolid(b) && !b.isLiquid()) { velocity.add(new Vector(0, -0.6, 0)); } else if (GeneralMethods.isSolid(b.getRelative(BlockFace.UP)) || b.getRelative(BlockFace.UP).isLiquid()) { velocity.add(new Vector(0, 0.6, 0)); } Location loc = player.getLocation(); if (!WaterAbility.isWater(player.getLocation().add(0, 2, 0).getBlock())) { loc.setY((double) floorblock.getY() + 1.5); } else { return; } player.removePotionEffect(PotionEffectType.SPEED); player.setVelocity(velocity); if (random.nextInt(4) == 0) { playAirbendingSound(player.getLocation()); } }
Source:
public static MySqlExecutor createExecutor(Map<String, Object> jdbcProps) { Util.validateJDBCProperties(jdbcProps, Lists.newArrayList("dataSourceClassName", "dataSource.url")); String dataSourceClassName = (String) jdbcProps.get("dataSourceClassName"); log.info("data source class: [{}]", dataSourceClassName); String jdbcUrl = (String) jdbcProps.get("dataSource.url"); log.info("dataSource.url is: ", jdbcUrl); int queryTimeOutInSecs = -1; if(jdbcProps.containsKey("queryTimeoutInSecs")) { int timeout = (Integer) jdbcProps.get("queryTimeoutInSecs"); if(timeout < 0) { throw new IllegalArgumentException("queryTimeoutInSecs property can not be negative"); } } Properties properties = new Properties(); properties.putAll(jdbcProps); HikariConfig hikariConfig = new HikariConfig(properties); HikariCPConnectionBuilder connectionBuilder = new HikariCPConnectionBuilder(hikariConfig); ExecutionConfig executionConfig = new ExecutionConfig(queryTimeOutInSecs); return new MySqlExecutor(executionConfig, connectionBuilder); }

Target:
public static MySqlExecutor createExecutor(Map<String, Object> jdbcProps) { Util.validateJDBCProperties(jdbcProps, Lists.newArrayList("dataSourceClassName", "dataSource.url")); String dataSourceClassName = (String) jdbcProps.get("dataSourceClassName"); log.info("data source class: [{}]", dataSourceClassName); String jdbcUrl = (String) jdbcProps.get("dataSource.url"); log.info("dataSource.url is: ", jdbcUrl); int queryTimeOutInSecs = -1; if(jdbcProps.containsKey("queryTimeoutInSecs")) { queryTimeOutInSecs = (Integer) jdbcProps.get("queryTimeoutInSecs"); if(queryTimeOutInSecs < 0) { throw new IllegalArgumentException("queryTimeoutInSecs property can not be negative"); } } Properties properties = new Properties(); properties.putAll(jdbcProps); HikariConfig hikariConfig = new HikariConfig(properties); HikariCPConnectionBuilder connectionBuilder = new HikariCPConnectionBuilder(hikariConfig); ExecutionConfig executionConfig = new ExecutionConfig(queryTimeOutInSecs); return new MySqlExecutor(executionConfig, connectionBuilder); }
Source:
public String getReactorName() { return "SSL Reactor"; }

Target:
public String getReactorName() { return REACTOR_NAME; }
Source:
public void testRestartServerWhilePutting() throws Exception { RemoteCache<Integer, String> remote = client(0).getCache(); remote.put(1, "v1"); assertEquals("v1", remote.get(1)); PutHammer putHammer = new PutHammer(); Future<Void> putHammerFuture = fork(putHammer); HotRodServer toKillServer = servers.get(0); HotRodClientTestingUtil.killServers(toKillServer); servers.remove(toKillServer); EmbeddedCacheManager toKillCacheManager = cacheManagers.get(0); TestingUtil.killCacheManagers(toKillCacheManager); cacheManagers.remove(toKillCacheManager); TestingUtil.waitForRehashToComplete(cache(0)); EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(getCacheConfiguration()); registerCacheManager(cm); HotRodServer server = HotRodClientTestingUtil.startHotRodServer(cm); waitForClusterToForm(); TestingUtil.waitForRehashToComplete(cm.getCache(), cache(0)); putHammer.stop = true; putHammerFuture.get(); HotRodClientTestingUtil.killServers(server); TestingUtil.killCacheManagers(cm); }

Target:
public void testRestartServerWhilePutting() throws Exception { RemoteCache<Integer, String> remote = client(0).getCache(); remote.put(1, "v1"); assertEquals("v1", remote.get(1)); PutHammer putHammer = new PutHammer(); Future<Void> putHammerFuture = fork(putHammer); HotRodServer toKillServer = servers.get(0); HotRodClientTestingUtil.killServers(toKillServer); servers.remove(toKillServer); EmbeddedCacheManager toKillCacheManager = cacheManagers.get(0); TestingUtil.killCacheManagers(toKillCacheManager); cacheManagers.remove(toKillCacheManager); TestingUtil.waitForRehashToComplete(cache(0)); addHotRodServer(getCacheConfiguration()); putHammer.stop = true; putHammerFuture.get(); }
Source:
public Future<Long> write(ByteBuffer src, Callback<Long> callback) { return write(Unpooled.wrappedBuffer(src), new Callback<Long>() { @Override public void onCompletion(Long result, Exception exception) { if (exception == null) { src.position(src.limit()); } else { src.position(result.intValue()); } if (callback != null) { callback.onCompletion(result, exception); } } }); }

Target:
public Future<Long> write(ByteBuffer src, Callback<Long> callback) { FutureResult<Long> futureResult = new FutureResult<>(); write(Unpooled.wrappedBuffer(src), new Callback<Long>() { @Override public void onCompletion(Long result, Exception exception) { long r = result == null ? src.position() : result.longValue(); src.position((int) r); futureResult.done(r, exception); if (callback != null) { callback.onCompletion(result, exception); } } }); return futureResult; }
Source:
public OffHeapConfigValidator(Function<Element, OffheapResourcesType> resourcesTypeSupplier) { conversionMap.put(MemoryUnit.B, 1L); conversionMap.put(MemoryUnit.K_B, 1024L); conversionMap.put(MemoryUnit.MB, 1024L * 1024L); conversionMap.put(MemoryUnit.GB, 1024L * 1024L * 1024L); conversionMap.put(MemoryUnit.TB, 1024L * 1024L * 1024L * 1024L); conversionMap.put(MemoryUnit.PB, 1024L * 1024L * 1024L * 1024L * 1024L); this.resourcesTypeSupplier = resourcesTypeSupplier; }

Target:
public OffHeapConfigValidator(Function<Element, OffheapResourcesType> resourcesTypeSupplier) { this.resourcesTypeSupplier = resourcesTypeSupplier; }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; Type classType = classTree.symbol().type(); List<Tree> members = classTree.members(); checkStaticVariables(members, classType); checkStaticInitilizers(members, classType); }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; Type classType = classTree.symbol().type(); List<Tree> members = classTree.members(); checkStaticVariables(members, classType); checkStaticInitializers(members, classType); }
Source:
void add(IOException e) { if (allCacheNotFoundException) { allCacheNotFoundException = e instanceof CacheNotFoundException; } super.addSuppressed(e); }

Target:
void add(IOException e) { allCacheNotFoundException &= e instanceof CacheNotFoundException; super.addSuppressed(e); }
Source:
public void workerMeta() throws IOException, InterruptedException { final Queue queue = this.client.getQueues().get(SerialWorkerTest.DEFAULT_QUEUE_NAME); final String jid = queue.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( Arrays.asList(new String[] {SerialWorkerTest.DEFAULT_QUEUE_NAME}), this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = new Thread() { @Override public void run() { try { Thread.sleep(2000); worker.shutDown(); } catch (final InterruptedException v) { System.out.println(v); } } }; signal.start(); worker.run(); assertThat(worker.getCurrentJid(), equalTo(jid)); assertThat(worker.getWorkerName(), equalTo(this.client.workerName())); }

Target:
public void workerMeta() throws IOException, InterruptedException { final Queue queue = this.client.getQueue(SerialWorkerTest.DEFAULT_QUEUE_NAME); final String jid = queue.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( Arrays.asList(SerialWorkerTest.DEFAULT_QUEUE_NAME), this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = this.getWorkerThread(worker, 2); signal.start(); worker.run(); assertThat(worker.getCurrentJid(), equalTo(jid)); assertThat(worker.getWorkerName(), equalTo(this.client.workerName())); }
Source:
public void loadVideoThumbnail(final String url, final Html.VideoThumbnailGetter.Callbacks callbacks, final int maxWidth, final int minWidth) { if (TextUtils.isEmpty(url) || maxWidth <= 0) { callbacks.onThumbnailFailed(); return; } callbacks.onThumbnailLoading(loadingInProgress); new AsyncTask<Void, Void, Bitmap>() { protected Bitmap doInBackground(Void... params) { if (new File(url).exists()) { return ThumbnailUtils.createVideoThumbnail(url, MediaStore.Images.Thumbnails.FULL_SCREEN_KIND); } return ImageUtils.getVideoFrameFromVideo(url, maxWidth); } protected void onPostExecute(Bitmap thumb) { if (thumb == null) { callbacks.onThumbnailFailed(); return; } thumb = ImageUtils.getScaledBitmapAtLongestSide(thumb, maxWidth); if (thumb == null) { callbacks.onThumbnailFailed(); return; } thumb.setDensity(DisplayMetrics.DENSITY_DEFAULT); BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), thumb); callbacks.onThumbnailLoaded(bitmapDrawable); } }.execute(); }

Target:
public void loadVideoThumbnail(final String url, final Html.VideoThumbnailGetter.Callbacks callbacks, final int maxWidth, final int minWidth) { if (TextUtils.isEmpty(url) || maxWidth <= 0) { callbacks.onThumbnailFailed(); return; } callbacks.onThumbnailLoading(loadingInProgress); new AsyncTask<Void, Void, Bitmap>() { protected Bitmap doInBackground(Void... params) { if (new File(url).exists()) { return ThumbnailUtils.createVideoThumbnail(url, MediaStore.Images.Thumbnails.FULL_SCREEN_KIND); } return ImageUtils.getVideoFrameFromVideo(url, maxWidth); } protected void onPostExecute(Bitmap thumb) { if (thumb == null) { callbacks.onThumbnailFailed(); return; } thumb = ImageUtils.getScaledBitmapAtLongestSide(thumb, maxWidth); thumb.setDensity(DisplayMetrics.DENSITY_DEFAULT); BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), thumb); callbacks.onThumbnailLoaded(bitmapDrawable); } }.execute(); }
Source:
public List<SchemaIncompatibility> checkConstraints(final Schema schema) { final List<SchemaIncompatibility> incompatibilities = new ArrayList<SchemaIncompatibility>(); recursiveCheckConstraints(schema, new Stack<String>(), incompatibilities); return incompatibilities; }

Target:
public List<SchemaIncompatibility> checkConstraints(final Schema schema) { final List<SchemaIncompatibility> incompatibilities = new ArrayList<>(); recursiveCheckConstraints(schema, new Stack<>(), incompatibilities); return incompatibilities; }
Source:
public boolean handlesEntityType(String typeName) { return true; }

Target:
public boolean handlesEntityType(String typeName) { return "org.ehcache.clustered.client.EhcacheClientEntity".equals(typeName); }
Source:
public Set<T> toTypes(final Long registerValue) { final Set<T> Types = new HashSet<>(); final BitSet bitSet = BitSet.valueOf(new long[] { registerValue }); for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet.nextSetBit(i + 1)) { Types.add(this.typePerRegisterBitIndex.get(i)); } return Types; }

Target:
public Set<T> toTypes(final Long registerValue) { final Set<T> types = new HashSet<>(); final BitSet bitSet = BitSet.valueOf(new long[] { registerValue }); for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet.nextSetBit(i + 1)) { types.add(this.typePerRegisterBitIndex.get(i)); } return types; }
Source:
private void sendMergeFail(final Change c, final ChangeMessage msg, final boolean makeNew) { try { db.changeMessages().insert(Collections.singleton(msg)); } catch (OrmException err) { log.warn("Cannot record merge failure message", err); } if (makeNew) { try { db.changes().atomicUpdate(c.getId(), new AtomicUpdate<Change>() { @Override public Change update(Change c) { if (c.getStatus().isOpen()) { c.setStatus(Change.Status.NEW); ChangeUtil.updated(c); } return c; } }); } catch (OrmConcurrencyException err) { } catch (OrmException err) { log.warn("Cannot update change status", err); } } else { try { ChangeUtil.touch(c, db); } catch (OrmException err) { log.warn("Cannot update change timestamp", err); } } try { final PatchSet patchSet = db.patchSets().get(c.currentPatchSetId()); workQueue.getDefaultQueue() .submit(requestScopePropagator.wrap(new Runnable() { @Override public void run() { try { final MergeFailSender cm = mergeFailSenderFactory.create(c); final PatchSetApproval submitter = getSubmitter(c.currentPatchSetId()); if (submitter != null) { cm.setFrom(submitter.getAccountId()); } cm.setPatchSet(patchSet); cm.setChangeMessage(msg); cm.send(); } catch (EmailException e) { log.error("Cannot send email notifications about merge failure", e); } } @Override public String toString() { return "send email for merge failure"; } })); } catch (OrmException e) { log.error("Cannot send email notifications about merge failure", e); } }

Target:
private void sendMergeFail(final Change c, final ChangeMessage msg, final boolean makeNew) { try { db.changeMessages().insert(Collections.singleton(msg)); } catch (OrmException err) { log.warn("Cannot record merge failure message", err); } if (makeNew) { try { db.changes().atomicUpdate(c.getId(), new AtomicUpdate<Change>() { @Override public Change update(Change c) { if (c.getStatus().isOpen()) { c.setStatus(Change.Status.NEW); ChangeUtil.updated(c); } return c; } }); } catch (OrmConcurrencyException err) { } catch (OrmException err) { log.warn("Cannot update change status", err); } } else { try { ChangeUtil.touch(c, db); } catch (OrmException err) { log.warn("Cannot update change timestamp", err); } } workQueue.getDefaultQueue() .submit(requestScopePropagator.wrap(new Runnable() { @Override public void run() { PatchSet patchSet; PatchSetApproval submitter; try { ReviewDb reviewDb = schemaFactory.open(); try { patchSet = reviewDb.patchSets().get(c.currentPatchSetId()); submitter = getSubmitter(reviewDb, c.currentPatchSetId()); } finally { reviewDb.close(); } } catch (OrmException e) { log.error("Cannot send email notifications about merge failure", e); return; } try { final MergeFailSender cm = mergeFailSenderFactory.create(c); if (submitter != null) { cm.setFrom(submitter.getAccountId()); } cm.setPatchSet(patchSet); cm.setChangeMessage(msg); cm.send(); } catch (EmailException e) { log.error("Cannot send email notifications about merge failure", e); } } @Override public String toString() { return "send-email merge-failed"; } })); }
Source:
private Node createIdentifierGraphic(Map<Field, String> values) { if (values.size() > 1) { return cellFactory.getTableIcon(StandardField.URLS); } else if (values.size() == 1) { return cellFactory.getTableIcon(StandardField.URL); } else { return null; } }

Target:
private Node createIdentifierGraphic(Map<Field, String> values) { if (values.size() > 1) { return IconTheme.JabRefIcons.LINK_VARIANT.getGraphicNode(); } else if (values.size() == 1) { return IconTheme.JabRefIcons.LINK.getGraphicNode(); } else { return null; } }
Source:
public void removeOperators(ID roamingGroupID, List<ID> ids) { for (ID id : ids) { datastore.update(RoamingGroupEntity.class, Filter.where("_id").is(roamingGroupID.value), UpdateStatement.removeFrom("operatorIDs").remove(id.value)); } }

Target:
public void removeOperators(ID roamingGroupID, List<ID> ids) { RoamingGroupEntity entity = datastore.findById(RoamingGroupEntity.class, roamingGroupID.value); if (entity == null) { throw new NotFoundException("Roaming group is unknown!"); } List<Object> unnecessaryIDs = Lists.newArrayList(); for (ID id : ids) { unnecessaryIDs.add(id.value); } entity.operatorIDs.removeAll(unnecessaryIDs); datastore.update(RoamingGroupEntity.class, Filter.where("_id").is(roamingGroupID.value), UpdateStatement.update("operatorIDs").toBe(entity.operatorIDs)); }
Source:
private static String getActiveConnectorsString() { final IConnector[] activeConnectors = ConnectorFactory.getActiveConnectors(); final StringBuilder activeConnectorsBuilder = new StringBuilder(); for (final IConnector conn : activeConnectors) { try { activeConnectorsBuilder.append(conn.getNameAbbreviated()); activeConnectorsBuilder.append(','); } catch (IllegalStateException ignored) { } } if (activeConnectorsBuilder.length() > 0) { activeConnectorsBuilder.deleteCharAt(activeConnectorsBuilder.length() - 1); } return activeConnectorsBuilder.toString(); }

Target:
private static String getActiveConnectorsString() { final List<IConnector> activeConnectors = ConnectorFactory.getActiveConnectors(); final List<String> activeConnectorsList = new ArrayList<>(); for (final IConnector conn : activeConnectors) { try { activeConnectorsList.add(conn.getNameAbbreviated()); } catch (IllegalStateException ignored) { } } return TextUtils.join(",", activeConnectorsList); }
Source:
private void checkUpdateReportsPanel(final String url, final Map<String, List<String>> params) { try { ReportInit.constructRequestBuilder(buildStatusUrl()).sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { reportsWebappDeployed = true; getView().updateReportsPanel(url, params); } else { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } } }); } catch (RequestException e) { errorPopupManager.show(applicationConstants.reportsWebAppErrorMsg()); } }

Target:
private void checkUpdateReportsPanel(final String url, final Map<String, List<String>> params) { try { ReportInit.constructServiceRequestBuilder(ReportInit.ReportStatusService).sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { reportsWebappDeployed = true; getView().updateReportsPanel(url, params); } else { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } } }); } catch (RequestException e) { errorPopupManager.show(applicationConstants.reportsWebAppErrorMsg()); } }
Source:
public void testSpinnerUpdatesRename() { String renamedTag = "tag_renamed"; List<String> spinnerValuesContained = Arrays.asList( getResourcesString(R.string.brick_when_nfc_default_all), getResourcesString(R.string.new_nfc_tag), getResourcesString(R.string.test_tag_name_1), getResourcesString(R.string.test_tag_name_2)); List<String> spinnerValuesNotContained = Arrays.asList(); checkNfcSpinnerContains(nfcBrickPosition, spinnerValuesContained, spinnerValuesNotContained); UiHardwareTestUtils.gotoNfcFragment(nfcBrickPosition); contextMenuActionRename(getResourcesString(R.string.test_tag_name_1), renamedTag); pressBack(); spinnerValuesContained = Arrays.asList( getResourcesString(R.string.brick_when_nfc_default_all), getResourcesString(R.string.new_nfc_tag), getResourcesString(R.string.test_tag_name_2), renamedTag); spinnerValuesNotContained = Arrays.asList( getResourcesString(R.string.test_tag_name_1)); checkNfcSpinnerContains(nfcBrickPosition, spinnerValuesContained, spinnerValuesNotContained); }

Target:
public void testSpinnerUpdatesRename() { String renamedTag = "tag_renamed"; List<String> spinnerValuesContained = getStringsFromResourceIds( R.string.brick_when_nfc_default_all, R.string.new_nfc_tag, R.string.test_tag_name_1, R.string.test_tag_name_2); List<String> spinnerValuesNotContained = Arrays.asList(); checkNfcSpinnerContains(nfcBrickPosition, spinnerValuesContained, spinnerValuesNotContained); UiNFCTestUtils.gotoNfcFragment(nfcBrickPosition); contextMenuActionRename(UiTestUtils.getResourcesString(R.string.test_tag_name_1), renamedTag); pressBack(); spinnerValuesContained = getStringsFromResourceIds( R.string.brick_when_nfc_default_all, R.string.new_nfc_tag, R.string.test_tag_name_2); spinnerValuesContained.add(renamedTag); spinnerValuesNotContained = getStringsFromResourceIds(R.string.test_tag_name_1); checkNfcSpinnerContains(nfcBrickPosition, spinnerValuesContained, spinnerValuesNotContained); }