auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testReceivedJobMessageWithWrongJobID() { exception.expect(IllegalStateException.class); JobMessage message = mock(JobMessage.class); when(message.getJobID()).thenReturn(JOB_ID); try { jobHandler.onJobMessage(message); } finally { verify(jobSpy, atLeast(0)).getState(); verify(jobSpy, atLeast(0)).getJobID(); verifyNoMoreInteractions(jobSpy); } }

Target:
public void testReceivedJobMessageWithWrongJobID() { JobMessage message = mock(JobMessage.class); when(message.getJobID()).thenReturn(JOB_ID); exception.expect(IllegalStateException.class); try { jobHandler.onJobMessage(message); } finally { verify(jobSpy, atLeast(0)).getState(); verify(jobSpy, atLeast(0)).getJobID(); verifyNoMoreInteractions(jobSpy); } }
Source:
public void messageBasedProcessor() throws IOException { sendMessages(); for (int i = 0; i < numMessages; i++) { Message<?> outputMessage = outputChannel.receive(); assertEquals("ping-pong", outputMessage.getPayload()); } }

Target:
public void messageBasedProcessor() throws IOException { sendMessages(); for (int i = 0; i < numMessages; i++) { Message<?> outputMessage = outputChannel.receive(500); assertEquals("ping-pong", outputMessage.getPayload()); } }
Source:
public static TableSchema.Builder builderWithGivenSchema(TableSchema oriSchema) { TableSchema.Builder builder = TableSchema.builder() .fields(oriSchema.getFieldNames(), oriSchema.getFieldDataTypes()); for (WatermarkSpec wms : oriSchema.getWatermarkSpecs()) { builder.watermark( wms.getRowtimeAttribute(), wms.getWatermarkExpr(), wms.getWatermarkExprOutputType()); } oriSchema.getPrimaryKey() .map(pk -> builder.primaryKey(pk.getName(), pk.getColumns().toArray(new String[0]))); return builder; }

Target:
public static TableSchema.Builder builderWithGivenSchema(TableSchema oriSchema) { TableSchema.Builder builder = builderWithGivenColumns(oriSchema.getTableColumns()); for (WatermarkSpec wms : oriSchema.getWatermarkSpecs()) { builder.watermark( wms.getRowtimeAttribute(), wms.getWatermarkExpr(), wms.getWatermarkExprOutputType()); } oriSchema.getPrimaryKey() .map(pk -> builder.primaryKey(pk.getName(), pk.getColumns().toArray(new String[0]))); return builder; }
Source:
private void removeTemplateBackup() { ArrayList<VdcActionParametersBase> prms = new ArrayList<VdcActionParametersBase>(); for (Object a : getSelectedItems()) { VmTemplate template = (VmTemplate) a; prms.add(new VmTemplateImportExportParameters(template.getId(), getEntity().getId(), pool.getId())); } Frontend.getInstance().runMultipleAction(VdcActionType.RemoveVmTemplateFromImportExport, prms); cancel(); }

Target:
private void removeTemplateBackup() { ArrayList<VdcActionParametersBase> prms = new ArrayList<VdcActionParametersBase>(); for (Object selectedItem : getSelectedItems()) { VmTemplate template = (VmTemplate) selectedItem; prms.add(new VmTemplateImportExportParameters(template.getId(), getEntity().getId(), pool.getId())); } Frontend.getInstance().runMultipleAction(VdcActionType.RemoveVmTemplateFromImportExport, prms); cancel(); }
Source:
public static boolean isLocal(Project project, String path) { RuntimeEnvironment env = RuntimeEnvironment.getInstance(); String srcRoot = env.getSourceRootPath(); if (path.startsWith(srcRoot)) { if (env.hasProjects()) { String relPath = path.substring(srcRoot.length()); if (project != null && project.equals(Project.getProject(relPath))) { return true; } } else { return true; } } return false; }

Target:
public static boolean isLocal(Project project, String path) { RuntimeEnvironment env = RuntimeEnvironment.getInstance(); String srcRoot = env.getSourceRootPath(); if (path.startsWith(srcRoot)) { if (env.hasProjects()) { if (project != null && project.equals(Project.getProject(path.substring(srcRoot.length())))) { return true; } } else { return true; } } return false; }
Source:
public DataContainer(List<String> resourcePaths) { load("mimicker.yml"); for (String path : resourcePaths) { load(path); } }

Target:
public DataContainer(List<String> resourcePaths) { for (String path : resourcePaths) { load(path); } }
Source:
protected ICommand getAfterSetCommand(SetRequest request) { CompositeCommand compositeCommand = new CompositeCommand("Set CapsulePart"); EStructuralFeature feature = request.getFeature(); if (UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature)) { Object newValue = request.getValue(); EObject elementToEdit = request.getElementToEdit(); if (elementToEdit instanceof Property && newValue instanceof Type) { Property property = (Property) elementToEdit; Type newType = (Type) newValue; if (CapsulePartUtils.generateCycle(newType, property)) { LiteralInteger newLowerValue = UMLFactory.eINSTANCE.createLiteralInteger(); newLowerValue.setValue(0); ICommand setLowerBoundsCommand = new SetValueCommand(new SetRequest(request.getElementToEdit(), UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue(), newLowerValue)); compositeCommand.add(setLowerBoundsCommand); } if ((Strings.isNullOrEmpty((property).getName()) || NewElementUtil.isCreatedElement(property))) { String name = newType.getName(); if (!Strings.isNullOrEmpty(name)) { String newName = NewElementUtil.getUniqueName(property, newType); ICommand setNameCommand = new SetValueCommand(new SetRequest(request.getElementToEdit(), UMLPackage.eINSTANCE.getNamedElement_Name(), newName)); compositeCommand.add(setNameCommand); } } } } return compositeCommand.isEmpty() ? super.getAfterSetCommand(request) : compositeCommand; }

