auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void logRenamedEntity() { abstract class RenameCommand extends CommandBaseDummy implements RenamedEntityInfoProvider { private static final long serialVersionUID = 1L; protected RenameCommand(VdcActionParametersBase params) { super(params); } } RenameCommand command = Mockito.mock(RenameCommand.class); Mockito.when(command.getEntityOldName()).thenReturn(null); Mockito.when(command.getEntityNewName()).thenReturn(null); Mockito.doCallRealMethod().when(command).logRenamedEntity(); command.logRenamedEntity(); Mockito.when(command.getEntityOldName()).thenReturn("foo"); Mockito.when(command.getEntityNewName()).thenReturn("bar"); command.logRenamedEntity(); Mockito.when(command.getEntityOldName()).thenReturn(null); Mockito.when(command.getEntityNewName()).thenReturn("bar"); command.logRenamedEntity(); Mockito.when(command.getEntityOldName()).thenReturn("foo"); Mockito.when(command.getEntityNewName()).thenReturn(null); command.logRenamedEntity(); }

Target:
public void logRenamedEntity() { abstract class RenameCommand extends CommandBaseDummy implements RenamedEntityInfoProvider { private static final long serialVersionUID = 1L; protected RenameCommand(VdcActionParametersBase params) { super(params); } } RenameCommand command = mock(RenameCommand.class); when(command.getEntityOldName()).thenReturn(null); when(command.getEntityNewName()).thenReturn(null); doCallRealMethod().when(command).logRenamedEntity(); command.logRenamedEntity(); when(command.getEntityOldName()).thenReturn("foo"); when(command.getEntityNewName()).thenReturn("bar"); command.logRenamedEntity(); when(command.getEntityOldName()).thenReturn(null); when(command.getEntityNewName()).thenReturn("bar"); command.logRenamedEntity(); when(command.getEntityOldName()).thenReturn("foo"); when(command.getEntityNewName()).thenReturn(null); command.logRenamedEntity(); }
Source:
public VideoInfo getPreferredVideoInfo() { if (mobileLow != null && URLUtil.isNetworkUrl(mobileLow.url) && VideoUtil.isValidVideoUrl(mobileLow.url)) { return mobileLow; } if (mobileHigh != null && URLUtil.isNetworkUrl(mobileHigh.url) && VideoUtil.isValidVideoUrl(mobileHigh.url)) { return mobileHigh; } if (fallback != null && URLUtil.isNetworkUrl(fallback.url)) { final boolean isUsingVideoPipeline = new Config(MainApplication.instance()).isUsingVideoPipeline(); if (isUsingVideoPipeline && VideoUtil.isM3U8FormatVideo(fallback.url)) { return fallback; } if (!isUsingVideoPipeline && VideoUtil.isValidVideoUrl(fallback.url)) { return fallback; } } return null; }

Target:
public VideoInfo getPreferredVideoInfo() { if (isPreferredVideoInfo(mobileLow)) { return mobileLow; } if (isPreferredVideoInfo(mobileHigh)) { return mobileHigh; } if (new Config(MainApplication.instance()).isUsingVideoPipeline()) { if (fallback != null && URLUtil.isNetworkUrl(fallback.url) && VideoUtil.isSupportedVideoFormat(fallback.url, AppConstants.VIDEO_FORMAT_M3U8)) { return fallback; } } else { if (isPreferredVideoInfo(fallback)) { return fallback; } } return null; }
Source:
private void publishPost() { if (!isFinishing() && NetworkUtils.checkConnection(this)) { if (!mPost.isLocalDraft()) { Map<String, Object> properties = new HashMap<>(); Configuration configuration = WordPress.getContext().getResources().getConfiguration(); properties.put("hardware_keyboard", configuration.keyboard != Configuration.KEYBOARD_NOKEYS); AnalyticsUtils.trackWithBlogDetails( AnalyticsTracker.Stat.EDITOR_UPDATED_POST, WordPress.getBlog(mPost.getLocalTableBlogId()), properties ); } if (mPost.getStatusEnum() == PostStatus.DRAFT) { mPost.setPostStatus(PostStatus.toString(PostStatus.PUBLISHED)); } PostUploadService.addPostToUpload(mPost); startService(new Intent(this, PostUploadService.class)); } }

Target:
private void publishPost() { if (!isFinishing() && NetworkUtils.checkConnection(this)) { if (!mPost.isLocalDraft()) { AnalyticsUtils.trackWithBlogDetails( AnalyticsTracker.Stat.EDITOR_UPDATED_POST, WordPress.getBlog(mPost.getLocalTableBlogId()) ); } if (mPost.getStatusEnum() == PostStatus.DRAFT) { mPost.setPostStatus(PostStatus.toString(PostStatus.PUBLISHED)); } PostUploadService.addPostToUpload(mPost); startService(new Intent(this, PostUploadService.class)); } }
Source:
public void testScheduleRequestParameters() { String param_key = "param_key"; String param_value = "param_value"; Date dueOnDate = new Date(); doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { assertTrue(invocationOnMock.getArguments()[0].equals(serverTemplateId)); assertTrue(invocationOnMock.getArguments()[1].equals(JOB_TYPE)); assertTrue(invocationOnMock.getArguments()[2].equals(dueOnDate)); final HashMap<String, String> ctxValues = (HashMap) invocationOnMock.getArguments()[3]; assertTrue(ctxValues.get(RequestDataSetConstants.COLUMN_BUSINESSKEY).equals(JOB_NAME)); assertTrue(ctxValues.get(RequestDataSetConstants.COLUMN_RETRIES).equals(String.valueOf(JOB_RETRIES))); assertTrue(ctxValues.get(param_key).equals(String.valueOf(param_value))); return null; } }).when(executorServicesMock).scheduleRequest(anyString(), anyString(), any(Date.class), any(Map.class)); presenter.createJob(JOB_NAME, dueOnDate, JOB_TYPE, JOB_RETRIES, Arrays.asList(new RequestParameterSummary(param_key, param_value))); verify(executorServicesMock).scheduleRequest(anyString(), anyString(), any(Date.class), any(HashMap.class)); }

