auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCompleteUpdateHandlesFinalizedChunkIfReady() throws Exception { final Chunk chunk = mockChunkAt(0, 0, 0); final ReadyChunkInfo readyChunkInfo = ReadyChunkInfo.createForNewChunk(chunk, new TShortObjectHashMap<>(), Collections.emptyList()); when(chunkFinalizer.completeFinalization()).thenReturn(readyChunkInfo); chunkProvider.completeUpdate(); final InOrder inOrder = inOrder(worldEntity); inOrder.verify(worldEntity).send(any(OnChunkGenerated.class)); inOrder.verify(worldEntity).send(any(OnChunkLoaded.class)); }

Target:
public void testCompleteUpdateHandlesFinalizedChunkIfReady() throws Exception { final Chunk chunk = mockChunkAt(0, 0, 0); final ReadyChunkInfo readyChunkInfo = ReadyChunkInfo.createForNewChunk(chunk, new TShortObjectHashMap<>(), Collections.emptyList()); when(chunkFinalizer.completeFinalization()).thenReturn(readyChunkInfo); chunkProvider.completeUpdate(); final InOrder inOrderVerification = inOrder(worldEntity); inOrderVerification.verify(worldEntity).send(any(OnChunkGenerated.class)); inOrderVerification.verify(worldEntity).send(any(OnChunkLoaded.class)); }
Source:
public void execute(HueFacade hueFacade, String... lightIdentifiers) { for (String id : lightIdentifiers) { HueLightState lightState = new HueLightState(); lightState.setEffectMode(HueLightState.EffectMode.NONE); lightState.setAlertMode(HueLightState.AlertMode.NONE); lightState.setTransitionTime(400); try { hueFacade.updateLightState(id, lightState); } catch (BridgeUnavailableException e) { throw new StateNotLoadedException(e.getMessage()); } } }

Target:
public void execute(HueFacade hueFacade, String... lightIdentifiers) { for (String id : lightIdentifiers) { HueLightState lightState = new HueLightState(); lightState.setEffectMode(HueLightState.EffectMode.NONE); lightState.setAlertMode(HueLightState.AlertMode.NONE); lightState.setTransitionTime(400); try { hueFacade.updateLightState(id, lightState); } catch (BridgeUnavailableException e) { throw new StateNotLoadedException(e); } } }
Source:
public EntityRef create(String prefabName, Vector3f position) { if (prefabName != null && !prefabName.isEmpty()) { Prefab prefab = entityManager.getPrefabManager().getPrefab(prefabName); return create(prefab, position); } return create(); }

Target:
public EntityRef create(String prefabName, Vector3f position) { return create(prefabName, position, null); }
Source:
public int visit(IASTDeclaration declaration) { ICPPMethod method = getOperatorEq(declaration); if (method != null) { IASTDeclarator declMethod = ((ICPPASTFunctionDefinition) declaration).getDeclarator(); if (!(declMethod instanceof ICPPASTFunctionDeclarator)) return PROCESS_SKIP; IASTPointerOperator[] pointers = declMethod.getPointerOperators(); parameters = ((ICPPASTFunctionDeclarator) declMethod).getParameters(); if (pointers.length != 1 || !(pointers[0] instanceof ICPPASTReferenceOperator)) reportProblem(MISS_REF_ID, declaration); if (!SemanticQueries.isCopyOrMoveAssignmentOperator(method)) return PROCESS_SKIP; decl = declaration; return PROCESS_CONTINUE; } else return PROCESS_SKIP; }

Target:
public int visit(IASTDeclaration declaration) { ICPPMethod method = getOperatorEq(declaration); if (method != null) { OperatorEqInfo info = opInfo.push(new OperatorEqInfo()); IASTDeclarator declMethod = ((ICPPASTFunctionDefinition) declaration).getDeclarator(); if (!(declMethod instanceof ICPPASTFunctionDeclarator)) return PROCESS_CONTINUE; if (((ICPPASTFunctionDefinition) declaration).isDefaulted() || ((ICPPASTFunctionDefinition) declaration).isDeleted()) return PROCESS_CONTINUE; IASTPointerOperator[] pointers = declMethod.getPointerOperators(); info.parameters = ((ICPPASTFunctionDeclarator) declMethod).getParameters(); if (pointers.length != 1 || !(pointers[0] instanceof ICPPASTReferenceOperator)) reportProblem(MISS_REF_ID, declaration); if (!SemanticQueries.isCopyOrMoveAssignmentOperator(method)) return PROCESS_CONTINUE; info.decl = declMethod; } return PROCESS_CONTINUE; }
Source:
public static void listInfoTypes() throws IOException { String filter = "supported_by=INSPECT"; String languageCode= "en-US"; listInfoTypes(filter, languageCode); }

Target:
public static void listInfoTypes() throws IOException { try (DlpServiceClient dlpClient = DlpServiceClient.create()) { ListInfoTypesRequest listInfoTypesRequest = ListInfoTypesRequest.newBuilder() .setFilter("supported_by=INSPECT") .setLanguageCode("en-US").build(); ListInfoTypesResponse response = dlpClient.listInfoTypes(listInfoTypesRequest); System.out.println("Infotypes found:"); for (InfoTypeDescription infoTypeDescription : response.getInfoTypesList()) { System.out.println("Name : " + infoTypeDescription.getName()); System.out.println("Display name : " + infoTypeDescription.getDisplayName()); } } }
Source:
public ResponseEntity<ApiListResp> utilsAllActionableVariantsGet() { ApiListResp apiListResp = new ApiListResp(); Meta meta = MetaUtils.getOKMeta(); HttpStatus status = HttpStatus.OK; Set<Gene> genes = GeneUtils.getAllGenes(); Map<Gene, Set<ClinicalVariant>> map = new HashMap<>(); for (Gene gene : genes) { map.put(gene, MainUtils.getClinicalVariants(gene)); } Set<ActionableGene> actionableGenes = new HashSet<>(); for (Map.Entry<Gene, Set<ClinicalVariant>> entry : map.entrySet()) { Gene gene = entry.getKey(); for (ClinicalVariant clinicalVariant : entry.getValue()) { actionableGenes.add(new ActionableGene( gene.getHugoSymbol(), clinicalVariant.getVariant().getName(), getCancerType(clinicalVariant.getOncoTreeType()), clinicalVariant.getLevel(), MainUtils.listToString(new ArrayList<>(clinicalVariant.getDrug()), ", "), MainUtils.listToString(new ArrayList<>(clinicalVariant.getDrugPmids()), ", "))); Set<ArticleAbstract> articleAbstracts = clinicalVariant.getDrugAbstracts(); List<String> abstracts = new ArrayList<>(); for (ArticleAbstract articleAbstract : articleAbstracts) { abstracts.add(articleAbstract.getAbstractContent()); } MainUtils.listToString(abstracts, "; "); } } apiListResp.setData(new ArrayList(actionableGenes)); apiListResp.setMeta(meta); return new ResponseEntity<>(apiListResp, status); }