Target:
protected ICommand getAfterSetCommand(SetRequest request) { CompositeCommand compositeCommand = new CompositeCommand("Set CapsulePart Type"); EStructuralFeature feature = request.getFeature(); if (UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature)) { Object newValue = request.getValue(); EObject elementToEdit = request.getElementToEdit(); if (elementToEdit instanceof Property && newValue instanceof Type) { Property property = (Property) elementToEdit; Type newType = (Type) newValue; if (CapsulePartUtils.completesCycle(newType, property)) { LiteralInteger newLowerValue = (LiteralInteger) ModelUtils.create((EObject) null, UMLPackage.Literals.LITERAL_INTEGER); newLowerValue.setValue(0); ICommand setLowerBoundsCommand = new SetValueCommand(new SetRequest(request.getElementToEdit(), UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue(), newLowerValue)); compositeCommand.add(setLowerBoundsCommand); } if ((Strings.isNullOrEmpty((property).getName()) || NewElementUtil.isCreatedElement(property))) { String name = newType.getName(); if (!Strings.isNullOrEmpty(name)) { String newName = NewElementUtil.getUniqueName(property, newType); ICommand setNameCommand = new SetValueCommand(new SetRequest(request.getElementToEdit(), UMLPackage.eINSTANCE.getNamedElement_Name(), newName)); compositeCommand.add(setNameCommand); } } } } return compositeCommand.isEmpty() ? super.getAfterSetCommand(request) : compositeCommand; }
Source:
private static boolean renameIndexFiles( final FileSystem outputFS, final Path indexZipFilePath, final Path finalIndexZipFilePath ) throws IOException { return ((DataPusher) RetryProxy.create( DataPusher.class, new DataPusher() { @Override public long push() throws IOException { try { final boolean needRename; if (outputFS.exists(finalIndexZipFilePath)) { final FileStatus zipFile = outputFS.getFileStatus(indexZipFilePath); final FileStatus finalIndexZipFile = outputFS.getFileStatus(finalIndexZipFilePath); if (zipFile.getModificationTime() >= finalIndexZipFile.getModificationTime() || zipFile.getLen() != finalIndexZipFile.getLen()) { log.info( "File[%s / %s / %sB] existed, but wasn't the same as [%s / %s / %sB]", finalIndexZipFile.getPath(), new DateTime(finalIndexZipFile.getModificationTime()), finalIndexZipFile.getLen(), zipFile.getPath(), new DateTime(zipFile.getModificationTime()), zipFile.getLen() ); outputFS.delete(finalIndexZipFilePath, false); needRename = true; } else { log.info( "File[%s / %s / %sB] existed and will be kept", finalIndexZipFile.getPath(), new DateTime(finalIndexZipFile.getModificationTime()), finalIndexZipFile.getLen() ); needRename = false; } } else { needRename = true; } return (needRename && !outputFS.rename(indexZipFilePath, finalIndexZipFilePath)) ? 0 : 1; } catch (IOException | RuntimeException exception) { log.error(exception, "Exception in rename retry loop"); throw exception; } } }, RetryPolicies.exponentialBackoffRetry(NUM_RETRIES, SECONDS_BETWEEN_RETRIES, TimeUnit.SECONDS) )).push() == 1; }