Target:
public void testScheduleRequestParameters() { String param_key = "param_key"; String param_value = "param_value"; Date dueOnDate = new Date(); final SoftAssertions softly = new SoftAssertions(); doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { softly.assertThat(invocationOnMock.getArguments()[0]).isEqualTo(serverTemplateId); softly.assertThat(invocationOnMock.getArguments()[1]).isEqualTo(JOB_TYPE); softly.assertThat(invocationOnMock.getArguments()[2]).isEqualTo(dueOnDate); final HashMap<String, String> ctxValues = (HashMap) invocationOnMock.getArguments()[3]; softly.assertThat(ctxValues.get(RequestDataSetConstants.COLUMN_BUSINESSKEY).equals(JOB_NAME)); softly.assertThat(ctxValues.get(RequestDataSetConstants.COLUMN_RETRIES).equals(String.valueOf(JOB_RETRIES))); softly.assertThat(ctxValues.get(param_key).equals(String.valueOf(param_value))); return null; } }).when(executorServicesMock).scheduleRequest(anyString(), anyString(), any(Date.class), any(Map.class)); presenter.createJob(JOB_NAME, dueOnDate, JOB_TYPE, JOB_RETRIES, Arrays.asList(new RequestParameterSummary(param_key, param_value))); softly.assertAll(); verify(executorServicesMock).scheduleRequest(anyString(), anyString(), any(Date.class), any(HashMap.class)); }
Source:
public void recreateIndex() { deleteIndex(); final Client client = this.getClient(); final InputStream mappings = Thread.currentThread().getContextClassLoader().getResourceAsStream("mappings.json"); final InputStream index_settings = Thread.currentThread().getContextClassLoader().getResourceAsStream("index_settings.json"); try { String mappingsString = IOUtils.toString(mappings); JSONObject mappingsJSON = new JSONObject(mappingsString); mappingsJSON = addLangsToMapping(mappingsJSON); client.admin().indices().prepareCreate("photon").setSettings(IOUtils.toString(index_settings)).execute().actionGet(); client.admin().indices().preparePutMapping("photon").setType("place").setSource(mappingsJSON.toString()).execute().actionGet(); } catch(IOException e) { log.error("cannot setup index, elastic search config files not readable", e); } }

Target:
public void recreateIndex() throws IOException { deleteIndex(); final Client client = this.getClient(); final InputStream mappings = Thread.currentThread().getContextClassLoader().getResourceAsStream("mappings.json"); final InputStream index_settings = Thread.currentThread().getContextClassLoader().getResourceAsStream("index_settings.json"); String mappingsString = IOUtils.toString(mappings); JSONObject mappingsJSON = new JSONObject(mappingsString); mappingsJSON = addLangsToMapping(mappingsJSON); client.admin().indices().prepareCreate("photon").setSettings(IOUtils.toString(index_settings)).execute().actionGet(); client.admin().indices().preparePutMapping("photon").setType("place").setSource(mappingsJSON.toString()).execute().actionGet(); }
Source:
@Override public Pair<RelTraitSet, List<RelTraitSet>> deriveTraits( final RelTraitSet childTraits, final int childId) { assert childId == 0; RelCollation collation = childTraits.getCollation(); if (collation == null || collation == RelCollations.EMPTY || joinType == JoinRelType.FULL || joinType == JoinRelType.RIGHT) { return null; } return Pair.of( getTraitSet().replace(collation), ImmutableList.of(childTraits, right.getTraitSet())); }

Target:
@Override public Pair<RelTraitSet, List<RelTraitSet>> deriveTraits( final RelTraitSet childTraits, final int childId) { assert childId == 0; RelCollation collation = childTraits.getCollation(); if (collation == null || collation == RelCollations.EMPTY) { return null; } RelTraitSet derivedTraits = getTraitSet().replace(collation); return Pair.of( derivedTraits, ImmutableList.of(derivedTraits, right.getTraitSet())); }
Source:
private Set<SignatureAlgorithm> fetchSignatureVerificationAlgorithms(List<JWK> jwks) { if (jwks == null) { return Collections.emptySet(); } return jwks.stream().map(jwk -> { Algorithm algorithm = jwk.getAlgorithm(); if (algorithm != null) { return SignatureAlgorithm.from(algorithm.getName()); } return null; }).filter(Objects::nonNull).collect(Collectors.toSet()); }

Target:
private Set<SignatureAlgorithm> fetchSignatureVerificationAlgorithms(List<JWK> jwks) { if (jwks == null) { return Collections.emptySet(); } Set<SignatureAlgorithm> algorithms = new HashSet<>(); for (JWK jwk : jwks) { Algorithm algorithm = jwk.getAlgorithm(); if (algorithm != null) { SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.from(algorithm.getName()); if (signatureAlgorithm != null) { algorithms.add(signatureAlgorithm); } } } return algorithms; }
Source:
public void init() throws IdentityOAuth2Exception { super.init(); Thread thread = Thread.currentThread(); ClassLoader loader = thread.getContextClassLoader(); thread.setContextClassLoader(this.getClass().getClassLoader()); try { DefaultBootstrap.bootstrap(); } catch (ConfigurationException e) { log.error(e); throw new IdentityOAuth2Exception("Error in bootstrapping the OpenSAML2 library"); } finally { thread.setContextClassLoader(loader); } profileValidator = new SAMLSignatureProfileValidator(); }

Target:
public void init() throws IdentityOAuth2Exception { super.init(); Thread thread = Thread.currentThread(); ClassLoader loader = thread.getContextClassLoader(); thread.setContextClassLoader(this.getClass().getClassLoader()); try { DefaultBootstrap.bootstrap(); } catch (ConfigurationException e) { log.error("Error in bootstrapping the OpenSAML2 library", e); throw new IdentityOAuth2Exception("Error in bootstrapping the OpenSAML2 library"); } finally { thread.setContextClassLoader(loader); } profileValidator = new SAMLSignatureProfileValidator(); }
Source:
public boolean equals(Object o) { if (!(o instanceof CustomMethods)) { return false; } CustomMethods other = (CustomMethods) o; return other.name.equals(name); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof CustomMethods)) return false; CustomMethods that = (CustomMethods) o; return name != null ? name.equals(that.name) : that.name == null; }
Source:
public void configure() { super.configure(); final HTTPClientPolicy httpClientPolicy = getHTTPClientPolicy(); final BindingProvider bindingProvider = (BindingProvider) getPort(); httpClientPolicy.setConnection(null); if (hasKeepAliveForConnection()) { httpClientPolicy.setConnection(ConnectionType.KEEP_ALIVE); } bindingProvider.getRequestContext().remove(NhincConstants.CUSTOM_HTTP_HEADERS); HashMap<String, String> httpHeaders = getCustomHeaders(); if (httpHeaders != null && !httpHeaders.isEmpty()) { bindingProvider.getRequestContext().put(NhincConstants.CUSTOM_HTTP_HEADERS, httpHeaders); } }