Target:
public ResponseEntity<ApiListResp> utilsAllActionableVariantsGet() { ApiListResp apiListResp = new ApiListResp(); Meta meta = MetaUtils.getOKMeta(); HttpStatus status = HttpStatus.OK; Set<Gene> genes = GeneUtils.getAllGenes(); Map<Gene, Set<ClinicalVariant>> map = new HashMap<>(); for (Gene gene : genes) { map.put(gene, MainUtils.getClinicalVariants(gene)); } Set<ActionableGene> actionableGenes = new HashSet<>(); for (Map.Entry<Gene, Set<ClinicalVariant>> entry : map.entrySet()) { Gene gene = entry.getKey(); for (ClinicalVariant clinicalVariant : entry.getValue()) { Set<ArticleAbstract> articleAbstracts = clinicalVariant.getDrugAbstracts(); List<String> abstracts = new ArrayList<>(); for (ArticleAbstract articleAbstract : articleAbstracts) { abstracts.add(articleAbstract.getAbstractContent()); } actionableGenes.add(new ActionableGene( gene.getHugoSymbol(), clinicalVariant.getVariant().getName(), getCancerType(clinicalVariant.getOncoTreeType()), clinicalVariant.getLevel(), MainUtils.listToString(new ArrayList<>(clinicalVariant.getDrug()), ", "), MainUtils.listToString(new ArrayList<>(clinicalVariant.getDrugPmids()), ", "), MainUtils.listToString(abstracts, "; "))); } } apiListResp.setData(new ArrayList(actionableGenes)); apiListResp.setMeta(meta); return new ResponseEntity<>(apiListResp, status); }
Source:
public String getColumnText(Object element, int columnIndex) { TaskReview reviewContainer = (TaskReview) element; switch (columnIndex) { case 0: return reviewContainer.getSummary(); case 3: return reviewContainer.getIncomingChanges(); default: return ""; } }