Target:
private static boolean renameIndexFiles( final FileSystem outputFS, final Path indexZipFilePath, final Path finalIndexZipFilePath ) { try { return RetryUtils.retry( new Callable<Boolean>() { @Override public Boolean call() throws Exception { final boolean needRename; if (outputFS.exists(finalIndexZipFilePath)) { final FileStatus zipFile = outputFS.getFileStatus(indexZipFilePath); final FileStatus finalIndexZipFile = outputFS.getFileStatus(finalIndexZipFilePath); if (zipFile.getModificationTime() >= finalIndexZipFile.getModificationTime() || zipFile.getLen() != finalIndexZipFile.getLen()) { log.info( "File[%s / %s / %sB] existed, but wasn't the same as [%s / %s / %sB]", finalIndexZipFile.getPath(), new DateTime(finalIndexZipFile.getModificationTime()), finalIndexZipFile.getLen(), zipFile.getPath(), new DateTime(zipFile.getModificationTime()), zipFile.getLen() ); outputFS.delete(finalIndexZipFilePath, false); needRename = true; } else { log.info( "File[%s / %s / %sB] existed and will be kept", finalIndexZipFile.getPath(), new DateTime(finalIndexZipFile.getModificationTime()), finalIndexZipFile.getLen() ); needRename = false; } } else { needRename = true; } if (needRename) { log.info("Attempting rename from [%s] to [%s]", indexZipFilePath, finalIndexZipFilePath); return outputFS.rename(indexZipFilePath, finalIndexZipFilePath); } else { return true; } } }, FileUtils.IS_EXCEPTION, NUM_RETRIES ); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
public static boolean isDeterministic(RexNode expr) { boolean deterministic = true; RexVisitor<Void> visitor = new RexVisitorImpl<Void>(true) { @Override public Void visitCall(org.apache.calcite.rex.RexCall call) { if (!call.getOperator().isDeterministic()) { throw new Util.FoundOne(call); } return super.visitCall(call); } }; try { expr.accept(visitor); } catch (Util.FoundOne e) { deterministic = false; } return deterministic; }

Target:
public static boolean isDeterministic(RexNode expr) { try { RexVisitor<Void> visitor = new RexVisitorImpl<Void>(true) { @Override public Void visitCall(RexCall call) { if (!call.getOperator().isDeterministic()) { throw new Util.FoundOne(call); } return null; } }; expr.accept(visitor); return true; } catch (Util.FoundOne e) { Util.swallow(e, null); return false; } }
Source:
protected void configureMessageConverters(final List<HttpMessageConverter<?>> converters) { StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(); stringConverter.setWriteAcceptCharset(false); converters.add(new ByteArrayHttpMessageConverter()); converters.add(stringConverter); converters.add(new ResourceHttpMessageConverter()); converters.add(new SourceHttpMessageConverter<>()); converters.add(mappingJackson2HttpMessageConverter()); super.configureMessageConverters(converters); }

Target:
protected void configureMessageConverters(final List<HttpMessageConverter<?>> converters) { final StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(); stringConverter.setWriteAcceptCharset(false); converters.add(new ByteArrayHttpMessageConverter()); converters.add(stringConverter); converters.add(new ResourceHttpMessageConverter()); converters.add(new SourceHttpMessageConverter<>()); converters.add(mappingJackson2HttpMessageConverter()); super.configureMessageConverters(converters); }
Source:
public void should_fail_if_given_would_be_equal_to_actual_with_default_comparator() { ChronoLocalDateTime<JapaneseDate> inJapan = JapaneseChronology.INSTANCE.localDateTime(now); assertThatThrownBy(() -> assertThat(now).isEqualTo(inJapan)).isInstanceOf(AssertionFailedError.class); }

Target:
public void should_fail_if_given_would_be_equal_to_actual_with_default_comparator() { ChronoLocalDateTime<JapaneseDate> inJapan = JapaneseChronology.INSTANCE.localDateTime(now); assertThat(now.equals(inJapan)).isFalse(); assertThat(now.isEqual(inJapan)).isTrue(); assertThat(now).isEqualTo(inJapan); Object inJapanObject = inJapan; assertThat(now).isEqualTo(inJapanObject); }
Source:
private static Iterable<String> head(final Response origin, final int status, final CharSequence reason) throws IOException { if (status < 100 || status > 999) { throw new IllegalArgumentException( String.format( "according to RFC 7230 HTTP status code must have three digits: %d", status ) ); } return new Concat<String>( Collections.singletonList( String.format("HTTP/1.1 %d %s", status, reason) ), new Select<String>( origin.head(), new Condition<String>() { @Override public boolean fits(final String element) { return !RsWithStatus.FIRST.matcher(element).matches(); } } ) ); }

Target:
private static Iterable<String> head(final Response origin, final int status, final CharSequence reason) throws IOException { if (status < 100 || status > 999) { throw new IllegalArgumentException( String.format( "according to RFC 7230 HTTP status code must have three digits: %d", status ) ); } return new Concat<String>( Collections.singletonList( String.format("HTTP/1.1 %d %s", status, reason) ), new Select<String>( origin.head(), new Condition<String>() { private final AtomicBoolean fit = new AtomicBoolean(false); @Override public boolean fits(final String element) { return this.fit.getAndSet(true); } } ) ); }
Source:
SimpleList<Sequence> getSequencesForType(TypedOperation operation, int i, boolean onlyReceivers) { Type neededType = operation.getInputTypes().get(i); SimpleList<Sequence> literals = null; if (operation instanceof TypedClassOperation && !onlyReceivers) { ClassOrInterfaceType declaringCls = ((TypedClassOperation) operation).getDeclaringType(); assert declaringCls != null; if (classLiterals != null) { SimpleList<Sequence> sl = classLiterals.getSequences(declaringCls, neededType); if (!sl.isEmpty()) { literals = sl; } } if (packageLiterals != null) { Package pkg = declaringCls.getPackage(); if (pkg != null) { SimpleList<Sequence> sl = packageLiterals.getSequences(pkg, neededType); if (!sl.isEmpty()) { literals = (literals == null) ? sl : new ListOfLists<>(literals, sl); } } } else if (classLiterals != null && Randomness.weightedCoinFlip(GenInputsAbstract.p_const)) { return classLiterals.getSequences(declaringCls, neededType); } } SimpleList<Sequence> result = gralComponents.getSequencesForType(neededType, false, onlyReceivers); if (literals != null) { result = new ListOfLists<>(result, literals); } return result; }

Target:
SimpleList<Sequence> getSequencesForType(TypedOperation operation, int i, boolean onlyReceivers) { Type neededType = operation.getInputTypes().get(i); if (onlyReceivers && neededType.isNonreceiverType()) { throw new RandoopBug( String.format( "getSequencesForType(%s, %s, %s) neededType=%s", operation, i, onlyReceivers, neededType)); } SimpleList<Sequence> result = gralComponents.getSequencesForType(neededType, false, onlyReceivers); SimpleList<Sequence> literals = null; if (operation instanceof TypedClassOperation && !onlyReceivers) { ClassOrInterfaceType declaringCls = ((TypedClassOperation) operation).getDeclaringType(); assert declaringCls != null; if (classLiterals != null) { SimpleList<Sequence> sl = classLiterals.getSequences(declaringCls, neededType); if (!sl.isEmpty()) { literals = sl; } } boolean shouldOnlyIncludeConstantsFromDeclaringClass = GenInputsAbstract.input_selection == GenInputsAbstract.InputSelectionMode.CONSTANT_MINING && Randomness.weightedCoinFlip(GenInputsAbstract.p_const); if (!shouldOnlyIncludeConstantsFromDeclaringClass && packageLiterals != null) { Package pkg = declaringCls.getPackage(); if (pkg != null) { SimpleList<Sequence> sl = packageLiterals.getSequences(pkg, neededType); if (!sl.isEmpty()) { literals = (literals == null) ? sl : new ListOfLists<>(literals, sl); } } } } if (literals != null) { if (result == null) { result = literals; } else if (literals == null) { } else { result = new ListOfLists<>(result, literals); } } return result; }
Source:
public void testStateChangeWithUnknownPlugin() throws InterruptedException { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return null; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); app.getMySql().getComponent().setInstallerName( "unknown installer" ); processor.processMessage( new MsgCmdSetScopedInstance( app.getMySqlVm())); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getMySqlVm().getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getMySql().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getMySql(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getMySqlVm().getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getMySql().getStatus()); }

Target:
public void testStateChangeWithUnknownPlugin() { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return null; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); app.getMySql().getComponent().setInstallerName( "unknown installer" ); processor.processMessage( new MsgCmdSetScopedInstance( app.getMySqlVm())); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getMySqlVm().getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getMySql().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getMySql(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getMySqlVm().getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getMySql().getStatus()); }
Source:
public StreamingOutput getResponseStream() { return new StreamingOutput() { ObjectNode chunkNode; ArrayNode resultNode; ArrayNode rmdNode; @Override public void write(OutputStream os) throws IOException { ArrayNode entityData=(ArrayNode)streamResponse.getEntityData(); streamResponse.setEntityData(null); List<ResultMetadata> rmd=streamResponse.getResultMetadata(); streamResponse.setResultMetadata(null); Writer writer=new OutputStreamWriter(os); writer.write(streamResponse.toJson().toString()); writer.flush(); for(int i=0;i<entityData.size();i++) { ObjectNode chunkNode=JsonNodeFactory.instance.objectNode(); if(i==entityData.size()-1) { chunkNode.set("last",JsonNodeFactory.instance.booleanNode(true)); } chunkNode.set("processed",entityData.get(i)); if(i<rmd.size()) chunkNode.set("resultMetadata",rmd.get(i).toJson()); writer.write(chunkNode.toString()); } writer.flush(); } }; }