Target:
public void configure() { super.configure(); final HTTPClientPolicy httpClientPolicy = getHTTPClientPolicy(); final BindingProvider bindingProvider = (BindingProvider) getPort(); httpClientPolicy.setConnection(null); if (hasKeepAliveForConnection()) { httpClientPolicy.setConnection(ConnectionType.KEEP_ALIVE); } bindingProvider.getRequestContext().remove(NhincConstants.CUSTOM_HTTP_HEADERS); HashMap<String, String> httpHeaders = getCustomHeaders(); if (MapUtils.isNotEmpty(httpHeaders)) { bindingProvider.getRequestContext().put(NhincConstants.CUSTOM_HTTP_HEADERS, httpHeaders); } }
Source:
private LauncherDiscoveryListener getLauncherDiscoveryListener(ConfigurationParameters configurationParameters) { LauncherDiscoveryListener defaultDiscoveryListener = configurationParameters.get( DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME) .map(value -> LauncherDiscoveryListeners.fromConfigurationParameter( DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME, value)) .orElseGet(LauncherDiscoveryListeners::abortOnFailure); List<LauncherDiscoveryListener> serviceLoaderListeners = configurationParameters.getBoolean( DISCOVERY_LISTENERS_AUTODETECTION_ENABLED_PROPERTY_NAME).filter(p -> p).map( p -> StreamSupport.stream( new ServiceLoaderLauncherDiscoveryListenerRegistry().loadListeners().spliterator(), false).collect( Collectors.<LauncherDiscoveryListener> toList())).orElse(Collections.emptyList()); if (discoveryListeners.isEmpty() && serviceLoaderListeners.isEmpty()) { return defaultDiscoveryListener; } if (discoveryListeners.contains(defaultDiscoveryListener) && serviceLoaderListeners.isEmpty()) { return LauncherDiscoveryListeners.composite(discoveryListeners); } List<LauncherDiscoveryListener> allDiscoveryListeners = new ArrayList<>(discoveryListeners); allDiscoveryListeners.addAll(serviceLoaderListeners); if (!allDiscoveryListeners.contains(defaultDiscoveryListener)) { allDiscoveryListeners.add(defaultDiscoveryListener); } return LauncherDiscoveryListeners.composite(allDiscoveryListeners); }

Target:
private LauncherDiscoveryListener getLauncherDiscoveryListener(ConfigurationParameters configurationParameters) { LauncherDiscoveryListener defaultDiscoveryListener = configurationParameters.get( DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME) .map(value -> LauncherDiscoveryListeners.fromConfigurationParameter( DEFAULT_DISCOVERY_LISTENER_CONFIGURATION_PROPERTY_NAME, value)) .orElseGet(LauncherDiscoveryListeners::abortOnFailure); if (discoveryListeners.isEmpty()) { return defaultDiscoveryListener; } if (discoveryListeners.contains(defaultDiscoveryListener)) { return LauncherDiscoveryListeners.composite(discoveryListeners); } List<LauncherDiscoveryListener> allDiscoveryListeners = new ArrayList<>(discoveryListeners.size() + 1); allDiscoveryListeners.addAll(discoveryListeners); allDiscoveryListeners.add(defaultDiscoveryListener); return LauncherDiscoveryListeners.composite(allDiscoveryListeners); }
Source:
public FlinkPod decorateFlinkPod(FlinkPod flinkPod) { final Pod basicPod = new PodBuilder(flinkPod.getPod()) .withApiVersion(API_VERSION) .editOrNewMetadata() .withLabels(kubernetesJobManagerParameters.getLabels()) .withAnnotations(kubernetesJobManagerParameters.getAnnotations()) .withOwnerReferences(kubernetesJobManagerParameters.getOwnerReference().stream() .map(e -> KubernetesOwnerReference.fromMap(e).getInternalResource()) .collect(Collectors.toList())) .endMetadata() .editOrNewSpec() .withServiceAccountName(kubernetesJobManagerParameters.getServiceAccount()) .withImagePullSecrets(kubernetesJobManagerParameters.getImagePullSecrets()) .withNodeSelector(kubernetesJobManagerParameters.getNodeSelector()) .withTolerations(kubernetesJobManagerParameters.getTolerations().stream() .map(e -> KubernetesToleration.fromMap(e).getInternalResource()) .collect(Collectors.toList())) .endSpec() .build(); final Container basicMainContainer = decorateMainContainer(flinkPod.getMainContainer()); return new FlinkPod.Builder(flinkPod) .withPod(basicPod) .withMainContainer(basicMainContainer) .build(); }

Target:
public FlinkPod decorateFlinkPod(FlinkPod flinkPod) { final Pod basicPod = new PodBuilder(flinkPod.getPod()) .withApiVersion(API_VERSION) .editOrNewMetadata() .withLabels(kubernetesJobManagerParameters.getLabels()) .withAnnotations(kubernetesJobManagerParameters.getAnnotations()) .endMetadata() .editOrNewSpec() .withServiceAccountName(kubernetesJobManagerParameters.getServiceAccount()) .withImagePullSecrets(kubernetesJobManagerParameters.getImagePullSecrets()) .withNodeSelector(kubernetesJobManagerParameters.getNodeSelector()) .withTolerations(kubernetesJobManagerParameters.getTolerations().stream() .map(e -> KubernetesToleration.fromMap(e).getInternalResource()) .collect(Collectors.toList())) .endSpec() .build(); final Container basicMainContainer = decorateMainContainer(flinkPod.getMainContainer()); return new FlinkPod.Builder(flinkPod) .withPod(basicPod) .withMainContainer(basicMainContainer) .build(); }
Source:
private String getMessage(int expectedPreviousSaveNumber, int previousSaveNumber) { StringBuilder message = new StringBuilder(); message.append("Expected previous saved id was: "); message.append(expectedPreviousSaveNumber); message.append("\nPrevious saved id is: "); message.append(previousSaveNumber); message.append("\n"); return message.toString(); }