Target:
public String getColumnText(Object element, int columnIndex) { TaskReview reviewContainer = (TaskReview) element; switch (columnIndex) { case DESCRIPTION_COLUMN: return reviewContainer.getSummary(); case INCOMING_CHANGES_COLUMN: return reviewContainer.getIncomingChanges(); default: return ""; } }
Source:
public Promise<List<Change>> format(final int offset, final int length, final String content) { return newPromise(new AsyncPromiseHelper.RequestCall<List<Change>>() { @Override public void makeCall(AsyncCallback<List<Change>> callback) { String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/java/code-formatting/format?offset=" + offset + "&length=" + length; asyncRequestFactory.createPostRequest(url, null) .header(CONTENT_TYPE, MimeType.TEXT_PLAIN) .data(content) .send(newCallback(callback, unmarshallerFactory.newListUnmarshaller(Change.class))); } }).then(new Function<List<Change>, List<Change>>() { @Override public List<Change> apply(List<Change> arg) throws FunctionException { final List<Change> changes = new ArrayList<>(); for (Change change : arg) { changes.add(change); } return changes; } }); }

Target:
public Promise<List<Change>> format(final int offset, final int length, final String content) { return newPromise(new AsyncPromiseHelper.RequestCall<List<Change>>() { @Override public void makeCall(AsyncCallback<List<Change>> callback) { String url = appContext.getDevMachine().getWsAgentBaseUrl() + CODE_ASSIST_URL_PREFIX + "/format?offset=" + offset + "&length=" + length; asyncRequestFactory.createPostRequest(url, null) .header(CONTENT_TYPE, MimeType.TEXT_PLAIN) .data(content) .send(newCallback(callback, unmarshallerFactory.newListUnmarshaller(Change.class))); } }).then(new Function<List<Change>, List<Change>>() { @Override public List<Change> apply(List<Change> arg) throws FunctionException { final List<Change> changes = new ArrayList<>(); for (Change change : arg) { changes.add(change); } return changes; } }); }
Source:
public void onChangeVelocity(ChangeVelocityEvent event, EntityRef entity) { if (event.getAngularVelocity().length() > 0) { physics.getRigidBody(entity).setAngularVelocity(event.getAngularVelocity()); } if (event.getLinearVelocity().length() > 0) { physics.getRigidBody(entity).setLinearVelocity(event.getLinearVelocity()); } }

Target:
public void onChangeVelocity(ChangeVelocityEvent event, EntityRef entity) { if (event.getAngularVelocity() != null) { physics.getRigidBody(entity).setAngularVelocity(event.getAngularVelocity()); } if (event.getLinearVelocity() != null) { physics.getRigidBody(entity).setLinearVelocity(event.getLinearVelocity()); } }
Source:
public void run() { long backlog = 0; MetricInfo metricInfo = null; synchronized (metrics) { long currentTime = System.currentTimeMillis(); Iterator iter = metrics.iterator(); while (iter.hasNext()) { try { metricInfo = (MetricInfo) iter.next(); long time = DATE_FORMAT.get().parse(metricInfo.getNominalTime()).getTime(); backlog += (currentTime - time); } catch (ParseException e) { LOG.error("Unable to parse nominal time" + metricInfo.getNominalTime()); } } } org.apache.falcon.entity.v0.process.Process process = (Process) entityObj; String metricName = METRIC_PREFIX + METRIC_SEPARATOR + metricInfo.getCluster() + METRIC_SEPARATOR + process.getPipelines() + METRIC_SEPARATOR + LifeCycle.EXECUTION.name() + METRIC_SEPARATOR + entityObj.getName() + METRIC_SEPARATOR + "backlogInMins"; backlog = backlog / (60 * 1000); metricNotificationService.publish(metricName, backlog); }

Target:
public void run() { MetricInfo metricInfo = null; HashMap<String, Long> backLogsCluster = new HashMap<>(); synchronized (metrics) { long currentTime = System.currentTimeMillis(); Iterator iter = metrics.iterator(); while (iter.hasNext()) { try { metricInfo = (MetricInfo) iter.next(); long time = DATE_FORMAT.get().parse(metricInfo.getNominalTime()).getTime(); long backlog = backLogsCluster.containsKey(metricInfo.getCluster()) ? backLogsCluster.get(metricInfo.getCluster()) : 0; backlog += (currentTime - time); backLogsCluster.put(metricInfo.getCluster(), backlog); } catch (ParseException e) { LOG.error("Unable to parse nominal time" + metricInfo.getNominalTime()); } } } org.apache.falcon.entity.v0.process.Process process = (Process) entityObj; if (backLogsCluster != null && !backLogsCluster.isEmpty()) { for (Map.Entry<String, Long> entry : backLogsCluster.entrySet()) { String clusterName = entry.getKey(); String pipelinesStr = process.getPipelines(); String metricName; Long backlog = entry.getValue() / (60 * 1000L); if (pipelinesStr != null && !pipelinesStr.isEmpty()) { String[] pipelines = pipelinesStr.split(","); for (String pipeline : pipelines) { metricName = METRIC_PREFIX + METRIC_SEPARATOR + clusterName + METRIC_SEPARATOR + pipeline + METRIC_SEPARATOR + LifeCycle.EXECUTION.name() + METRIC_SEPARATOR + entityObj.getName() + METRIC_SEPARATOR + "backlogInMins"; metricNotificationService.publish(metricName, backlog); } } else { metricName = METRIC_PREFIX + METRIC_SEPARATOR + clusterName + METRIC_SEPARATOR + DEFAULT_PIPELINE + METRIC_SEPARATOR + LifeCycle.EXECUTION.name() + METRIC_SEPARATOR + entityObj.getName() + METRIC_SEPARATOR + "backlogInMins"; metricNotificationService.publish(metricName, backlog); } } } }
Source:
private void setSequenceNumbersOnNewAccountDetails(SubAccountGlobal subAccountGlobal, int newItemsStartIndex) { List<SubAccountGlobalNewAccountDetail> newAccountDetails = subAccountGlobal.getSubAccountGlobalNewAccountDetails(); if (newItemsStartIndex >= newAccountDetails.size()) { return; } long nextSequenceNumber = subAccountGlobal.getNextNewAccountDetailSequenceNumber().longValue(); for (int i = newItemsStartIndex; i < newAccountDetails.size(); i++) { SubAccountGlobalNewAccountDetail newAccountDetail = newAccountDetails.get(i); newAccountDetail.setSequenceNumber(Long.valueOf(nextSequenceNumber)); nextSequenceNumber++; } subAccountGlobal.setNextNewAccountDetailSequenceNumber(Long.valueOf(nextSequenceNumber)); }

Target:
private void setSequenceNumbersOnNewAccountDetails(SubAccountGlobal subAccountGlobal, int newItemsStartIndex) { List<SubAccountGlobalNewAccountDetail> newAccountDetails = subAccountGlobal.getSubAccountGlobalNewAccountDetails(); if (newItemsStartIndex >= newAccountDetails.size()) { return; } for (int i = newItemsStartIndex; i < newAccountDetails.size(); i++) { SubAccountGlobalNewAccountDetail newAccountDetail = newAccountDetails.get(i); newAccountDetail.setSequenceNumber(subAccountGlobal.getAndIncrementNextNewAccountDetailSequenceNumber()); } }
Source:
public boolean containContext(String jarName, List ctxs) { if (ctxs == null || ctxs.isEmpty()) { return false; } for (Object ct : ctxs) { if (ContextParameterUtils.isContextParamOfContextType((ContextType) ct, jarName)) { return true; } } return false; }

Target:
public boolean containContext(String jarName, List ctxs) { if (ctxs == null) { return ContextParameterUtils.isContainContextParam(jarName); } for (Object ct : ctxs) { if (ContextParameterUtils.isContextParamOfContextType((ContextType) ct, jarName)) { return true; } } return false; }
Source:
public List<ITmfStateInterval> queryHistoryRange(int attributeQuark, long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException, AttributeNotFoundException, StateSystemDisposedException { if (isDisposed) { throw new StateSystemDisposedException(); } List<ITmfStateInterval> intervals; ITmfStateInterval currentInterval; long ts, tEnd; IProgressMonitor mon = monitor; if (mon == null) { mon = new NullProgressMonitor(); } if (t2 < t1 || resolution <= 0) { throw new TimeRangeException(); } if (t2 > this.getCurrentEndTime()) { tEnd = this.getCurrentEndTime(); } else { tEnd = t2; } intervals = new ArrayList<>(); for (ts = t1; ts < tEnd; ts += ((currentInterval.getEndTime() - ts) / resolution + 1) * resolution) { if (mon.isCanceled()) { return intervals; } currentInterval = querySingleState(ts, attributeQuark); intervals.add(currentInterval); } return intervals; }

Target:
public List<ITmfStateInterval> queryHistoryRange(int attributeQuark, long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException, AttributeNotFoundException, StateSystemDisposedException { if (isDisposed) { throw new StateSystemDisposedException(); } List<ITmfStateInterval> intervals; ITmfStateInterval currentInterval; long ts, tEnd; IProgressMonitor mon = monitor; if (mon == null) { mon = new NullProgressMonitor(); } if (t2 < t1 || resolution <= 0) { throw new TimeRangeException(); } if (t2 > this.getCurrentEndTime()) { tEnd = this.getCurrentEndTime(); } else { tEnd = t2; } intervals = new ArrayList<>(); currentInterval = querySingleState(t1, attributeQuark); intervals.add(currentInterval); for (ts = t1; ts < tEnd; ts += ((currentInterval.getEndTime() - ts) / resolution + 1) * resolution) { if (mon.isCanceled()) { return intervals; } currentInterval = querySingleState(ts, attributeQuark); intervals.add(currentInterval); } if (currentInterval.getEndTime() < tEnd) { currentInterval = querySingleState(tEnd, attributeQuark); intervals.add(currentInterval); } return intervals; }
Source:
private void openBackgroundPlayer(final boolean append) { AudioStream audioStream = getDefaultAudioStream(); boolean useExternalAudioPlayer = PreferenceManager.getDefaultSharedPreferences(activity) .getBoolean(activity.getString(R.string.use_external_audio_player_key), false); if (!useExternalAudioPlayer && android.os.Build.VERSION.SDK_INT >= 16) { openNormalBackgroundPlayer(append); } else { startOnExternalPlayer(activity, currentInfo, audioStream); } }

Target:
private void openBackgroundPlayer(final boolean append) { final AudioStream audioStream = getDefaultAudioStream(); final boolean useExternalAudioPlayer = PreferenceManager .getDefaultSharedPreferences(activity) .getBoolean(activity.getString(R.string.use_external_audio_player_key), false); if (!useExternalAudioPlayer && android.os.Build.VERSION.SDK_INT >= 16) { openNormalBackgroundPlayer(append); } else { startOnExternalPlayer(activity, currentInfo, audioStream); } }
Source:
private Optional<IASTNode> getNodiscardFunction(IASTExpression expr) { if (expr instanceof IASTFunctionCallExpression) { IASTFunctionCallExpression func = (IASTFunctionCallExpression) expr; IASTExpression functionNameExpression = func.getFunctionNameExpression(); IASTName name; if (functionNameExpression instanceof IASTIdExpression) { name = ((IASTIdExpression) functionNameExpression).getName(); } else if (functionNameExpression instanceof IASTFieldReference) { name = ((IASTFieldReference) functionNameExpression).getFieldName(); } else { return Optional.empty(); } IBinding binding = name.resolveBinding(); if (binding instanceof ICPPFunction && (((IFunction) binding).isNoDiscard() || checkEvaluation((ICPPASTExpression) expr))) { return Optional.of(name); } else if (binding instanceof IFunction && ((IFunction) binding).isNoDiscard()) { return Optional.of(name); } else if ((binding instanceof ICPPClassType || binding instanceof ICPPVariable) && expr instanceof ICPPASTExpression && checkEvaluation((ICPPASTExpression) expr)) { return Optional.of(name); } return Optional.empty(); } else if (expr instanceof ICPPASTCastExpression) { ICPPASTCastExpression cast = (ICPPASTCastExpression) expr; if (cast.getOperator() != ICPPASTCastExpression.op_static_cast) { return Optional.empty(); } if (checkEvaluation(cast)) { return Optional.of(cast.getTypeId()); } return Optional.empty(); } else return Optional.empty(); }

Target:
private Optional<IASTNode> getNodiscardFunction(IASTExpression expr) { if (expr instanceof IASTFunctionCallExpression) { IASTFunctionCallExpression func = (IASTFunctionCallExpression) expr; IASTExpression functionNameExpression = func.getFunctionNameExpression(); IASTName name; if (functionNameExpression instanceof IASTIdExpression) { name = ((IASTIdExpression) functionNameExpression).getName(); } else if (functionNameExpression instanceof IASTFieldReference) { name = ((IASTFieldReference) functionNameExpression).getFieldName(); } else { return Optional.empty(); } if (expr instanceof ICPPASTExpression) { if (checkEvaluation((ICPPASTExpression) expr)) { return Optional.of(name); } return Optional.empty(); } IBinding binding = name.resolveBinding(); if (binding instanceof IFunction && ((IFunction) binding).isNoDiscard()) { return Optional.of(name); } return Optional.empty(); } else if (expr instanceof ICPPASTCastExpression) { ICPPASTCastExpression cast = (ICPPASTCastExpression) expr; if (cast.getOperator() != ICPPASTCastExpression.op_static_cast) { return Optional.empty(); } if (checkEvaluation(cast)) { return Optional.of(cast.getTypeId()); } return Optional.empty(); } else return Optional.empty(); }
Source:
public RiakConnection getConnection(byte[] clientId) throws IOException { RiakConnection c = getConnection(3); if (clientId != null && !Arrays.equals(clientId, c.getClientId())) { setClientIdOnConnection(c, clientId); } return c; }

Target:
public RiakConnection getConnection(byte[] clientId) throws IOException { RiakConnection c = getConnection(CONNECTION_ACQUIRE_ATTEMPS); if (clientId != null && !Arrays.equals(clientId, c.getClientId())) { setClientIdOnConnection(c, clientId); } return c; }
Source:
public Box getByBarcode(String barcode) throws IOException { Box o = boxStore.getByBarcode(barcode); if (authorizationManager.readCheck(o)) return o; else throw new IOException("User " + authorizationManager.getCurrentUser().getFullName() + " cannot read Box " + barcode); }

Target:
public Box getByBarcode(String barcode) throws IOException { Box o = boxStore.getByBarcode(barcode); authorizationManager.throwIfNotReadable(o); return o; }
Source:
private static String cleanUri(String uri) { if (uri.charAt(0) == '<') return uri.substring(1, uri.length() - 1).toLowerCase(); else return uri; }

Target:
private static String cleanUri(String uri) { if (uri.charAt(0) == '<' && uri.charAt(uri.length()-1) == '>') { return uri.substring(1, uri.length()-1).toLowerCase(); } return uri; }
Source:
public FunctionKindRowColumn(final Supplier<FunctionDefinition> functionSupplier, final CellEditorControlsView.Presenter cellEditorControls, final KindPopoverView.Presenter editor, final Optional<String> editorTitle, final FunctionGrid gridWidget) { super(Collections.singletonList(new FunctionKindRowColumnHeaderMetaData(functionSupplier, cellEditorControls, editor, editorTitle, gridWidget))); setMovable(false); }

Target:
public FunctionKindRowColumn(final Supplier<FunctionDefinition> functionSupplier, final CellEditorControlsView.Presenter cellEditorControls, final KindPopoverView.Presenter editor, final Optional<String> editorTitle, final FunctionGrid gridWidget) { super(Collections.singletonList(new FunctionKindRowColumnHeaderMetaData(functionSupplier, cellEditorControls, editor, editorTitle, gridWidget))); setMovable(false); setResizable(false); }
Source:
public void getLedgerShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setRequestInterceptor(BitreserveRestAdapter.getRequestInterceptor(null)).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final ReserveService reserveService = adapter.create(ReserveService.class); reserveService.getLedger("foobar", new RetrofitPromise<List<Deposit>>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/reserve/ledger", MOCK_URL)); Assert.assertTrue(bodyRef.get().getHeaders().contains(new Header("Range", "foobar"))); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); }

Target:
public void getLedgerShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final ReserveService reserveService = adapter.create(ReserveService.class); reserveService.getLedger("foobar", new RetrofitPromise<List<Deposit>>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/reserve/ledger", MOCK_URL)); Assert.assertTrue(bodyRef.get().getHeaders().contains(new Header("Range", "foobar"))); }
Source:
public void purgeObject() { createBucket(bucketName, CREATION_DATE_TIME); Response response = target("/objects").request(MediaType.APPLICATION_JSON_TYPE) .post(Entity.entity(new FormDataMultiPart() .field("bucketName", bucketName).field("create", "new") .field("key", "object1").field("contentType", "text/plain") .field("timestamp", "2012-09-08 11:00:00") .field("tag", "DRAFT") .field("file", testData1, MediaType.TEXT_PLAIN_TYPE), MediaType.MULTIPART_FORM_DATA )); System.out.print("Response " + response); JsonObject responseObj = gson.fromJson(response.readEntity(String.class), JsonElement.class).getAsJsonObject(); TestCase.assertNotNull(responseObj); String versionChecksum = responseObj.get("versionChecksum").getAsString(); Response purgeResponse = target("/objects/" + bucketName) .queryParam("key", "object1") .queryParam("purge", true) .queryParam("versionChecksum", versionChecksum) .request() .accept(MediaType.APPLICATION_JSON_TYPE) .delete(); assertNotNull(purgeResponse); assertEquals( Response.Status.OK.getStatusCode(), purgeResponse.getStatus()); assertRepoError(target("/objects/meta/" + bucketName).queryParam("key", "object1").request().accept(MediaType.APPLICATION_JSON_TYPE).get(), Response.Status.NOT_FOUND, RepoException.Type.ObjectNotFound); assertRepoError(target("/objects/" + bucketName).queryParam("key", "object1").queryParam("fetchMetadata", "false").request().accept(MediaType.APPLICATION_JSON_TYPE).get(), Response.Status.NOT_FOUND, RepoException.Type.ObjectNotFound); }

Target:
public void purgeObject() { createBucket(bucketName, CREATION_DATE_TIME); Response response = target("/objects").request(MediaType.APPLICATION_JSON_TYPE) .post(Entity.entity(new FormDataMultiPart() .field("bucketName", bucketName).field("create", "new") .field("key", "object1").field("contentType", "text/plain") .field("timestamp", "2012-09-08 11:00:00") .field("tag", "DRAFT") .field("file", testData1, MediaType.TEXT_PLAIN_TYPE), MediaType.MULTIPART_FORM_DATA )); JsonObject responseObj = gson.fromJson(response.readEntity(String.class), JsonElement.class).getAsJsonObject(); TestCase.assertNotNull(responseObj); String versionChecksum = responseObj.get("versionChecksum").getAsString(); Response purgeResponse = target("/objects/" + bucketName) .queryParam("key", "object1") .queryParam("purge", true) .queryParam("versionChecksum", versionChecksum) .request() .accept(MediaType.APPLICATION_JSON_TYPE) .delete(); assertNotNull(purgeResponse); assertEquals( Response.Status.OK.getStatusCode(), purgeResponse.getStatus()); assertRepoError(target("/objects/meta/" + bucketName).queryParam("key", "object1").request().accept(MediaType.APPLICATION_JSON_TYPE).get(), Response.Status.NOT_FOUND, RepoException.Type.ObjectNotFound); assertRepoError(target("/objects/" + bucketName).queryParam("key", "object1").queryParam("fetchMetadata", "false").request().accept(MediaType.APPLICATION_JSON_TYPE).get(), Response.Status.NOT_FOUND, RepoException.Type.ObjectNotFound); }
Source:
public void setUp() { setting = new SettingImpl<>(Integer.class, SETTING_ID, 50, new RangedNumberValidator<>(0, 100, false, false)); eventResult = -1; setting.subscribe(propertyChangeEvent -> eventResult = (int) propertyChangeEvent.getNewValue()); }

Target:
public void setUp() { setting = new SettingImpl<>(SETTING_ID, 50, new RangedNumberValidator<>(0, 100, false, false)); eventResult = -1; setting.subscribe(propertyChangeEvent -> eventResult = (int) propertyChangeEvent.getNewValue()); }
Source:
public Optional<MethodSpec> generate() { MethodSpec.Builder selectStartBuilder = MethodSpec.methodBuilder("selectStart") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .returns(Select.class) .addStatement("$T keyspaceId = context.getKeyspaceId()", CqlIdentifier.class) .addStatement("$T tableId = context.getTableId()", CqlIdentifier.class) .beginControlFlow("if (tableId == null)") .addStatement("tableId = defaultTableId") .endControlFlow() .addStatement( "$1T selectFrom = (keyspaceId == null)\n" + "? $2T.selectFrom(tableId)\n" + ": $2T.selectFrom(keyspaceId, tableId)", SelectFrom.class, QueryBuilder.class) .addCode("$[return selectFrom"); for (PropertyDefinition property : entityDefinition.getAllValues()) { if (property.getSelector().equals(property.getCqlName())) { selectStartBuilder.addCode("\n.column($L)", property.getSelector()); } else { selectStartBuilder.addCode( "\n.raw($L).as($L)", property.getSelector(), property.getCqlName()); } } selectStartBuilder.addCode("$];\n"); return Optional.of(selectStartBuilder.build()); }

Target:
public Optional<MethodSpec> generate() { MethodSpec.Builder selectStartBuilder = MethodSpec.methodBuilder("selectStart") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .returns(Select.class) .addStatement("$T keyspaceId = context.getKeyspaceId()", CqlIdentifier.class) .addStatement("$T tableId = context.getTableId()", CqlIdentifier.class) .beginControlFlow("if (tableId == null)") .addStatement("tableId = defaultTableId") .endControlFlow() .addStatement( "$1T selectFrom = (keyspaceId == null)\n" + "? $2T.selectFrom(tableId)\n" + ": $2T.selectFrom(keyspaceId, tableId)", SelectFrom.class, QueryBuilder.class) .addCode("$[return selectFrom"); for (PropertyDefinition property : entityDefinition.getAllColumns()) { selectStartBuilder.addCode("\n.column($L)", property.getSelector()); } for (PropertyDefinition property : entityDefinition.getComputedValues()) { selectStartBuilder.addCode( "\n.raw($L).as($L)", property.getSelector(), property.getCqlName()); } selectStartBuilder.addCode("$];\n"); return Optional.of(selectStartBuilder.build()); }
Source:
public BidirectionalActions<A> apply(Problem<A, S> originalProblem, Problem<A, S> reverseProblem) { Node<A, S> node = newRootNode(originalProblem.initialState(), 0); if (originalProblem.isGoalState(node.state())) { this.previousMeetingOfTwoFrontiers = node; this.nextNodeToBeEvaluated = null; return bidirectionalActions; } Node<A, S> revNode = newRootNode(reverseProblem.initialState(), 0); Queue<Node<A, S>> front = newFIFOQueue(node); Queue<Node<A, S>> back = newFIFOQueue(revNode); HashMap<S, Node<A, S>> exploredFront = newExploredMap(); HashMap<S, Node<A, S>> exploredBack = newExploredMap(); exploredFront.put(node.state(), null); exploredBack.put(revNode.state(), null); Node<A, S> solutionNode; while (!front.isEmpty() || !back.isEmpty()) { if (front.isEmpty() || back.isEmpty()) { this.previousMeetingOfTwoFrontiers = null; return bidirectionalActions; } solutionNode = pathExistsBidirectional(front, exploredFront, exploredBack, originalProblem); if (solutionNode != null) { this.meetingOfTwoFrontiers = solutionNode; this.fromFront = true; return bidirectionalActions; } solutionNode = pathExistsBidirectional(back, exploredBack, exploredFront, originalProblem); if (solutionNode != null) { this.meetingOfTwoFrontiers = solutionNode; this.fromFront = false; return bidirectionalActions; } } this.previousMeetingOfTwoFrontiers = null; return bidirectionalActions; }

Target:
public BidirectionalActions<A> apply(Problem<A, S> originalProblem, Problem<A, S> reverseProblem) { Node<A, S> node = newRootNode(originalProblem.initialState(), 0); if (originalProblem.isGoalState(node.state())) { this.previousMeetingOfTwoFrontiers = node; this.nextNodeToBeEvaluated = null; bidirectionalActions = new BasicBidirectionalActions<>(fromInitialStatePart(), fromGoalStatePart()); return bidirectionalActions; } Node<A, S> revNode = newRootNode(reverseProblem.initialState(), 0); Queue<Node<A, S>> front = newFIFOQueue(node); Queue<Node<A, S>> back = newFIFOQueue(revNode); Map<S, Node<A, S>> exploredFront = newExploredMap(node.state()); Map<S, Node<A, S>> exploredBack = newExploredMap(revNode.state()); while (!front.isEmpty() || !back.isEmpty()) { if (front.isEmpty() || back.isEmpty()) { this.previousMeetingOfTwoFrontiers = null; bidirectionalActions = new BasicBidirectionalActions<>(fromInitialStatePart(), fromGoalStatePart()); return bidirectionalActions; } if (isSolution(pathExistsBidirectional(front, exploredFront, exploredBack, originalProblem), true)) { bidirectionalActions = new BasicBidirectionalActions<>(fromInitialStatePart(), fromGoalStatePart()); return bidirectionalActions; } if (isSolution(pathExistsBidirectional(back, exploredBack, exploredFront, originalProblem), false)) { bidirectionalActions = new BasicBidirectionalActions<>(fromInitialStatePart(), fromGoalStatePart()); return bidirectionalActions; } } this.previousMeetingOfTwoFrontiers = null; bidirectionalActions = new BasicBidirectionalActions<>(fromInitialStatePart(), fromGoalStatePart()); return bidirectionalActions; }
Source:
public Mono<CosmosAsyncContainerResponse> read(CosmosContainerRequestOptions options) { if (options == null) { options = new CosmosContainerRequestOptions(); } final CosmosContainerRequestOptions requestOptions = options; if(!database.getClient().getTracerProvider().isEnabled()){ return readInternal(options); } return withContext(context -> read(requestOptions, context)).subscriberContext(TracerProvider.callDepthAttributeFunc); }

Target:
public Mono<CosmosContainerResponse> read(CosmosContainerRequestOptions options) { if (options == null) { options = new CosmosContainerRequestOptions(); } final CosmosContainerRequestOptions requestOptions = options; if(!database.getClient().getTracerProvider().isEnabled()){ return readInternal(options); } return withContext(context -> read(requestOptions, context)); }
Source:
public Deferred<Object> initialize(final TSDB tsdb, final String id) { this.id = Strings.isNullOrEmpty(id) ? TYPE : id; this.tsdb = tsdb; if (!tsdb.getConfig().hasProperty(getConfigKey(MAX_CARD_KEY))) { tsdb.getConfig().register(getConfigKey(MAX_CARD_KEY), 4096, true, "The maximum number of entries to allow for multi-get queries."); } if (!tsdb.getConfig().hasProperty(getConfigKey(FALLBACK_ON_NO_DATA_KEY))) { tsdb.getConfig() .register( getConfigKey(FALLBACK_ON_NO_DATA_KEY), false, true, "Whether or not to fall back to scans when the meta " + "query returns an empty data set."); } if (!tsdb.getConfig().hasProperty(getConfigKey(FALLBACK_ON_EX_KEY))) { tsdb.getConfig() .register( getConfigKey(FALLBACK_ON_EX_KEY), true, true, "Whether or not to fall back to scans when the meta " + "query returns an exception."); } if (!tsdb.getConfig().hasProperty(getConfigKey(CLIENT_ID))) { tsdb.getConfig().register(getConfigKey(CLIENT_ID), null, false, "Meta client id."); } String skip_meta_namespaces = tsdb.getConfig().getString(SKIP_META_NAMESPACES); skip_meta = new ArrayList<>(); String[] namespaces = skip_meta_namespaces.split(","); for (String namespace : namespaces) { skip_meta.add(namespace.trim()); } String clientID = tsdb.getConfig().getString(getConfigKey(CLIENT_ID)); client = tsdb.getRegistry().getPlugin(MetaClient.class, clientID); if (client == null) { throw new IllegalStateException("No client found with id: " + clientID); } return Deferred.fromResult(null); }

Target:
public Deferred<Object> initialize(final TSDB tsdb, final String id) { this.id = Strings.isNullOrEmpty(id) ? TYPE : id; this.tsdb = tsdb; if (!tsdb.getConfig().hasProperty(getConfigKey(MAX_CARD_KEY))) { tsdb.getConfig().register(getConfigKey(MAX_CARD_KEY), 4096, true, "The maximum number of entries to allow for multi-get queries."); } if (!tsdb.getConfig().hasProperty(getConfigKey(FALLBACK_ON_NO_DATA_KEY))) { tsdb.getConfig() .register( getConfigKey(FALLBACK_ON_NO_DATA_KEY), false, true, "Whether or not to fall back to scans when the meta " + "query returns an empty data set."); } if (!tsdb.getConfig().hasProperty(getConfigKey(FALLBACK_ON_EX_KEY))) { tsdb.getConfig() .register( getConfigKey(FALLBACK_ON_EX_KEY), true, true, "Whether or not to fall back to scans when the meta " + "query returns an exception."); } if (!tsdb.getConfig().hasProperty(getConfigKey(CLIENT_ID))) { tsdb.getConfig().register(getConfigKey(CLIENT_ID), null, false, "Meta client id."); } if (tsdb.getConfig().hasProperty(getConfigKey(SKIP_META))) { tsdb.getConfig().register(ConfigurationEntrySchema.newBuilder() .setKey(SKIP_META) .setDefaultValue(Maps.newHashMap()) .setDescription("TODO") .setType(NAMESPACE_FILTERS) .setSource(this.getClass().toString()) .isDynamic() .build()); } String clientID = tsdb.getConfig().getString(getConfigKey(CLIENT_ID)); client = tsdb.getRegistry().getPlugin(MetaClient.class, clientID); if (client == null) { throw new IllegalStateException("No client found with id: " + clientID); } return Deferred.fromResult(null); }
Source:
public void handleNotifications(Event event) { EventContext ctx = event.getContext(); DocumentEventContext docCtx = (DocumentEventContext) ctx; if (docCtx.getSourceDocument().getType().equals("Post") || docCtx.getSourceDocument().getType().equals(AnnotationConstants.ANNOTATION_DOC_TYPE) || docCtx.getSourceDocument().getType().equals(CommentsConstants.COMMENT_DOC_TYPE)) { Object[] args = { docCtx.getProperty(CommentConstants.TOP_LEVEL_DOCUMENT) }; docCtx.setArgs(args); } }

Target:
public void handleNotifications(Event event) { EventContext ctx = event.getContext(); DocumentEventContext docCtx = (DocumentEventContext) ctx; if (docCtx.getSourceDocument().getType().equals("Post") || docCtx.getSourceDocument().getType().equals(AnnotationConstants.ANNOTATION_DOC_TYPE) || docCtx.getSourceDocument().getType().equals(CommentsConstants.COMMENT_DOC_TYPE)) { Object[] args = { docCtx.getProperty(CommentConstants.TOP_LEVEL_DOCUMENT), null }; docCtx.setArgs(args); } }
Source:
private boolean createLockedTableWithStatusRow(UUID queryId) { String sql = String.format(ENGLISH, "CREATE TABLE IF NOT EXISTS %s" + " (query_id, created_at, completed_at)" + " AS SELECT '%s'::text, CURRENT_TIMESTAMP::timestamptz, NULL::timestamptz", escapeIdent(statusTableName(queryId)), queryId.toString()); try { execute(sql); return true; } catch (SQLException ex) { if (isConflictException(ex)) { abortTransaction(); return false; } else { String desc = "Failed to create a status table." + ".\nhint: if you don't have permission to create tables, " + "please add \"strict_transaction: false\" option to disable " + "exactly-once transaction control that depends on this table.\n" + "Or please ask system administrator to let this user create tables\n" + "in this schema."; throw new DatabaseException(desc, ex); } } }

Target:
private boolean createLockedTableWithStatusRow(UUID queryId) { String sql = String.format(ENGLISH, "CREATE TABLE %s" + " (query_id, created_at, completed_at)" + " AS SELECT '%s'::text, CURRENT_TIMESTAMP::timestamptz, NULL::timestamptz", escapeIdent(statusTableName(queryId)), queryId.toString()); try { execute(sql); return true; } catch (SQLException ex) { if (isConflictException(ex)) { abortTransaction(); return false; } else { String desc = "Failed to create a status table." + ".\nhint: if you don't have permission to create tables, " + "please add \"strict_transaction: false\" option to disable " + "exactly-once transaction control that depends on this table.\n" + "Or please ask system administrator to let this user create tables\n" + "in this schema."; throw new DatabaseException(desc, ex); } } }
Source:
public void beforeStart(@NotNull UsersWorkspace workspace, @Nullable String accountId) throws NotFoundException, ForbiddenException, ServerException { User currentUser = EnvironmentContext.getCurrent().getUser(); if (accountId == null) { if (!accountDao.isWorkspaceRegistered(workspace.getId())) { List<Account> ownedAccounts = accountDao.getByOwner(currentUser.getId()); if (ownedAccounts.size() != 1) { throw new ForbiddenException(format("Workspace start rejected. Impossible to determine account for workspace '%s', " + "user '%s' is owner of several accounts. Specify account identifier!", workspace.getId(), workspace.getOwner())); } Account account = ownedAccounts.get(0); account.getWorkspaces().add(workspace); accountDao.update(account); } } else { try { Account account = accountDao.getByWorkspace(workspace.getId()); if (!account.getId().equals(accountId)) { throw new ForbiddenException(format("Workspace start rejected. Workspace is already added to account '%s' " + "which is different from specified one '%s'", account.getId(), accountId)); } } catch (NotFoundException ignored) { if (accountDao.getMembers(accountId) .stream() .noneMatch(member -> currentUser.getId().equals(member.getUserId()) && member.getRoles().contains("account/owner"))) { throw new ForbiddenException(format("Workspace start rejected. User '%s' doesn't own account '%s'", currentUser.getId(), accountId)); } Account account = accountDao.getById(accountId); account.getWorkspaces().add(workspace); accountDao.update(account); } } }

Target:
public void beforeStart(@NotNull UsersWorkspace workspace, @Nullable String accountId) throws NotFoundException, ForbiddenException, ServerException { User currentUser = EnvironmentContext.getCurrent().getUser(); if (accountId == null) { if (!accountDao.isWorkspaceRegistered(workspace.getId())) { List<Account> ownedAccounts = accountDao.getByOwner(currentUser.getId()); if (ownedAccounts.size() != 1) { throw new ForbiddenException(format("Workspace start rejected. Impossible to determine account for workspace '%s', " + "user '%s' is owner of zero or several accounts. Specify account identifier!", workspace.getId(), workspace.getOwner())); } Account account = ownedAccounts.get(0); account.getWorkspaces().add(workspace); accountDao.update(account); } } else { try { Account account = accountDao.getByWorkspace(workspace.getId()); if (!account.getId().equals(accountId)) { throw new ForbiddenException(format("Workspace start rejected. Workspace is already added to account '%s' " + "which is different from specified one '%s'", account.getId(), accountId)); } } catch (NotFoundException ignored) { if (accountDao.getMembers(accountId) .stream() .noneMatch(member -> currentUser.getId().equals(member.getUserId()) && member.getRoles().contains("account/owner"))) { throw new ForbiddenException(format("Workspace start rejected. User '%s' doesn't own account '%s'", currentUser.getId(), accountId)); } Account account = accountDao.getById(accountId); account.getWorkspaces().add(workspace); accountDao.update(account); } } }
Source:
private boolean matchVariant(String hugoSymbol, String variant, String example) { Gene gene = GeneUtils.getGeneByHugoSymbol(hugoSymbol); boolean isMatched = false; if (gene != null) { AlterationBo alterationBo = ApplicationContextSingleton.getAlterationBo(); boolean isGeneralAlteration = AlterationUtils.isGeneralAlterations(variant); Alteration oncokbVariant = new Alteration(); if (!isGeneralAlteration) { oncokbVariant.setGene(gene); oncokbVariant.setAlteration(variant); oncokbVariant.setName(variant); AlterationUtils.annotateAlteration(oncokbVariant, variant); } example = example.trim(); Alteration exampleVariant = new Alteration(); exampleVariant.setGene(gene); exampleVariant.setAlteration(example); exampleVariant.setName(example); AlterationUtils.annotateAlteration(exampleVariant, example); LinkedHashSet<Alteration> relevantAlterations = new LinkedHashSet<>(); if (isGeneralAlteration) { relevantAlterations = alterationBo.findRelevantAlterations(exampleVariant, true); for (Alteration alteration : relevantAlterations) { if (alteration.getAlteration().toLowerCase().equals(variant.toLowerCase())) { isMatched = true; break; } } } else { relevantAlterations = alterationBo.findRelevantAlterations(exampleVariant, Collections.singleton(oncokbVariant), false); isMatched = relevantAlterations.size() > 0; } } return isMatched; }

Target:
private boolean matchVariant(String hugoSymbol, String variant, String example) { Gene gene = GeneUtils.getGeneByHugoSymbol(hugoSymbol); boolean isMatched = false; if (gene != null) { AlterationBo alterationBo = ApplicationContextSingleton.getAlterationBo(); boolean isGeneralAlteration = AlterationUtils.isGeneralAlterations(variant); Alteration oncokbVariant = new Alteration(); oncokbVariant.setGene(gene); oncokbVariant.setAlteration(variant); oncokbVariant.setName(variant); AlterationUtils.annotateAlteration(oncokbVariant, variant); example = example.trim(); Alteration exampleVariant = new Alteration(); exampleVariant.setGene(gene); exampleVariant.setAlteration(example); exampleVariant.setName(example); AlterationUtils.annotateAlteration(exampleVariant, example); LinkedHashSet<Alteration> relevantAlterations = new LinkedHashSet<>(); if (isGeneralAlteration) { Set<Alteration> allAlterations = AlterationUtils.getAllAlterations(gene); Alteration exactMatch = AlterationUtils.findAlteration(gene, variant); if (exactMatch == null) { allAlterations.add(oncokbVariant); } relevantAlterations = alterationBo.findRelevantAlterations(exampleVariant, allAlterations, true); for (Alteration alteration : relevantAlterations) { if (alteration.getAlteration().toLowerCase().equals(variant.toLowerCase())) { isMatched = true; break; } } } else { relevantAlterations = alterationBo.findRelevantAlterations(exampleVariant, Collections.singleton(oncokbVariant), false); isMatched = relevantAlterations.size() > 0; } } return isMatched; }
Source:
public void initialize(final AppStateManager stateManager, final Application app) { super.initialize(stateManager, app); this.app = (Main) app; rootNode = this.app.getRootNode(); assetManager = this.app.getAssetManager(); this.stateManager = stateManager; inputManager = this.app.getInputManager(); viewPort = this.app.getViewPort(); inputManager.setCursorVisible(false); setupTitleScreen(); loadingThread = new LoadingThread(this.name); loadingThread.start(); }

Target:
public void initialize(final AppStateManager stateManager, final Application app) { super.initialize(stateManager, app); this.app = (Main) app; rootNode = this.app.getRootNode(); assetManager = this.app.getAssetManager(); this.stateManager = stateManager; inputManager = this.app.getInputManager(); viewPort = this.app.getViewPort(); inputManager.setCursorVisible(false); setupTitleScreen(); }
Source:
public RegistrationScreenInteractor observeRegistrationScreen() { final MainApplication app = MainApplication.instance(); try { registrationFields = app.getInjector().getInstance(EdxEnvironment.class).getServiceManager().getRegistrationDescription(); } catch (Exception e) { e.printStackTrace(); } final CharSequence title = ResourceUtil.getFormattedString(app.getResources(), R.string.register_title, "platform_name", app.getInjector().getInstance(Config.class).getPlatformName()); onView(withId(R.id.activity_title)).check(matches(withText(title.toString()))); onEmailView().check(matches(isCompletelyDisplayed())); onNameView().check(matches(isCompletelyDisplayed())); onUsernameView().check(matches(isCompletelyDisplayed())); onPasswordView().check(matches(isCompletelyDisplayed())); onCountryView().check(matches(isCompletelyDisplayed())); onCreateAccountButton().check(matches(isCompletelyDisplayed())); return this; }

Target:
public RegistrationScreenInteractor observeRegistrationScreen() { final MainApplication app = MainApplication.instance(); final CharSequence title = ResourceUtil.getFormattedString(app.getResources(), R.string.register_title, "platform_name", app.getInjector().getInstance(Config.class).getPlatformName()); onView(withId(R.id.activity_title)).check(matches(withText(title.toString()))); return this; }