Target:
public StreamingOutput getResponseStream() { return new StreamingOutput() { ObjectNode chunkNode; ArrayNode resultNode; ArrayNode rmdNode; @Override public void write(OutputStream os) throws IOException { JsonNode entityDataNode=streamResponse.getEntityData(); streamResponse.setEntityData(null); ArrayNode entityData; if(entityDataNode instanceof ArrayNode) { entityData=(ArrayNode)entityDataNode; } else { entityData=JsonNodeFactory.instance.arrayNode(); if (entityDataNode instanceof ObjectNode) { entityData.add(entityDataNode); } } List<ResultMetadata> rmd=streamResponse.getResultMetadata(); streamResponse.setResultMetadata(null); Writer writer=new OutputStreamWriter(os); writer.write(streamResponse.toJson().toString()); writer.flush(); for(int i=0;i<entityData.size();i++) { ObjectNode chunkNode=JsonNodeFactory.instance.objectNode(); if(i==entityData.size()-1) { chunkNode.set("last",JsonNodeFactory.instance.booleanNode(true)); } chunkNode.set("processed",entityData.get(i)); if(i<rmd.size()) chunkNode.set("resultMetadata",rmd.get(i).toJson()); writer.write(chunkNode.toString()); } writer.flush(); } }; }
Source:
private void showVolumeProfiling() { if(getSelectedItem() == null) { return; } GlusterVolumeEntity selectedVolume = (GlusterVolumeEntity)getSelectedItem(); VolumeProfileStatisticsModel profileStatsModel = new VolumeProfileStatisticsModel(selectedVolume.getClusterId(), selectedVolume.getId(), selectedVolume.getName()); if(getWindow() == null) { setWindow(profileStatsModel); setHelpTag(HelpTag.volume_profile_statistics); setHashName("volume_profile_statistics"); } else { return; } profileStatsModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage()); UICommand closeProfilingStats = new UICommand("closeProfileStats", VolumeListModel.this); closeProfilingStats.setTitle(ConstantsManager.getInstance().getConstants().close()); closeProfilingStats.setIsCancel(true); profileStatsModel.getCommands().add(closeProfilingStats); profileStatsModel.queryBackend(true); }

Target:
private void showVolumeProfiling() { if(getSelectedItem() == null || getWindow()!= null) { return; } GlusterVolumeEntity selectedVolume = (GlusterVolumeEntity)getSelectedItem(); VolumeProfileStatisticsModel profileStatsModel = new VolumeProfileStatisticsModel(selectedVolume.getClusterId(), selectedVolume.getId(), selectedVolume.getName()); setWindow(profileStatsModel); setHelpTag(HelpTag.volume_profile_statistics); setHashName("volume_profile_statistics"); profileStatsModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage()); UICommand closeProfilingStats = new UICommand("closeProfileStats", VolumeListModel.this); closeProfilingStats.setTitle(ConstantsManager.getInstance().getConstants().close()); closeProfilingStats.setIsCancel(true); profileStatsModel.getCommands().add(closeProfilingStats); profileStatsModel.queryBackend(true); profileStatsModel.queryBackend(false); }
Source:
public XWikiDocument getDocument(DocumentReference docRef) throws XWikiException { Preconditions.checkNotNull(docRef); return getContext().getWiki().getDocument(docRef, getContext()); }

Target:
public XWikiDocument getDocument(DocumentReference docRef) throws DocumentLoadException, DocumentNotExistsException { checkNotNull(docRef); if (exists(docRef)) { return getDocumentInternal(docRef); } else { throw new DocumentNotExistsException("Doc does not exist " + toString(docRef)); } }
Source:
private NotificationHelper createFakeNotificationHelper(NotificationManagerCompat notificationManager, NotificationCompat.Builder builder) { NotificationHelper notificationHelper = mock(NotificationHelper.class); when(notificationHelper.getContext()).thenReturn(RuntimeEnvironment.application); when(notificationHelper.getNotificationManager()).thenReturn(notificationManager); when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelUtils.ChannelType.MISCELLANEOUS.getClass()))) .thenReturn(builder); return notificationHelper; }

Target:
private NotificationHelper createFakeNotificationHelper(NotificationManagerCompat notificationManager, NotificationCompat.Builder builder) { NotificationHelper notificationHelper = mock(NotificationHelper.class); when(notificationHelper.getContext()).thenReturn(RuntimeEnvironment.application); when(notificationHelper.getNotificationManager()).thenReturn(notificationManager); when(notificationHelper.createNotificationBuilder(any(Account.class), any(NotificationChannelUtils.ChannelType.class))) .thenReturn(builder); return notificationHelper; }
Source:
public void inlineRowMapper() { List<User> users = handle.createQuery("SELECT * FROM user ORDER BY id ASC") .map((rs, ctx) -> new User(rs.getInt("id"), rs.getString("name"))) .list(); assertThat(users).hasSize(4); assertThat(users.get(3).name).isEqualTo("Data"); }