Target:
private String getMessage(int expectedPreviousSaveNumber, int previousSaveNumber) { StringBuffer message = new StringBuffer(); message.append("Expected previous saved id was: "); message.append(expectedPreviousSaveNumber); message.append("\nPrevious saved id is: "); message.append(previousSaveNumber); message.append("\n"); return message.toString(); }
Source:
public Builder() { super(DefaultReport::new); _schedule = NeverSchedule.getInstance(); _groups = Collections.emptySet(); }

Target:
public Builder() { super(DefaultReport::new); }
Source:
public void setUp() { cmd = spy(new ReconstructMasterDomainCommand<>(new ReconstructMasterParameters())); storagePoolIsoMap = new StoragePoolIsoMap(storageDomainId, storagePoolId, StorageDomainStatus.Active); StorageDomain storageDomain = new StorageDomain(); storageDomain.setStoragePoolIsoMapData(storagePoolIsoMap); StoragePoolIsoMapDAO storagePoolIsoMapDao = mock(StoragePoolIsoMapDAO.class); doReturn(Collections.singletonList(storagePoolIsoMap)).when(storagePoolIsoMapDao).getAllForStoragePool(storagePoolId); StoragePool storagePool = new StoragePool(); storagePool.setId(storagePoolId); StoragePoolValidator storagePoolValidator = spy(new StoragePoolValidator(storagePool)); doReturn(storagePoolIsoMapDao).when(storagePoolValidator).getStoragePoolIsoMapDao(); doReturn(storageDomain).when(cmd).getStorageDomain(); doReturn(storagePool).when(cmd).getStoragePool(); doReturn(storagePoolValidator).when(cmd).createStoragePoolValidator(); }

Target:
public void setUp() { cmd = spy(new ReconstructMasterDomainCommand<>(new ReconstructMasterParameters())); masterDomainIsoMap = new StoragePoolIsoMap(masterStorageDomainId, storagePoolId, StorageDomainStatus.Active); regularDomainIsoMap = new StoragePoolIsoMap(regularStorageDomainId, storagePoolId, StorageDomainStatus.Active); StorageDomain masterStorageDomain = new StorageDomain(); masterStorageDomain.setStoragePoolIsoMapData(masterDomainIsoMap); doReturn(Arrays.asList(masterDomainIsoMap, regularDomainIsoMap)).when(storagePoolIsoMapDao).getAllForStoragePool(storagePoolId); StoragePool storagePool = new StoragePool(); storagePool.setId(storagePoolId); StoragePoolValidator storagePoolValidator = spy(new StoragePoolValidator(storagePool)); doReturn(storagePoolIsoMapDao).when(storagePoolValidator).getStoragePoolIsoMapDao(); doReturn(masterStorageDomain).when(cmd).getStorageDomain(); doReturn(storagePool).when(cmd).getStoragePool(); doReturn(storagePoolValidator).when(cmd).createStoragePoolValidator(); }
Source:
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { long deliveryTag = envelope.getDeliveryTag(); AmqpAcknowledgementHandler ackHandler = createAcknowledgementHandler( getChannel(), consumerTag, deliveryTag, amqpBrokerConfig.isRequeueRejectedMessages()); try { Charset charset = amqpBrokerConfig.getCharset(); String bodyStr = new String(body, charset); LOG.debug(String.format("[consumer tag: %s] Message consumed from broker: %s", consumerTag, bodyStr)); try { consumerThreadPool.submit(new AmqpMessageProcessingTask(consumerTag, bodyStr, msgHandler, ackHandler)); LOG.debug(String.format("[consumer tag: %s] Message has been put in the processing queue: %s.", consumerTag, bodyStr)); } catch (Exception e) { LOG.error(String.format("[consumer tag: %s] Couldn't put message in the processing queue: %s.", consumerTag, bodyStr), e); throw e; } } catch (Exception e) { LOG.error(String.format("[consumer tag: %s] Got exception while processing incoming message. About to send AMQP reject...", consumerTag), e); ackHandler.autoReject(); } }

Target:
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { long deliveryTag = envelope.getDeliveryTag(); AmqpAcknowledgementHandler ackHandler = createAcknowledgementHandler( getChannel(), consumerTag, deliveryTag, envelope.isRedeliver()); try { Charset charset = amqpBrokerConfig.getCharset(); String bodyStr = new String(body, charset); LOG.debug(String.format("[consumer tag: %s] Message consumed from broker: %s", consumerTag, bodyStr)); try { consumerThreadPool.submit(new AmqpMessageProcessingTask(consumerTag, bodyStr, msgHandler, ackHandler)); LOG.debug(String.format("[consumer tag: %s] Message has been put in the processing queue: %s.", consumerTag, bodyStr)); } catch (Exception e) { LOG.error(String.format("[consumer tag: %s] Couldn't put message in the processing queue: %s.", consumerTag, bodyStr), e); throw e; } } catch (Exception e) { LOG.error(String.format("[consumer tag: %s] Got exception while processing incoming message. About to send AMQP reject...", consumerTag), e); ackHandler.autoReject(); } }
Source:
private boolean verifyMetricsFromSinkOnce(Map<String, Long> expectedMetrics) { synchronized (GlobalPhoenixMetricsTestSink.lock) { for (AbstractMetric metric : GlobalPhoenixMetricsTestSink.metrics) { if (expectedMetrics.containsKey(metric.name())) { long expectedValue = expectedMetrics.get(metric.name()); long actualValue = metric.value().longValue(); if (expectedValue != actualValue) { LOG.warn("Metric from Hadoop Sink: " + metric.name() + " didn't match expected."); return false; } expectedMetrics.remove(metric.name()); } } } assertTrue("Metric expected but not present in Hadoop Metrics Sink (GlobalPhoenixMetricsTestSink)", expectedMetrics.size() == 0); return true; }

Target:
private boolean verifyMetricsFromSinkOnce(Map<String, Long> expectedMetrics) { synchronized (GlobalPhoenixMetricsTestSink.lock) { for (AbstractMetric metric : GlobalPhoenixMetricsTestSink.metrics) { if (expectedMetrics.containsKey(metric.name())) { Long value = expectedMetrics.get(metric.name()); if (value != null) { long expectedValue = value; long actualValue = metric.value().longValue(); if (expectedValue != actualValue) { LOG.warn("Metric from Hadoop Sink: " + metric.name() + " didn't match expected."); return false; } expectedMetrics.remove(metric.name()); } } } } assertTrue("Metric expected but not present in Hadoop Metrics Sink (GlobalPhoenixMetricsTestSink)", expectedMetrics.size() == 0); return true; }
Source:
public void teardown() throws Exception { super.teardown(); if (auxFs != null) { auxFs.delete(testRoot, true); } }

Target:
public void teardown() throws Exception { super.teardown(); if (auxFs != null) { auxFs.delete(testRoot, true); auxFs.close(); } }
Source:
protected Builder() { super(DockerApi.class); id("docker") .name("Docker API") .identityName("user") .credentialName("password") .documentation(URI.create("<LINK_1>")) .version("1.15") .defaultEndpoint("<LINK_0>") .defaultProperties(DockerApiMetadata.defaultProperties()) .view(typeToken(ComputeServiceContext.class)) .defaultModules(ImmutableSet.<Class<? extends Module>>of( DockerParserModule.class, DockerHttpApiModule.class, DockerComputeServiceContextModule.class)); }

Target:
protected Builder() { super(DockerApi.class); id("docker") .name("Docker API") .identityName("Path to Certificate .p12 file") .credentialName("Password to Certificate") .documentation(URI.create("<LINK_1>")) .version("1.15") .defaultEndpoint("<LINK_0>") .defaultProperties(DockerApiMetadata.defaultProperties()) .view(typeToken(ComputeServiceContext.class)) .defaultModules(ImmutableSet.<Class<? extends Module>>of( DockerParserModule.class, DockerHttpApiModule.class, DockerComputeServiceContextModule.class)); }
Source:
public void testCreateTableWithNotNull() { assertStatement("CREATE TABLE foo (" + "a VARCHAR NOT NULL COMMENT 'column a', " + "b BIGINT COMMENT 'hello world', " + "c IPADDRESS, " + "d DATE NOT NULL)", new CreateTable(QualifiedName.of("foo"), ImmutableList.of( new ColumnDefinition(identifier("a"), "VARCHAR", emptyList(), Optional.of("column a"), false), new ColumnDefinition(identifier("b"), "BIGINT", emptyList(), Optional.of("hello world"), true), new ColumnDefinition(identifier("c"), "IPADDRESS", emptyList(), Optional.empty(), true), new ColumnDefinition(identifier("d"), "DATE", emptyList(), Optional.empty(), false)), false, ImmutableList.of(), Optional.empty())); }

Target:
public void testCreateTableWithNotNull() { assertStatement( "CREATE TABLE foo (" + "a VARCHAR NOT NULL COMMENT 'column a', " + "b BIGINT COMMENT 'hello world', " + "c IPADDRESS, " + "d DATE NOT NULL)", new CreateTable( QualifiedName.of("foo"), ImmutableList.of( new ColumnDefinition(identifier("a"), "VARCHAR", false, emptyList(), Optional.of("column a")), new ColumnDefinition(identifier("b"), "BIGINT", true, emptyList(), Optional.of("hello world")), new ColumnDefinition(identifier("c"), "IPADDRESS", true, emptyList(), Optional.empty()), new ColumnDefinition(identifier("d"), "DATE", false, emptyList(), Optional.empty())), false, ImmutableList.of(), Optional.empty())); }
Source:
public int getMaxDamage() { if (itemMaterial == null) { return 0; } else { return itemMaterial.getMaxDamage(); } }

Target:
public int getMaxDamage() { return itemMaterial.getMaxDamage(); }
Source:
private String getCombinedLabels(IThreadDMContext processDmc, IMIExecutionDMContext execDmc) { IThreadDMData processData = getData(processDmc); String label = getLabel(processData); if (execDmc != null) { int threadId; try { threadId = Integer.parseInt(execDmc.getThreadId()); label += !label.isEmpty() ? ": " : ""; label += "Thread [" + Integer.toString(threadId) + "]"; } catch (NumberFormatException e) { } } return label; }

Target:
private String getCombinedLabels(IThreadDMContext processDmc, IMIExecutionDMContext execDmc) { IThreadDMData processData = getData(processDmc); String label = getLabel(processData); if (execDmc != null) { String threadId = execDmc.getThreadId(); label += !label.isEmpty() ? ": " : ""; label += "Thread [" + threadId + "]"; } return label; }
Source:
TimestampsByCellResultWithToken moveForward(Token oldToken) { boolean skipping = oldToken.shouldSkip(); while (skipping && iterator.hasNext()) { AgnosticLightResultRow nextResult = iterator.peek(); if (finishedForwarding(oldToken, nextResult)) { skipping = false; } else { iterator.next(); } } return this; }

Target:
private TimestampsByCellResultWithToken moveForward(Token oldToken) { boolean skipping = oldToken.shouldSkip(); while (skipping && iterator.hasNext()) { AgnosticLightResultRow nextResult = iterator.peek(); if (finishedSkipping(oldToken, nextResult)) { skipping = false; } else { iterator.next(); } } entries.putAll(rowBuffer); return this; }
Source:
public void test_primary_key_in_pg_index() { execute(" select i.* from pg_index i, pg_class c where c.relname = 't1' and c.oid = i.indrelid;"); assertThat(printedTable(response.rows()), is( "false| NULL| NULL| NULL| -649073482| true| false| false| true| true| true| false| false| true| [1]| 0| NULL| NULL| 728874843\n" )); }