Target:
public void inlineRowMapper() { List<User> users = handle.createQuery("SELECT id, name FROM user ORDER BY id ASC") .map((rs, ctx) -> new User(rs.getInt("id"), rs.getString("name"))) .list(); assertThat(users).hasSize(4); assertThat(users.get(3).name).isEqualTo("Data"); }
Source:
public void postCollectionSubmittersGroupCreateSubmittersGroupUnProcessablePermanent() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setPermanent(true); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); }

Target:
public void postCollectionSubmittersGroupCreateSubmittersGroupUnProcessablePermanent() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setPermanent(true); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isNoContent()); }
Source:
public void waitForRequiredBundles(String symbolicNamePrefix) { await("Waiting for bundles with prefix to be ready: " + symbolicNamePrefix) .atMost(FEATURES_AND_BUNDLES_TIMEOUT, TimeUnit.MILLISECONDS) .pollDelay(1, TimeUnit.SECONDS) .until( () -> Arrays.stream(bundleContext.getBundles()) .filter(bundle -> bundle.getSymbolicName().startsWith(symbolicNamePrefix)) .allMatch(this::isBundleReady)); }

Target:
public void waitForRequiredBundles(String symbolicNamePrefix) { await("Waiting for bundles with prefix to be ready: " + symbolicNamePrefix) .atMost(FEATURES_AND_BUNDLES_TIMEOUT, TimeUnit.MILLISECONDS) .pollDelay(1, TimeUnit.SECONDS) .until(() -> areBundlesReady(symbolicNamePrefix)); }
Source:
private void loadComment(Intent intent) { if (intent == null) { showErrorAndFinish(); return; } mLocalBlogId = intent.getIntExtra(ARG_LOCAL_BLOG_ID, 0); mCommentId = intent.getLongExtra(ARG_COMMENT_ID, 0); final String noteId = intent.getStringExtra(ARG_NOTE_ID); if (noteId == null) { mComment = CommentTable.getComment(mLocalBlogId, mCommentId); if (mComment == null) { showErrorAndFinish(); return; } configureViews(); } else { mNote = NotificationsTable.getNoteById(noteId); if (mNote != null) { requestFullCommentForNote(mNote); } } }

Target:
private void loadComment(Intent intent) { if (intent == null) { showErrorAndFinish(); return; } mLocalBlogId = intent.getIntExtra(ARG_LOCAL_BLOG_ID, 0); mCommentId = intent.getLongExtra(ARG_COMMENT_ID, 0); final String noteId = intent.getStringExtra(ARG_NOTE_ID); if (noteId == null) { mComment = CommentTable.getComment(mLocalBlogId, mCommentId); if (mComment == null) { showErrorAndFinish(); return; } configureViews(); } else { mNote = NotificationsTable.getNoteById(noteId); if (mNote != null) { requestFullCommentForNote(mNote); } else { showErrorAndFinish(); } } }
Source:
private void checkServer() { checkState(!this.client); }

Target:
private void checkServer() { checkState(ServerUtils.isCallingFromMainThread()); }
Source:
private long getAvailableScopedStorageSize(StoragePathProvider storagePathProvider) { String scopedStoragePath = storagePathProvider.getScopedExternalFilesDirPath(); if (scopedStoragePath.isEmpty()) { return 0; } StatFs stat = new StatFs(scopedStoragePath); long blockSize; long availableBlocks; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { blockSize = stat.getBlockSizeLong(); availableBlocks = stat.getAvailableBlocksLong(); } else { blockSize = stat.getBlockSize(); availableBlocks = stat.getAvailableBlocks(); } return availableBlocks * blockSize; }

Target:
private long getAvailableScopedStorageSize(StoragePathProvider storagePathProvider) { String scopedStoragePath = storagePathProvider.getScopedStorageRootDirPath(); if (scopedStoragePath.isEmpty()) { return 0; } StatFs stat = new StatFs(scopedStoragePath); return stat.getAvailableBlocksLong() * stat.getBlockSizeLong(); }
Source:
public void testTryGetDiskImageForNonPrivilegeUser() { DiskImage result = dao.getDiskImageByDiskAndImageIds(FixturesTool.IMAGE_GROUP_ID, FixturesTool.IMAGE_ID, UNPRIVILEGED_USER_ID, true); assertEquals(null, result); }

Target:
public void testTryGetDiskImageForNonPrivilegeUser() { DiskImage result = dao.getDiskImageByDiskAndImageIds(FixturesTool.IMAGE_GROUP_ID, FixturesTool.IMAGE_ID, UNPRIVILEGED_USER_ID, true); assertNull(null, result); }
Source:
public void testSetup() throws Exception { final FrameworkConfig config = PigRelBuilderTest.config().build(); converter = PigConverter.create(config); }

Target:
public void testSetup() throws Exception { Assume.assumeFalse("Skip: Pig/Hadoop tests do not work on Windows", System.getProperty("os.name").startsWith("Windows")); final FrameworkConfig config = PigRelBuilderTest.config().build(); converter = PigConverter.create(config); }
Source:
public FileSystemResource(Path path) { this.path = path; }

Target:
public FileSystemResource(Path path) { Args.notNull(path, "path"); this.path = path; }
Source:
public void errorPublisherTest(PublisherTestRun<T> body) throws Throwable { potentiallyPendingTest(createErrorStatePublisher(), body, "Skipping because no error state Publisher provided, and the test requires it. " + "Please implement PublisherVerification#createErrorStatePublisher to run this test."); }

Target:
public void errorPublisherTest(PublisherTestRun<T> body) throws Throwable { potentiallyPendingTest(createErrorStatePublisher(), body, SKIPPING_NO_ERROR_PUBLISHER_AVAILABLE); }
Source:
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (response.getStatusCode() == 429) { return true; } else { return backoffHandler.shouldRetryRequest(command, response); } }