Target:
public void test_primary_key_in_pg_index() { execute(" select i.indexrelid, i.indrelid, i.indkey from pg_index i, pg_class c where c.relname = 't1' and c.oid = i.indrelid;"); assertThat(printedTable(response.rows()), is("-649073482| 728874843| [1]\n")); }
Source:
public void verifyVideoAutoplay(boolean status) { String providerName = provider.getText().toLowerCase(); PageObjectLogging.log("verifyVideoAutoplay", "Provider: "+providerName, true); String autoplayStr = ""; String embedCode = ""; switch (providerName) { case "screenplay": autoplayStr = "autostart=" + status; embedCode = playerObject.findElement(By.cssSelector("[name=flashvars]")).getAttribute("value"); break; case "ign": autoplayStr = "&autoplay=" + status; embedCode = playerIframe.getAttribute("src"); break; case "realgravity": autoplayStr = "/ac330d90-cb46-012e-f91c-12313d18e962/"; embedCode = playerObject.findElement(By.cssSelector("[name=flashvars]")).getAttribute("value"); break; case "anyclip": autoplayStr = "&autoPlay=" + status; embedCode = playerObject.findElement(By.cssSelector("[name=flashvars]")).getAttribute("value"); break; case "youtube": autoplayStr = "&autoplay=" + ((status) ? 1 : 0); embedCode = playerIframe.getAttribute("src"); break; case "vimeo": autoplayStr = "?autoplay=" + ((status) ? 1 : 0); embedCode = playerIframe.getAttribute("src"); break; case "gamestar": case "hulu": case "dailymotion": case "myvideo": case "snappytv": case "ustream": case "fivemin": case "metacafe": case "movieclips": case "sevenload": case "gametrailers": case "viddler": case "bliptv": case "twitchtv": case "youku": break; default: autoplayStr = "&autoplay=" + ((status) ? 1 : 0); embedCode = playerObject.findElement(By.cssSelector("[name=flashvars]")).getAttribute("value"); break; } PageObjectLogging.log("verifyVideoAutoplay", "autoplay: " + autoplayStr, true); PageObjectLogging.log("verifyVideoAutoplay", "embedCode: " + embedCode, true); Assertion.assertStringContains(embedCode, autoplayStr); }

Target:
public void verifyVideoAutoplay(boolean status) { String providerName = provider.getText().toLowerCase(); PageObjectLogging.log("verifyVideoAutoplay", "Provider: "+providerName, true); String autoplayStr = ""; String embedCode = ""; switch (providerName) { case "screenplay": autoplayStr = "autostart=" + status; embedCode = playerObject.getAttribute("value"); break; case "ign": autoplayStr = "&autoplay=" + status; embedCode = playerIframe.getAttribute("src"); break; case "realgravity": autoplayStr = "/ac330d90-cb46-012e-f91c-12313d18e962/"; embedCode = playerObject.getAttribute("value"); break; case "anyclip": autoplayStr = "&autoPlay=" + status; embedCode = playerObject.getAttribute("value"); break; case "youtube": autoplayStr = "&autoplay=" + ((status) ? 1 : 0); embedCode = playerIframe.getAttribute("src"); break; case "vimeo": autoplayStr = "?autoplay=" + ((status) ? 1 : 0); embedCode = playerIframe.getAttribute("src"); break; case "gamestar": case "hulu": case "dailymotion": case "myvideo": case "snappytv": case "ustream": case "fivemin": case "metacafe": case "movieclips": case "sevenload": case "gametrailers": case "viddler": case "bliptv": case "twitchtv": case "youku": break; default: autoplayStr = "&autoplay=" + ((status) ? 1 : 0); embedCode = playerObject.getAttribute("value"); break; } Assertion.assertStringContains(embedCode, autoplayStr); }
Source:
default void onDuplicate(I target, CommandEnvelope envelope) { repository().lifecycleOf(target) .onDuplicateCommand(envelope.messageId()); }

Target:
default void onDuplicate(I target, CommandEnvelope envelope) { repository().lifecycleOf(target) .onDuplicateCommand(envelope); }
Source:
private TaCoKitElementParameter visitSchema(final PropertyNode node) { final String connectorName = node.getProperty().getConnection().getValue(); final EConnectionType connectorType = connectorName.equalsIgnoreCase("reject") ? EConnectionType.REJECT : EConnectionType.FLOW_MAIN; final String connectionName; if (connectorName.equals("__default__")) { connectionName = EConnectionType.FLOW_MAIN.getName(); } else if (connectorType == EConnectionType.REJECT) { connectionName = EConnectionType.REJECT.getName(); } else { connectionName = connectorName; } final String schemaName = node.getProperty().getSchemaName(); return createSchemaParameter(connectionName, schemaName, true); }

Target:
private TaCoKitElementParameter visitSchema(final PropertyNode node) { final String connectorName = node.getProperty().getConnection().getValue(); final String connectionName; if (connectorName.equals("__default__")) { connectionName = EConnectionType.FLOW_MAIN.getName(); } else if (connectorName.equalsIgnoreCase(EConnectionType.REJECT.getName())) { connectionName = EConnectionType.REJECT.getName(); } else { connectionName = connectorName; } final String schemaName = node.getProperty().getSchemaName(); return createSchemaParameter(connectionName, schemaName, true); }
Source:
public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("application/gzip"); response.setStatus(HttpServletResponse.SC_OK); try { int currByteWritten = -1; int numBytesWritten = 0; InputStream in = new ByteArrayInputStream(RESPONSE_STR.getBytes()); OutputStream out = response.getOutputStream(); while ((currByteWritten = in.read()) != -1) { out.write(currByteWritten); out.flush(); numBytesWritten++; if (numBytesWritten >= THRESHOLD_BYTES) { serverWaitLatch.await(); } } } catch(Exception e) { LOG.error("{}", e); serverException = e; } }

Target:
public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("application/gzip"); response.setStatus(HttpServletResponse.SC_OK); try { int currByteWritten = -1; int numBytesWritten = 0; InputStream in = new ByteArrayInputStream(RESPONSE_STR.getBytes()); OutputStream out = response.getOutputStream(); while ((currByteWritten = in.read()) != -1) { out.write(currByteWritten); out.flush(); numBytesWritten++; if (numBytesWritten >= THRESHOLD_BYTES) { if(!serverWaitLatch.await(5, TimeUnit.SECONDS)) { throw new IOException("Timed out waiting for latch"); } break; } } } catch(Exception e) { LOG.error("{}", e); serverException = e; } }
Source:
public void checkNoDuplicateIdInSpec(AadlPackage toppkg) { Set<AadlPackage> pkgs = new HashSet<>(); getPackageDependencies(toppkg, pkgs); HashMultimap<String, SpecStatement> multiMap = HashMultimap.create(); for (AadlPackage pkg : pkgs) { List<NamedSpecStatement> specs = getNamedSpecStatements(pkg); for (NamedSpecStatement spec : specs) { String id = spec.getName(); if (id != null) { multiMap.put(id, spec); } } } List<NamedSpecStatement> specs = getNamedSpecStatements(toppkg); for (NamedSpecStatement spec : specs) { String id = spec.getName(); if (multiMap.get(id).size() > 1) { error("Duplicate ID in AGREE claim", spec, Aadl2Package.eINSTANCE.getNamedElement_Name()); } } }

Target:
public void checkNoDuplicateIdInSpec(AadlPackage toppkg) { HashMultimap<String, NamedSpecStatement> namedSpecs = HashMultimap.create(); Set<AadlPackage> pkgs = new HashSet<>(); getPackageDependencies(toppkg, pkgs); for (AadlPackage pkg : pkgs) { List<NamedSpecStatement> specs = getNamedSpecStatements(pkg); for (NamedSpecStatement spec : specs) { String id = spec.getName(); if (id != null) { namedSpecs.put(id, spec); } } } List<NamedSpecStatement> specs = getNamedSpecStatements(toppkg); Iterator<NamedSpecStatement> i = specs.iterator(); while (i.hasNext()) { NamedSpecStatement spec = i.next(); String id = spec.getName(); if (namedSpecs.get(id).size() > 1) { Iterator<NamedSpecStatement> ii = namedSpecs.get(id).iterator(); while (ii.hasNext()) { String pkgName = AadlUtil.getContainingPackage(ii.next()).getName(); if (!pkgName.contentEquals(AadlUtil.getContainingPackage(spec).getName())) { error("Duplicate AGREE property ID in package " + pkgName, spec, Aadl2Package.eINSTANCE.getNamedElement_Name()); } } namedSpecs.removeAll(id); } } }
Source:
private Credential getCredential(Configuration config) throws IOException, GeneralSecurityException { Credential credential = null; if (delegationTokens != null) { AccessTokenProvider atp = delegationTokens.getAccessTokenProvider(); if (atp != null) { atp.setConf(config); credential = CredentialFromAccessTokenProviderClassFactory.credential( atp, CredentialFactory.GCS_SCOPES); } } else { credential = CredentialFromAccessTokenProviderClassFactory.credential( config, ImmutableList.of(GCS_CONFIG_PREFIX), CredentialFactory.GCS_SCOPES); if (credential == null) { credential = HadoopCredentialConfiguration.getCredentialFactory(config, GCS_CONFIG_PREFIX) .getCredential(CredentialFactory.GCS_SCOPES); } } String impersonationServiceAccount = HadoopCredentialConfiguration.getImpersonationServiceAccount(config, GCS_CONFIG_PREFIX); if (impersonationServiceAccount != null) { GoogleCloudStorageOptions options = GoogleHadoopFileSystemConfiguration.getGcsFsOptionsBuilder(config) .build() .getCloudStorageOptions(); HttpRequestInitializer initializer = new RetryHttpInitializer( checkNotNull(credential, "credential must not be null"), options.getAppName(), options.getMaxHttpRequestRetries(), options.getHttpRequestConnectTimeout(), options.getHttpRequestReadTimeout(), options.getHttpRequestHeaders()); HttpTransport httpTransport = HttpTransportFactory.createHttpTransport( options.getTransportType(), options.getProxyAddress(), options.getProxyUsername(), options.getProxyPassword()); GoogleCloudStorageAccessTokenProvider internalAccessTokenProvider = new GoogleCloudStorageAccessTokenProvider( impersonationServiceAccount, initializer, httpTransport, CredentialFactory.CLOUD_PLATFORM_SCOPES); internalAccessTokenProvider.setConf(config); credential = CredentialFromAccessTokenProviderClassFactory.getCredentialFromAccessTokenProvider( internalAccessTokenProvider, CredentialFactory.GCS_SCOPES); } return credential; }

Target:
private Credential getCredential(Configuration config) throws IOException, GeneralSecurityException { Credential credential = null; if (delegationTokens != null) { AccessTokenProvider atp = delegationTokens.getAccessTokenProvider(); if (atp != null) { atp.setConf(config); credential = CredentialFromAccessTokenProviderClassFactory.credential( atp, CredentialFactory.GCS_SCOPES); } } else { credential = CredentialFromAccessTokenProviderClassFactory.credential( config, ImmutableList.of(GCS_CONFIG_PREFIX), CredentialFactory.GCS_SCOPES); if (credential == null) { credential = HadoopCredentialConfiguration.getCredentialFactory(config, GCS_CONFIG_PREFIX) .getCredential(CredentialFactory.GCS_SCOPES); } } return getImpersonatedCredential(config, credential).orElse(credential); }
Source:
public void send(final CoreLogItemRequestMessage coreLogItemRequestMessage) { LOGGER.debug("Sending CoreLogItemRequestMessage"); this.coreLogItemRequestsJmsTemplate.send(new MessageCreator() { @Override public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(); objectMessage.setJMSType(Constants.DLMS_LOG_ITEM_REQUEST); objectMessage.setStringProperty(Constants.DECODED_MESSAGE, coreLogItemRequestMessage.getDecodedMessage()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, coreLogItemRequestMessage.getDeviceIdentification()); if (coreLogItemRequestMessage.hasOrganisationIdentification()) { objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, coreLogItemRequestMessage.getOrganisationIdentification()); } objectMessage.setStringProperty(Constants.IS_VALID, coreLogItemRequestMessage.isValid().toString()); objectMessage.setIntProperty(Constants.PAYLOAD_MESSAGE_SERIALIZED_SIZE, coreLogItemRequestMessage.getPayloadMessageSerializedSize()); return objectMessage; } }); }

Target:
public void send(final CoreLogItemRequestMessage coreLogItemRequestMessage) { LOGGER.debug("Sending CoreLogItemRequestMessage"); this.coreLogItemRequestsJmsTemplate.send(new MessageCreator() { @Override public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(); objectMessage.setJMSType(Constants.CORE_LOG_ITEM_REQUEST); objectMessage.setStringProperty(Constants.DECODED_MESSAGE, coreLogItemRequestMessage.getDecodedMessage()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, coreLogItemRequestMessage.getDeviceIdentification()); if (coreLogItemRequestMessage.hasOrganisationIdentification()) { objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, coreLogItemRequestMessage.getOrganisationIdentification()); } objectMessage.setStringProperty(Constants.IS_VALID, coreLogItemRequestMessage.isValid().toString()); objectMessage.setIntProperty(Constants.PAYLOAD_MESSAGE_SERIALIZED_SIZE, coreLogItemRequestMessage.getPayloadMessageSerializedSize()); return objectMessage; } }); }
Source:
public static void main(String[] args) { if (args.length > 1) { final String destBasePath = args[0]; final List<String> filesToCopy = Arrays.asList(args).subList(1, args.length); copyTemplateFiles(destBasePath, filesToCopy); } else { throw new RuntimeException("Missing arguments, required at least one origin paths"); } }