Target:
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (response.getStatusCode() == TOO_MANY_REQUESTS) { return backoffHandler.shouldRetryRequest(command, response); } else { return false; } }
Source:
protected void onDraw(Canvas canvas) { canvas.save(); canvas.clipRect(0f, 0f, getWidth(), trackLineHeightPx, Region.Op.INTERSECT); canvas.drawRoundRect(trackLineBounds, trackLineCornerRadiusPx, trackLineCornerRadiusPx, trackBgPaint); canvas.restore(); super.onDraw(canvas); if (showTrackDrawable) { canvas.drawCircle(trackDrawableBounds.centerX(), trackDrawableBounds.centerY(), trackDrawableBounds.width() / 2f, trackBgPaint); } }

Target:
protected void onDraw(Canvas canvas) { drawTrackLineOn(canvas); super.onDraw(canvas); if (showTrackDrawable) { drawTrackDrawableOn(canvas); } }
Source:
public void testGetModelsAfter2000UsingFor() { List<String> models = ImperativeProgramming.getModelsAfter2000(cars); assertEquals(models, Arrays.asList("Avenger", "Wrangler", "Focus", "Cascada")); }

Target:
public void testGetModelsAfter2000UsingFor() { List<String> models = ImperativeProgramming.getModelsAfter2000(cars); assertEquals(Arrays.asList("Avenger", "Wrangler", "Focus", "Cascada"), models); }
Source:
public DatasetDescriptor create(String namespace, String name, DatasetDescriptor descriptor) { Compatibility.checkDatasetName(namespace, name); Compatibility.checkDescriptor(descriptor); String resolved = resolveNamespace( namespace, name, descriptor.getLocation()); if (resolved != null) { if (resolved.equals(namespace)) { throw new DatasetExistsException( "Metadata already exists for dataset: " + namespace + "." + name); } else { LOG.warn("Creating table {}.{} for {}: replaces default.{}", new Object[]{ namespace, name, pathForDataset(namespace, name), name}); Compatibility.checkUpdate(load(resolved, name), descriptor); } } LOG.info("Creating an external Hive table: {}.{}", namespace, name); DatasetDescriptor newDescriptor = descriptor; if (descriptor.getLocation() == null) { newDescriptor = new DatasetDescriptor.Builder(descriptor) .location(pathForDataset(namespace, name)) .build(); } if (descriptor.getSchemaUrl() == null) { Path managerPath = new Path(new Path(newDescriptor.getLocation()), SCHEMA_DIRECTORY); SchemaManager manager = SchemaManager.create(conf, managerPath); URI schemaUri = manager.writeSchema(descriptor.getSchema()); try { newDescriptor = new DatasetDescriptor.Builder(newDescriptor) .schemaUri(schemaUri) .build(); } catch (IOException e) { throw new DatasetIOException("Unable to load schema", e); } } FileSystemUtil.ensureLocationExists(newDescriptor, conf); Table table = HiveUtils.tableForDescriptor( namespace, name, newDescriptor, true ); getMetaStoreUtil().createTable(table); return newDescriptor; }

Target:
public DatasetDescriptor create(String namespace, String name, DatasetDescriptor descriptor) { Compatibility.checkDatasetName(namespace, name); Compatibility.checkDescriptor(descriptor); String resolved = resolveNamespace( namespace, name, descriptor.getLocation()); if (resolved != null) { if (resolved.equals(namespace)) { throw new DatasetExistsException( "Metadata already exists for dataset: " + namespace + "." + name); } else { LOG.warn("Creating table {}.{} for {}: replaces default.{}", new Object[]{ namespace, name, pathForDataset(namespace, name), name}); Compatibility.checkUpdate(load(resolved, name), descriptor); } } LOG.info("Creating an external Hive table: {}.{}", namespace, name); DatasetDescriptor newDescriptor = descriptor; if (descriptor.getLocation() == null) { newDescriptor = new DatasetDescriptor.Builder(descriptor) .location(pathForDataset(namespace, name)) .build(); } Path managerPath = new Path(new Path(newDescriptor.getLocation()), SCHEMA_DIRECTORY); SchemaManager manager = SchemaManager.create(conf, managerPath); URI managedSchemaUri = manager.writeSchema(descriptor.getSchema()); try { newDescriptor = new DatasetDescriptor.Builder(newDescriptor) .schemaUri(managedSchemaUri) .build(); } catch (IOException e) { throw new DatasetIOException("Unable to load schema", e); } FileSystemUtil.ensureLocationExists(newDescriptor, conf); Table table = HiveUtils.tableForDescriptor( namespace, name, newDescriptor, true ); getMetaStoreUtil().createTable(table); return newDescriptor; }
Source:
public void getExportedResourcesTest() throws IOException { File jar1 = new File(resourcesFolder, JAR_1); File jar2 = new File(resourcesFolder, JAR_2); File jar3Folder = new File(resourcesFolder, JAR_3_LOCATION); File jar3 = new File(jar3Folder, JAR_3); String configFileName = "config.xml"; File config = new File(muleFolder, configFileName); File hiddenFile = new File(munitFolder, HIDDEN_FILE); if (System.getProperty("os.name").toLowerCase().equals("win")) { Files.setAttribute(hiddenFile.toPath(), "dos:hidden", true); } jar1.createNewFile(); jar2.createNewFile(); jar3Folder.mkdirs(); jar3.createNewFile(); config.createNewFile(); hiddenFile.createNewFile(); List<String> actualExportedResources = resolver.getExportedResources(); assertThat("Exported resources does not contain all expected elements", actualExportedResources, containsInAnyOrder(JAR_1, JAR_2, JAR_3_LOCATION + File.separator + JAR_3, configFileName)); assertThat("Configs contain an unexpected elements", actualExportedResources.contains(hiddenFile), is(false)); assertThat("Exported resources contains more elements than expected", actualExportedResources.size(), equalTo(4)); }

Target:
public void getExportedResourcesTest() throws IOException { File jar1 = new File(resourcesFolder, JAR_1); File jar2 = new File(resourcesFolder, JAR_2); File jar3Folder = new File(resourcesFolder, JAR_3_LOCATION); File jar3 = new File(jar3Folder, JAR_3); String configFileName = "config.xml"; File config = new File(muleFolder, configFileName); File hiddenFile = new File(munitFolder, HIDDEN_FILE); if (System.getProperty("os.name").toLowerCase().equals("win")) { Files.setAttribute(hiddenFile.toPath(), "dos:hidden", true); } jar1.createNewFile(); jar2.createNewFile(); jar3Folder.mkdirs(); jar3.createNewFile(); config.createNewFile(); hiddenFile.createNewFile(); List<String> actualExportedResources = resolver.getExportedResources(); assertThat("Exported resources does not contain all expected elements", actualExportedResources, containsInAnyOrder(JAR_1, JAR_2, JAR_3_LOCATION + separator + JAR_3, configFileName)); assertThat("Configs contain an unexpected elements", actualExportedResources.contains(hiddenFile), is(false)); assertThat("Exported resources contains more elements than expected", actualExportedResources.size(), equalTo(4)); }
Source:
public static XMLGregorianCalendar getXMLGregorianCalendarFrom(Date date) { if (date != null) { GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTime(date); try { XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar); LOG.info("{}-{}-{} {}:{}:{} {}", cal.getMonth(), cal.getDay(), cal.getYear(), cal.getHour(), cal.getMinute(), cal.getSecond(), cal.getTimezone()); return cal; } catch (DatatypeConfigurationException ex) { LOG.error("Unable to convert date ", ex.getLocalizedMessage(), ex); } } return null; }

Target:
public static XMLGregorianCalendar getXMLGregorianCalendarFrom(Date date) { if (date != null) { GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTime(date); try { XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar); LOG.trace("{}-{}-{} {}:{}:{} {}", cal.getMonth(), cal.getDay(), cal.getYear(), cal.getHour(), cal.getMinute(), cal.getSecond(), cal.getTimezone()); return cal; } catch (DatatypeConfigurationException ex) { LOG.error("Unable to convert date ", ex.getLocalizedMessage(), ex); } } return null; }
Source:
private List<String> readDataFromFile() { List<String> wordsFromFile = new ArrayList<String>(); BufferedReader br = null; try { br = new BufferedReader(new FileReader(dataPath)); String line; while ((line = br.readLine()) != null) { wordsFromFile.add(line); } } catch(IOException ex) { ex.printStackTrace(); } finally { try { if(br != null) br.close(); } catch (IOException e) { e.printStackTrace(); } } return wordsFromFile; }

Target:
private List<String> readDataFromFile() { List<String> wordsFromFile = new ArrayList<String>(); BufferedReader br = null; try { br = new BufferedReader(new FileReader(dataPath)); String line; while ((line = br.readLine()) != null) { wordsFromFile.add(line); } } catch(IOException ex) { log.error("Error is thrown during file reading!", ex); throw new RuntimeException(ex); } finally { try { if(br != null) br.close(); } catch (IOException ex) { log.error("Error is thrown during closing file stream!", ex); throw new RuntimeException(ex); } } return wordsFromFile; }
Source:
private ArrayList<String> retrieveActiveComponentsList(String command) throws IOException { writeInputCommand(command); try { readResponseToFindActiveComponents(); } catch (SocketTimeoutException e) { log.error("Socket timeout Exception " + e); } return arrList; }

Target:
private ArrayList<String> retrieveActiveComponentsList(String command) throws CarbonToolsIntegrationTestException { writeInputCommand(command); readResponseToFindActiveComponents(); return arrList; }
Source:
void should_fail_if_throwable_has_no_cause() { ThrowableAssert.ThrowingCallable code = () -> { Throwable throwable = new Throwable("top level message"); new ThrowableAssertAlternative<>(throwable) .havingCause(); }; AssertionsUtil.assertThatAssertionErrorIsThrownBy(code).withMessage("expecting java.lang.Throwable: top level message to have a cause but it did not"); }

Target:
void should_fail_if_throwable_has_no_cause() { Throwable throwable = new Throwable("top level message"); ThrowableAssertAlternative<Throwable> taa = new ThrowableAssertAlternative<>(throwable); AssertionError error = expectAssertionError(taa::havingCause); assertThat(error).hasMessage(shouldHaveCause(throwable).create()); }
Source:
public <T extends Settings> T getSettings(Project project, ConnectorType connectorType, Class<T> settingsClass) { notNull(project, "project"); notNull(connectorType, "connectorType"); try { return restTemplate.getForObject(Settings.URL, settingsClass, project.getId(), connectorType.getName()); } catch (GoodDataRestException | RestClientException e) { throw new ConnectorException("Unable to get " + connectorType + " integration settings", e); } }

Target:
public <T extends Settings> T getSettings(Project project, ConnectorType connectorType, Class<T> settingsClass) { notNull(project, "project"); notNull(connectorType, "connectorType"); notNull(settingsClass, "settingsClass"); try { return restTemplate.getForObject(Settings.URL, settingsClass, project.getId(), connectorType.getName()); } catch (GoodDataRestException | RestClientException e) { throw new ConnectorException("Unable to get " + connectorType + " integration settings", e); } }
Source:
public OpenVRProvider() { for (int c = 0; c < 2; c++) { controllerDeviceIndex[c] = -1; controllerStateReference[c] = new VRControllerState_t(); inputStateRefernceArray[c] = new VRControllerState_t.ByReference(); inputStateRefernceArray[c].setAutoRead(false); inputStateRefernceArray[c].setAutoWrite(false); inputStateRefernceArray[c].setAutoSynch(false); texType[c] = new Texture_t(); } }