Target:
public static void main(String[] args) { if (args.length > 1) { final String destBasePath = args[0]; final List<String> filesToCopy = Arrays.asList(args).subList(1, args.length); copyTemplateFiles(destBasePath, filesToCopy); } else { throw new RuntimeException("Missing arguments, required at least one origin path"); } }
Source:
public void showSavePopup(Path path, Command saveCommand, Command cancelCommand) { YesNoCancelPopup popup = YesNoCancelPopup.newYesNoCancelPopup(path.getFileName(), "", saveCommand, CommonConstants.INSTANCE.Save(), null, null, cancelCommand, CommonConstants.INSTANCE.Cancel()); popup.show(); }

Target:
public void showSavePopup(Path path, Command saveCommand, Command cancelCommand) { YesNoCancelPopup popup = YesNoCancelPopup.newYesNoCancelPopup(org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants.INSTANCE.Information(), translationService.getTranslation(FormEditorConstants.FormEditorViewImplSaveBeforeRename), saveCommand, CommonConstants.INSTANCE.Save(), null, null, cancelCommand, translationService.getTranslation(FormEditorConstants.FormEditorViewImplDontSave)); popup.show(); }
Source:
public static boolean isInvocationOnVariable(MethodInvocationTree mit, @Nullable Symbol variable, boolean defaultReturn) { ExpressionTree methodSelect = mit.methodSelect(); if (variable != null && methodSelect.is(Tree.Kind.MEMBER_SELECT)) { Optional<Symbol> extractedSymbol = extractIdentifierSymbol(((MemberSelectExpressionTree) methodSelect).expression()); if (extractedSymbol.isPresent()) { return extractedSymbol.get().equals(variable); } } return defaultReturn; }

Target:
public static boolean isInvocationOnVariable(MethodInvocationTree mit, @Nullable Symbol variable, boolean defaultReturn) { ExpressionTree methodSelect = mit.methodSelect(); if (variable == null || !methodSelect.is(Tree.Kind.MEMBER_SELECT)) { return defaultReturn; } return extractIdentifierSymbol(((MemberSelectExpressionTree) methodSelect).expression()) .map(variable::equals) .orElse(defaultReturn); }
Source:
public PaxosLeaderElectionService(PaxosProposer proposer, PaxosLearner knowledge, Map<PingableLeader, HostAndPort> potentialLeadersToHosts, List<PaxosAcceptor> acceptors, List<PaxosLearner> learners, ExecutorService executor, long updatePollingWaitInMs, long randomWaitBeforeProposingLeadership, long leaderPingResponseWaitMs) { this(proposer, knowledge, potentialLeadersToHosts, acceptors, learners, executor, updatePollingWaitInMs, randomWaitBeforeProposingLeadership, , DEFAULT_NO_QUORUM_MAX_DELAY_MS, leaderPingResponseWaitMs, PaxosLeaderElectionEventRecorder.NO_OP); }

Target:
public PaxosLeaderElectionService(PaxosProposer proposer, PaxosLearner knowledge, Map<PingableLeader, HostAndPort> potentialLeadersToHosts, List<PaxosAcceptor> acceptors, List<PaxosLearner> learners, ExecutorService executor, long updatePollingWaitInMs, long randomWaitBeforeProposingLeadership, long leaderPingResponseWaitMs) { this(proposer, knowledge, potentialLeadersToHosts, acceptors, learners, executor, updatePollingWaitInMs, randomWaitBeforeProposingLeadership, DEFAULT_NO_QUORUM_MAX_DELAY_MS, leaderPingResponseWaitMs, PaxosLeaderElectionEventRecorder.NO_OP); }
Source:
public VcrMetrics(MetricRegistry registry) { this.registry = registry; blobEncryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionCount")); blobDecryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobDet4acryptionCount")); blobEncryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionTime")); blobDecryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionTime")); }

Target:
public VcrMetrics(MetricRegistry registry) { this.registry = registry; blobEncryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionCount")); blobDecryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionCount")); blobEncryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionTime")); blobDecryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionTime")); }
Source:
private Maybe<Image> getImage(Element element) { Elements imageElements = element.getFirstChildElement("images").getChildElements("image"); if (imageElements.size() > 0) { String image = imageElements.get(0).getValue(); if(!image.contains("http")) { image = "http://" + image; } Image imageObj = new Image(image); if (image.contains("api-images.channel5.com/images/default")) { imageObj.setType(ImageType.GENERIC_IMAGE_CONTENT_PLAYER); } return Maybe.just(imageObj); } return Maybe.nothing(); }

Target:
private Maybe<Image> getImage(Element element) { Elements imageElements = element.getFirstChildElement("images").getChildElements("image"); if (imageElements.size() > 0) { String image = imageElements.get(0).getValue(); if(!image.contains("http://")) { image = "http://" + image; } Image imageObj = new Image(image); if (image.contains("api-images.channel5.com/images/default")) { imageObj.setType(ImageType.GENERIC_IMAGE_CONTENT_PLAYER); } return Maybe.just(imageObj); } return Maybe.nothing(); }
Source:
public void doesNotLogIfClockDoesNotGoBackwards() { when(delegate.getSystemTimeInNanos()) .thenReturn(1L) .thenReturn(2L) .thenReturn(3L); clock.getSystemTimeInNanos(); }

Target:
public void doesNotLogIfClockDoesNotGoBackwards() { when(delegate.getSystemTimeInNanos()) .thenReturn(1L) .thenReturn(2L) .thenReturn(3L); clock.getSystemTimeInNanos(); clock.getSystemTimeInNanos(); clock.getSystemTimeInNanos(); }
Source:
public void attach(final ChannelCreationListener channelCreationListener) { this.channelCreationListener = channelCreationListener; newChannelName.addTextChangedListener(channelNameTextWatcher); toolbar.setOnMenuItemClickListener(menuItemClickListener); toolbar.setNavigationOnClickListener(navigationOnClickListener); toolbar.getMenu().getItem(0).setEnabled(false); }

Target:
public void attach(final ChannelCreationListener channelCreationListener) { this.channelCreationListener = channelCreationListener; newChannelName.addTextChangedListener(channelNameTextWatcher); toolbar.setOnMenuItemClickListener(menuItemClickListener); toolbar.setNavigationOnClickListener(navigationOnClickListener); getCreateItem().setEnabled(false); }