Target:
public OpenVRProvider() { for (int handIndex = 0; handIndex < 2; handIndex++) { controllerDeviceIndex[handIndex] = -1; controllerStateReference[handIndex] = new VRControllerState_t(); inputStateRefernceArray[handIndex] = new VRControllerState_t.ByReference(); inputStateRefernceArray[handIndex].setAutoRead(false); inputStateRefernceArray[handIndex].setAutoWrite(false); inputStateRefernceArray[handIndex].setAutoSynch(false); texType[handIndex] = new Texture_t(); } }
Source:
public void testStatelessCepQuery() { final MISTCepStatelessQuery exampleQuery = MISTCepStatelessQueryBuilder.newBuilder() .input(exampleCepInput) .condition(Conditions.gt("Temperature", 25)) .action(CepAction.newAction(CepActionType.TEXT_WRITE, exampleCepSink, "Hot")) .condition(Conditions.lt("Temperature", 10)) .action(CepAction.newAction(CepActionType.TEXT_WRITE, exampleCepSink, "Cold")) .build(); final List<CepStatelessRule> expectedRules = new ArrayList<CepStatelessRule>() {{ add(new CepStatelessRule(Conditions.gt("Temperature", 25), CepAction.newAction(CepActionType.TEXT_WRITE, exampleCepSink, "Hot"))); add(new CepStatelessRule(Conditions.lt("Temperature", 10), CepAction.newAction(CepActionType.TEXT_WRITE, exampleCepSink, "Cold"))); }}; Assert.assertEquals(expectedRules, exampleQuery.getCepStatelessRules()); }

Target:
public void testStatelessCepQuery() { final MISTCepStatelessQuery exampleQuery = new MISTCepStatelessQuery.Builder() .input(exampleCepInput) .addStatelessRule(new CepStatelessRule.Builder() .setCondition(ComparisonCondition.gt("Temperature", 25)) .setAction(new CepAction.Builder() .setActionType(CepActionType.TEXT_WRITE) .setCepSink(exampleCepSink) .setParams("Hot") .build()) .build() ) .addStatelessRule(new CepStatelessRule.Builder() .setCondition(ComparisonCondition.lt("Temperature", 10)) .setAction(new CepAction.Builder() .setActionType(CepActionType.TEXT_WRITE) .setCepSink(exampleCepSink) .setParams("Cold") .build()) .build() ) .build(); Assert.assertEquals(exampleCepInput, exampleQuery.getCepInput()); final List<CepStatelessRule> statelessRules = exampleQuery.getCepStatelessRules(); Assert.assertEquals(statelessRules.size(), 2); final CepStatelessRule rule0 = statelessRules.get(0); Assert.assertEquals(rule0.getCondition(), ComparisonCondition.gt("Temperature", 25)); Assert.assertEquals(rule0.getAction(), new CepAction.Builder() .setActionType(CepActionType.TEXT_WRITE) .setCepSink(exampleCepSink) .setParams("Hot") .build()); final CepStatelessRule rule1 = statelessRules.get(1); Assert.assertEquals(rule1.getCondition(), ComparisonCondition.lt("Temperature", 10)); Assert.assertEquals(rule1.getAction(), new CepAction.Builder() .setActionType(CepActionType.TEXT_WRITE) .setCepSink(exampleCepSink) .setParams("Cold") .build()); }
Source:
public void test_reconnection() throws Exception { long count = readTopology().clientStream() .filter(client -> client.getName() .startsWith("Ehcache:") && client.isManageable() && client.getTags() .containsAll(Arrays.asList("webapp-1", "server-node-1"))) .count(); Assert.assertThat(count, Matchers.equalTo(1L)); String productInstanceId = getProductInstanceId(); setDelay(6000, proxies); Thread.sleep(6000); setDelay(0L, proxies); Cache<String, String> cache = cacheManager.getCache("dedicated-cache-1", String.class, String.class); String initiate_reconnect = cache.get("initiate reconnect"); assertThat(initiate_reconnect, Matchers.nullValue()); while (!Thread.currentThread().isInterrupted()) { count = readTopology().clientStream() .filter(client -> client.getName() .startsWith("Ehcache:") && client.isManageable() && client.getTags() .containsAll(Arrays.asList("webapp-1", "server-node-1"))) .count(); if (count == 1) { break; } else { Thread.sleep(1_000); } } if (Thread.currentThread().isInterrupted()) { fail(); } else { assertThat(getProductInstanceId(), equalTo(productInstanceId)); } }

Target:
public void test_reconnection() throws Exception { long count = readTopology().clientStream() .filter(client -> client.getName() .startsWith("Ehcache:") && client.isManageable() && client.getTags() .containsAll(Arrays.asList("webapp-1", "server-node-1"))) .count(); Assert.assertThat(count, Matchers.equalTo(1L)); String instanceId = getInstanceId(); setDelay(6000, proxies); Thread.sleep(6000); setDelay(0L, proxies); Cache<String, String> cache = cacheManager.getCache("dedicated-cache-1", String.class, String.class); String initiate_reconnect = cache.get("initiate reconnect"); assertThat(initiate_reconnect, Matchers.nullValue()); while (!Thread.currentThread().isInterrupted()) { count = readTopology().clientStream() .filter(client -> client.getName() .startsWith("Ehcache:") && client.isManageable() && client.getTags() .containsAll(Arrays.asList("webapp-1", "server-node-1"))) .count(); if (count == 1) { break; } else { Thread.sleep(1_000); } } assertThat(Thread.currentThread().isInterrupted(), is(false)); assertThat(getInstanceId(), equalTo(instanceId)); }
Source:
public void stopLocationUpdates() { if (!isMonitoringLocation() || !googleApiClient.isConnected()) { return; } fusedLocationProviderApi.removeLocationUpdates(googleApiClient, locationListener); locationListener = null; }

Target:
public void stopLocationUpdates() { if (!isMonitoringLocation()) { return; } if (googleApiClient.isConnected()) { fusedLocationProviderApi.removeLocationUpdates(googleApiClient, locationListener); } locationListener = null; }