auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String getTypeName(Tree tree) { Type type = ((AbstractTypedTree) tree).getSymbolType(); TypeSymbol symbol = type.getSymbol(); String name = symbol.getName(); if (name.isEmpty()) { name = getAnonymousClassTypeName(symbol); } return name; }

Target:
private String getTypeName(Tree tree) { Type type = ((AbstractTypedTree) tree).getSymbolType(); String name = getTypeName(type); if (name.isEmpty()) { name = getAnonymousClassTypeName(type.getSymbol()); } return name; }
Source:
public void invokeShrApplication() { SmartCardController smartCardController = ((MuzimaApplication) getApplicationContext()).getSmartCardController(); SmartCardRecord smartCardRecord = null; try { smartCardRecord = smartCardController.getSmartCardRecordByPersonUuid(patient.getUuid()); } catch (SmartCardController.SmartCardRecordFetchException e) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(true) .setMessage("Could not obtain smartcard record for writing to card. " + e.getMessage()) .show(); Log.e("TAG", "Could not obtain smartcard record for writing to card", e); } if (smartCardRecord != null) { SmartCardIntentIntegrator shrIntegrator = new SmartCardIntentIntegrator(this); try { shrIntegrator.initiateCardWrite(smartCardRecord.getPlainPayload()); } catch (IOException e) { Log.e("TAG", "Could not write to card", e); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(true) .setMessage("Could not write to card. " + e.getMessage()) .show(); } Toast.makeText(getApplicationContext(), "Opening Card Reader", Toast.LENGTH_LONG).show(); } }

Target:
public void invokeShrApplication() { SmartCardController smartCardController = ((MuzimaApplication) getApplicationContext()).getSmartCardController(); SmartCardRecord smartCardRecord = null; try { smartCardRecord = smartCardController.getSmartCardRecordByPersonUuid(patient.getUuid()); } catch (SmartCardController.SmartCardRecordFetchException e) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(true) .setMessage(getString(R.string.failure_obtain_smartcard_record) + e.getMessage()) .show(); Log.e("TAG", "Could not obtain smartcard record for writing to card", e); } if (smartCardRecord != null) { SmartCardIntentIntegrator shrIntegrator = new SmartCardIntentIntegrator(this); try { shrIntegrator.initiateCardWrite(smartCardRecord.getPlainPayload()); } catch (IOException e) { Log.e("TAG", "Could not write to card", e); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(true) .setMessage("Could not write to card. " + e.getMessage()) .show(); } Toast.makeText(getApplicationContext(), "Opening Card Reader", Toast.LENGTH_LONG).show(); } }
Source:
private void render(final DomainObject domainObject, final Command callback) { if (null != renderer) { getGraphUUID().ifPresent(graphUUID -> renderer.render(graphUUID, domainObject, callback)); } }

Target:
private void render(final DomainObject domainObject, final Command callback) { if (!Objects.isNull(renderer)) { getGraphUUID().ifPresent(graphUUID -> renderer.render(graphUUID, domainObject, callback)); } }
Source:
public void testSendSerialDataAsync802IOError() throws XBeeException, IOException { Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.RAW_802_15_4); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacketAsync(tx16Packet); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacketAsync(tx64Packet); try { xbeeDevice.sendSerialDataAsync(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx16 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } try { xbeeDevice.sendSerialDataAsync(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } try { xbeeDevice.sendSerialDataAsync(mockedDevice, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } }

Target:
public void testSendSerialDataAsync802IOError() throws XBeeException, IOException { Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.RAW_802_15_4); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacketAsync(tx16Packet); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacketAsync(tx64Packet); try { xbeeDevice.sendSerialDataAsync(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx16 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } try { xbeeDevice.sendSerialDataAsync(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } try { xbeeDevice.sendSerialDataAsync(mockedDevice, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } }
Source:
public DataStoreTransaction beginTransaction() { if (queryEngine == null) { queryEngine = queryEngineFactory.buildQueryEngine(dictionary); } return new AggregationDataStoreTransaction(queryEngine); }

Target:
public DataStoreTransaction beginTransaction() { return new AggregationDataStoreTransaction(queryEngine); }
Source:
public void verifyHttps() throws Exception { log.info("==========================================================="); BrooklynWebServer webServer = buildWebServer(); DefaultHttpClient httpclient = buildHttpsClient(webServer); HttpGet httpget = new HttpGet(webServer.getRootUrl()); System.out.println(httpget); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); InputStream instream = entity.getContent(); log.info("==========================================================="); }

Target:
public void verifyHttps() throws Exception { BrooklynWebServer webServer = buildWebServer(); DefaultHttpClient httpclient = buildHttpsClient(webServer); HttpGet httpget = new HttpGet(webServer.getRootUrl()); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); InputStream instream = entity.getContent(); }
Source:
public void or_emptyGroupThrows() { populateTestRealm(); RealmResults<AllTypes> fives = realm.where(AllTypes.class) .equalTo(AllTypes.FIELD_LONG, 5) .or() .beginGroup() .endGroup() .findAll(); }

Target:
public void or_emptyGroupThrows() { populateTestRealm(); RealmQuery<AllTypes> query = realm.where(AllTypes.class) .equalTo(AllTypes.FIELD_LONG, 5) .or() .beginGroup() .endGroup(); try { query.findAll(); } catch (UnsupportedOperationException ignore) { } }
Source:
public static void main(String[] args) throws Exception { String snapshotFile = null; boolean dumpData = false; boolean dumpJson = false; int i; for (i = 0; i < args.length; i++) { if (args[i].equals("-d")) { dumpData = true; } else if (args[i].equals("-json")) { dumpJson = true; } else { snapshotFile = args[i]; i++; break; } } if (args.length != i || snapshotFile == null) { System.err.println("USAGE: SnapshotFormatter [-d] snapshot_file"); System.err.println(" -d dump the data for each znode"); System.err.println(" -json dump znode info in json format"); System.exit(ExitCode.INVALID_INVOCATION.getValue()); } new SnapshotFormatter().run(snapshotFile, dumpData, dumpJson); }

Target:
public static void main(String[] args) throws Exception { String snapshotFile = null; boolean dumpData = false; boolean dumpJson = false; int i; for (i = 0; i < args.length; i++) { if (args[i].equals("-d")) { dumpData = true; } else if (args[i].equals("-json")) { dumpJson = true; } else { snapshotFile = args[i]; i++; break; } } if (args.length != i || snapshotFile == null) { System.err.println("USAGE: SnapshotFormatter [-d|-json] snapshot_file"); System.err.println(" -d dump the data for each znode"); System.err.println(" -json dump znode info in json format"); System.exit(ExitCode.INVALID_INVOCATION.getValue()); } if (dumpData && dumpJson) { System.err.println("Cannot specify both data dump (-d) and json mode (-json) in same call"); System.exit(ExitCode.INVALID_INVOCATION.getValue()); } new SnapshotFormatter().run(snapshotFile, dumpData, dumpJson); }
Source:
public void throwsIfNoMoreElement() throws Exception { final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HTTP_OK, "[{\"body\":\"hi jeff\"}]") ).start(); final Request request = new ApacheRequest(container.home()); final GhPagination<JsonObject> page = new GhPagination<JsonObject>( request, new GhPagination.Mapping<JsonObject>() { @Override public JsonObject map(final JsonObject object) { return object; } } ); final Iterator<JsonObject> iterator = page.iterator(); MatcherAssert.assertThat( iterator.next().toString(), Matchers.notNullValue() ); MatcherAssert.assertThat( iterator.next(), Matchers.notNullValue() ); container.stop(); }

Target:
public void throwsIfNoMoreElement() throws Exception { final MkContainer container = new MkGrizzlyContainer() .next(simple("Hi there")).start(); try { final Request request = new ApacheRequest(container.home()); final GhPagination<JsonObject> page = new GhPagination<JsonObject>( request, new GhPagination.Mapping<JsonObject>() { @Override public JsonObject map(final JsonObject object) { return object; } } ); final Iterator<JsonObject> iterator = page.iterator(); iterator.next(); MatcherAssert.assertThat( iterator.next(), Matchers.notNullValue() ); } finally { container.stop(); } }
Source:
public void setUp() throws Exception { Properties props = new Properties(); java.io.File f = new java.io.File(System.getProperty("user.home"), ".github"); if (f.exists()) { FileInputStream in = new FileInputStream(f); try { props.load(in); gitHub = GitHub.connect(props.getProperty("login"),props.getProperty("oauth")); } finally { IOUtils.closeQuietly(in); } } else { gitHub = GitHub.connect(); } }

Target:
public void setUp() throws Exception { Properties props = new Properties(); java.io.File f = new java.io.File(System.getProperty("user.home"), ".github.kohsuke2"); if (f.exists()) { FileInputStream in = new FileInputStream(f); try { props.load(in); gitHub = GitHub.connect(props.getProperty("login"),props.getProperty("oauth")); } finally { IOUtils.closeQuietly(in); } } else { gitHub = GitHub.connect(); } }
Source:
private StoragePool mockStoragePool() { StoragePool storage_pool = new StoragePool(); storage_pool.setstatus(StoragePoolStatus.Up); return storage_pool; }

Target:
private StoragePool mockStoragePool() { StoragePool storagePool = new StoragePool(); storagePool.setstatus(StoragePoolStatus.Up); return storagePool; }
Source:
private Properties augment(Properties origin) { Properties target = new Properties(); for (Entry<Object, Object> entry : origin.entrySet()) { Object key = entry.getKey(); if (key instanceof String && !key.toString().startsWith(HSEARCH_PREFIX)) { key = HSEARCH_PREFIX + key.toString(); } target.put(key, entry.getValue()); boolean hasAffinity = false; if (key.toString().endsWith(INDEX_MANAGER_IMPL_NAME) && entry.getValue().equals(AffinityIndexManager.class.getName())) { target.put(key.toString().replace(INDEX_MANAGER_IMPL_NAME, SHARDING_STRATEGY), AffinityShardIdentifierProvider.class.getName()); hasAffinity = true; } if (hasAffinity) { Object errorHandler = target.get(Environment.ERROR_HANDLER); if (errorHandler == null) { target.put(Environment.ERROR_HANDLER, new AffinityErrorHandler()); } else { target.put(Environment.ERROR_HANDLER, new AffinityErrorHandler(createErrorHandler(errorHandler))); } } } return target; }

Target:
private Properties augment(Properties origin) { Properties target = new Properties(); boolean hasAffinity = false; for (Entry<Object, Object> entry : origin.entrySet()) { Object key = entry.getKey(); if (key instanceof String && !key.toString().startsWith(HSEARCH_PREFIX)) { key = HSEARCH_PREFIX + key.toString(); } target.put(key, entry.getValue()); if (key.toString().endsWith(INDEX_MANAGER_IMPL_NAME) && entry.getValue().equals(AffinityIndexManager.class.getName())) { target.put(key.toString().replace(INDEX_MANAGER_IMPL_NAME, SHARDING_STRATEGY), AffinityShardIdentifierProvider.class.getName()); hasAffinity = true; } } configureErrorHandler(target, hasAffinity); return target; }
Source:
public RequestStarter(NodeClientCore node, BaseRequestThrottle throttle, String name, TokenBucket outputBucket, TokenBucket inputBucket, RunningAverage averageOutputBytesPerRequest, RunningAverage averageInputBytesPerRequest, boolean isInsert, boolean isSSK, boolean realTime) { this.core = node; this.stats = core.nodeStats; this.throttle = throttle; this.name = name + (realTime ? " (realtime)" : " (bulk)"); this.outputBucket = outputBucket; this.inputBucket = inputBucket; this.averageOutputBytesPerRequest = averageOutputBytesPerRequest; this.averageInputBytesPerRequest = averageInputBytesPerRequest; this.isInsert = isInsert; this.isSSK = isSSK; this.realTime = realTime; this.lastDelay = 4000; this.ALCHEMY_DELAY_WEIGHT = 24; this.LAST_DEALY_WEIGHT = 75; this.TOADS_DELAY_WEIGHT = 1; this.MIN_ALCHEMY_DELAY = 5; this.MAX_ALCHEMY_DELAY = 500; }

Target:
public RequestStarter(NodeClientCore node, BaseRequestThrottle throttle, String name, TokenBucket outputBucket, TokenBucket inputBucket, RunningAverage averageOutputBytesPerRequest, RunningAverage averageInputBytesPerRequest, boolean isInsert, boolean isSSK, boolean realTime) { this.core = node; this.stats = core.nodeStats; this.throttle = throttle; this.name = name + (realTime ? " (realtime)" : " (bulk)"); this.outputBucket = outputBucket; this.inputBucket = inputBucket; this.averageOutputBytesPerRequest = averageOutputBytesPerRequest; this.averageInputBytesPerRequest = averageInputBytesPerRequest; this.isInsert = isInsert; this.isSSK = isSSK; this.realTime = realTime; this.lastDelay = 4000; }
Source:
private Repository getRepository(ExecutionEvent event) throws ExecutionException { PlatformObject firstElement; IStructuredSelection selection = (IStructuredSelection) HandlerUtil .getCurrentSelection(event); if (selection.getFirstElement() instanceof PlotCommit) { IWorkbenchPart ap = HandlerUtil.getActivePartChecked(event); if (ap instanceof IHistoryView) { firstElement = (PlatformObject) ((IHistoryView) ap) .getHistoryPage().getInput(); } else { return null; } } else { firstElement = (PlatformObject) selection.getFirstElement(); } return Utils.getAdapter(firstElement, Repository.class); }

Target:
private @Nullable Repository getRepository(ExecutionEvent event) throws ExecutionException { PlatformObject firstElement; IStructuredSelection selection = (IStructuredSelection) HandlerUtil .getCurrentSelection(event); if (selection.getFirstElement() instanceof PlotCommit) { IWorkbenchPart ap = HandlerUtil.getActivePartChecked(event); if (ap instanceof IHistoryView) { firstElement = (PlatformObject) ((IHistoryView) ap) .getHistoryPage().getInput(); } else { return null; } } else { firstElement = (PlatformObject) selection.getFirstElement(); } return Utils.getAdapter(firstElement, Repository.class); }
Source:
public Iterator<Object> iterator() { Collection beanDefs = IOC.getBeanManager().lookupBeans(type, qualifiers); if(beanDefs==null){ return Collections.emptyList().iterator(); } return beanDefs.iterator(); }

Target:
public Iterator<Object> iterator() { Collection<SyncBeanDef> beanDefs = IOC.getBeanManager().lookupBeans( type, qualifiers ); if(beanDefs==null){ return Collections.emptyList().iterator(); } return new InstanceImplIterator(beanDefs); }
Source:
public void testCreateDDF() throws DDFException { try { S3DDF folderDDF = manager.newDDF("jing-bucket", "testFolder/", null, null); assert (false); assert(folderDDF.getIsDir() == true); } catch (Exception e) { } S3DDF cleanFolderDDF = manager.newDDF("jing-bucket", "testFolder/folder/", null, null); S3DDF jsonDDF = manager.newDDF("jing-bucket", "testFolder/a.json", null, null); S3DDF csvDDF = manager.newDDF("jing-bucket", "testFolder/year.csv", null, null); assert (cleanFolderDDF.getIsDir() == true); assert(jsonDDF.getIsDir() == false); assert(csvDDF.getIsDir() == false); assert(jsonDDF.getDataFormat().equals(DataFormat.JSON)); assert(csvDDF.getDataFormat().equals(DataFormat.CSV)); try { S3DDF nonExistDDF = manager.newDDF("jing-bucket", "nonexist.csv", null, null); assert (false); } catch (Exception e) { } try { S3DDF nonExistDDF2 = manager.newDDF("jing-bucket", "nonexist/", null, null); assert (false); } catch (Exception e) { } S3DDF pqtDDF = manager.newDDF("adatao-sample-data", "test/parquet/sleep_parquet/", null, null); assert (pqtDDF.getIsDir() == true); assert (pqtDDF.getDataFormat().equals(DataFormat.PQT)); S3DDF avroDDF = manager.newDDF("adatao-sample-data", "test/avro/partition_avro/", null, null); assert (avroDDF.getIsDir() == true); assert (avroDDF.getDataFormat().equals(DataFormat.AVRO)); S3DDF orcDDF = manager.newDDF("adatao-test", "orc/", null, null); assert (orcDDF.getIsDir() == true); assert (orcDDF.getDataFormat().equals(DataFormat.ORC)); }

Target:
public void testCreateDDF() throws DDFException { try { S3DDF folderDDF = manager.newDDF("jing-bucket", "testFolder/", null, null); assert (false); assert(folderDDF.getIsDir() == true); } catch (Exception e) { } S3DDF cleanFolderDDF = manager.newDDF("jing-bucket", "testFolder/folder/", null, null); S3DDF jsonDDF = manager.newDDF("jing-bucket", "testFolder/a.json", null, null); S3DDF csvDDF = manager.newDDF("jing-bucket", "testFolder/year.csv", null, null); assert (cleanFolderDDF.getIsDir() == true); assert(jsonDDF.getIsDir() == false); assert(csvDDF.getIsDir() == false); assert(jsonDDF.getDataFormat().equals(DataFormat.JSON)); assert(csvDDF.getDataFormat().equals(DataFormat.CSV)); S3DDF pqtDDF = manager.newDDF("adatao-sample-data", "test/parquet/sleep_parquet/", null, null); assert (pqtDDF.getIsDir() == true); assert (pqtDDF.getDataFormat().equals(DataFormat.PQT)); S3DDF avroDDF = manager.newDDF("adatao-sample-data", "test/avro/single/episodes.avro", null, null); assert (avroDDF.getIsDir() == false); assert (avroDDF.getDataFormat().equals(DataFormat.AVRO)); S3DDF orcDDF = manager.newDDF("adatao-test", "orc/", null, null); assert (orcDDF.getIsDir() == true); assert (orcDDF.getDataFormat().equals(DataFormat.ORC)); }
Source:
public <T> void put(final String dataType, final long id, final T value) { if (value == null) { return; } final String operationId = Long.toString(operationIdCounter.getAndIncrement()); final DataOperation<T> operation = new DataOperation<>(Optional.<String>empty(), operationId, DataOpType.PUT, dataType, id, Optional.of(value)); executeOperation(operation); }

Target:
public <T> Pair<Long, Boolean> put(final String dataType, final long id, final T value) { if (value == null) { return new Pair<>(id, false); } final String operationId = Long.toString(operationIdCounter.getAndIncrement()); final DataOperation<T> operation = new DataOperation<>(Optional.<String>empty(), operationId, DataOpType.PUT, dataType, id, Optional.of(value)); executeOperation(operation); return new Pair<>(id, operation.getFailedRanges().isEmpty()); }
Source:
public double estimateRowCount(RelMetadataQuery mq) { double rows = super.estimateRowCount(mq); if(offset != null) { return Math.max(0, Math.min(RexLiteral.intValue(fetch), rows - RexLiteral.intValue(offset))); } return Math.min(RexLiteral.intValue(fetch), rows); }

Target:
public double estimateRowCount(RelMetadataQuery mq) { double rows = super.estimateRowCount(mq); int offset = this.offset == null ? 0 : RexLiteral.intValue(this.offset); int fetch = this.fetch == null ? Integer.MAX_VALUE : RexLiteral.intValue(this.fetch); return Math.max(0, Math.min(fetch, rows - offset)); }
Source:
public long download(boolean resume, DownloadCompleteCallback callback) { if (skipDownloadOnStatus()) return 0; int bytes = 0; File file = new File(toFile); try { long localFileSize = checkLocalFileSizeForResume(resume, file); Date start = new Date(); if (checkServerResponse(localFileSize)) return 0; if (!tryAndGetRemoteSize()) return 0; if (!canHandleDownloadSize()) return 0; checkAndSetDownloadSize(); try (InputStream in = request.getResponseBodyAsStream(); RandomAccessFile out = new RandomAccessFile(file, "rw"); ) { out.seek(localFileSize); s_logger.info("Starting download from " + downloadUrl + " to " + toFile + " remoteSize=" + remoteSize + " , max size=" + maxTemplateSizeInBytes); if (copyBytes(file, in, out)) return 0; Date finish = new Date(); checkDowloadCompletion(); downloadTime += finish.getTime() - start.getTime(); } finally { } return totalBytes; } catch (HttpException hte) { status = TemplateDownloader.Status.UNRECOVERABLE_ERROR; errorString = hte.getMessage(); } catch (IOException ioe) { status = TemplateDownloader.Status.UNRECOVERABLE_ERROR; if (errorString.isEmpty()){ errorString = ioe.getMessage(); } } finally { if (status == Status.UNRECOVERABLE_ERROR && file.exists() && !file.isDirectory()) { file.delete(); } request.releaseConnection(); if (callback != null) { callback.downloadComplete(status); } } return 0; }

Target:
public long download(boolean resume, DownloadCompleteCallback callback) { if (skipDownloadOnStatus()) return 0; int bytes = 0; File file = new File(toFile); try { long localFileSize = checkLocalFileSizeForResume(resume, file); Date start = new Date(); if (checkServerResponse(localFileSize)) return 0; if (!tryAndGetRemoteSize()) return 0; if (!canHandleDownloadSize()) return 0; checkAndSetDownloadSize(); try (InputStream in = request.getResponseBodyAsStream(); RandomAccessFile out = new RandomAccessFile(file, "rw"); ) { out.seek(localFileSize); s_logger.info("Starting download from " + downloadUrl + " to " + toFile + " remoteSize=" + remoteSize + " , max size=" + maxTemplateSizeInBytes); if (copyBytes(file, in, out)) return 0; Date finish = new Date(); checkDowloadCompletion(); downloadTime += finish.getTime() - start.getTime(); } finally { } return totalBytes; } catch (HttpException hte) { status = TemplateDownloader.Status.UNRECOVERABLE_ERROR; errorString = hte.getMessage(); } catch (IOException ioe) { status = TemplateDownloader.Status.UNRECOVERABLE_ERROR; if (errorString.equals(" ")){ errorString = ioe.getMessage(); } } finally { if (status == Status.UNRECOVERABLE_ERROR && file.exists() && !file.isDirectory()) { file.delete(); } request.releaseConnection(); if (callback != null) { callback.downloadComplete(status); } } return 0; }
Source:
public void createGroup(String group) { throw new RuntimeException("Creating a group is not supporting in LDAP"); }

Target:
public void createGroup(String group) { throw new UnsupportedOperationException("Creating a group is not supporting in LDAP"); }
Source:
public FileSystemPersistenceProvider(String mapName, String persistencePath) { this.mapName = mapName; this.persistencePath = persistencePath; File dir = new File(getPersistencePath()); if (!dir.exists() && !dir.mkdir()) { LOGGER.debug("Unable to create directory: {}", dir.getAbsolutePath()); } }

Target:
public FileSystemPersistenceProvider(String mapName, String persistencePath) { this.mapName = mapName; this.persistencePath = persistencePath; File dir = new File(getPersistencePath()); if (!dir.exists() && !dir.mkdir()) { throw new IllegalArgumentException( String.format("Unable to create persistence directory for [%s]", dir.getAbsoluteFile())); } }
Source:
protected String extractId(String expression) { try { Matcher matcher = PATTERN.matcher(expression); if (matcher.matches()) { return matcher.group(1); } else { throw new FacesException("Expression does not match following pattern @id(id). Expression: \"" + expression + "\""); } } catch (Exception e) { throw new FacesException("Expression does not match following pattern @id(id). Expression: \"" + expression + "\"", e); } }

Target:
protected String extractId(String expression) { Matcher matcher = PATTERN.matcher(expression); if (matcher.matches()) { return matcher.group(1); } else { throw new FacesException("Expression does not match following pattern @id(id). Expression: \"" + expression + "\""); } }
Source:
public void should_fail_on_different_files() throws Exception { File actual = createDeleteOnExitTempFileWithContent("assertJ"); File expected = createDeleteOnExitTempFileWithContent("assertJ++"); assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> { assertThat(actual).hasSameBinaryContentAs(expected); }).withMessageContaining("does not have expected binary content at offset"); }

Target:
public void should_fail_on_different_files() throws Exception { File actual = createTempFileWithContent("assertJ"); File expected = createTempFileWithContent("assertJ++"); AssertionError assertionError = expectAssertionError(() -> { assertThat(actual).hasSameBinaryContentAs(expected); }); then(assertionError).hasMessageContaining("does not have expected binary content at offset"); }
Source:
public void testGetAllEmptyRequestNoLoader() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final Ehcache<String, String> ehcache = this.getEhcache(null); final Map<String, String> actual = ehcache.getAll(Collections.<String>emptySet()); assertThat(actual, is(notNullValue())); assertThat(actual.isEmpty(), is(true)); verify(this.store, never()).bulkComputeIfAbsent(eq(Collections.<String>emptySet()), getAnyIterableFunction()); verify(this.spiedResilienceStrategy, never()) .getAllFailure(eq(Collections.<String>emptySet()), any(CacheAccessException.class)); verifyZeroInteractions(this.store, this.spiedResilienceStrategy); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }

Target:
public void testGetAllEmptyRequestNoLoader() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final Ehcache<String, String> ehcache = this.getEhcache(null); final Map<String, String> actual = ehcache.getAll(Collections.<String>emptySet()); assertThat(actual, is(notNullValue())); assertThat(actual.isEmpty(), is(true)); verify(this.store, never()).bulkComputeIfAbsent(eq(Collections.<String>emptySet()), getAnyIterableFunction()); verify(this.spiedResilienceStrategy, never()).getAllFailure(eq(Collections.<String>emptySet()), any(CacheAccessException.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }
Source:
private static String convertPatternsToString(List<String> input) { StringBuilder toStringBuilder = new StringBuilder(); if (input.isEmpty()) { return ""; } if (input.size() == 1) { return toStringBuilder.append(input.get(0)).toString(); } return toStringBuilder.append(input.get(0)).append(", ...").toString(); }

Target:
private static String convertPatternsToString(List<String> input) { StringBuilder output = new StringBuilder(); if (input.isEmpty()) { return ""; } if (input.size() == 1) { return output.append(input.get(0)).toString(); } return output.append(input.get(0)).append(", ...").toString(); }
Source:
public void testConvertDs3EnumConstants() { final Ds3EnumConstant alpha = new Ds3EnumConstant("ALPHA", null); final Ds3EnumConstant bravo = new Ds3EnumConstant("BRAVO", null); final ImmutableList.Builder<Ds3EnumConstant> enumsBuilder = ImmutableList.builder(); enumsBuilder.add(alpha); enumsBuilder.add(bravo); final ImmutableList<Ds3EnumConstant> enumConstants = enumsBuilder.build(); final ImmutableList<String> stringsList = EnumHelper.convertDs3EnumConstants(enumConstants); assertFalse(stringsList.isEmpty()); assertEquals(2, stringsList.size()); assertEquals("ALPHA", stringsList.get(0)); assertEquals("BRAVO", stringsList.get(1)); }

Target:
public void testConvertDs3EnumConstants() { final Ds3EnumConstant alpha = new Ds3EnumConstant("ALPHA", null); final Ds3EnumConstant bravo = new Ds3EnumConstant("BRAVO", null); final ImmutableList<Ds3EnumConstant> enumConstants = ImmutableList.of(alpha, bravo); final ImmutableList<String> stringsList = EnumHelper.convertDs3EnumConstants(enumConstants); assertFalse(stringsList.isEmpty()); assertEquals(2, stringsList.size()); assertEquals("ALPHA", stringsList.get(0)); assertEquals("BRAVO", stringsList.get(1)); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view; if (getArguments().getString(BUNDLE_ARGUMENTS_SELECTED_CATEGORY).equals(getContext().getString(R.string.category_user_bricks))) { view = inflater.inflate(R.layout.fragment_brick_add_userbrick, container, false); } else { view = inflater.inflate(R.layout.fragment_brick_add, container, false); } previousActionBarTitle = ((AppCompatActivity) getActivity()).getSupportActionBar().getTitle(); ((AppCompatActivity) getActivity()) .getSupportActionBar().setTitle(getArguments().getString(BUNDLE_ARGUMENTS_SELECTED_CATEGORY)); setupSelectedBrickCategory(); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_brick_add, container, false); previousActionBarTitle = ((AppCompatActivity) getActivity()).getSupportActionBar().getTitle(); ((AppCompatActivity) getActivity()) .getSupportActionBar().setTitle(getArguments().getString(BUNDLE_ARGUMENTS_SELECTED_CATEGORY)); setupSelectedBrickCategory(); return view; }
Source:
public void inputRecipient(String recipient) { WebElement recipientBox = this.getRecipientBox(); recipientBox.clear(); recipientBox.sendKeys(recipient); }

Target:
public void inputRecipient(String recipient) { WebElement recipientBox = this.getRecipientBox(); recipientBox.sendKeys(recipient); }
Source:
public void should_successfully_build_city_even_if_user_does_not_have_resources_in_preparation_stage() { startNewGame(12, 2) .BUILD_SETTLEMENT(1).atNode(2, -2, "topLeft") .BUILD_ROAD(1).atEdge(2, -2, "topLeft") .END_TURN(1) .BUILD_SETTLEMENT(2).atNode(2, -1, "bottomRight") .BUILD_ROAD(2).atEdge(2, -1, "bottomRight") .END_TURN(2) .BUILD_SETTLEMENT(3).atNode(0, 2, "topRight") .BUILD_ROAD(3).atEdge(0, 2, "topRight") .END_TURN(3) .getGameDetails(3).gameUser(3).check("resources.wheat", is(0)) .getGameDetails(3).gameUser(3).check("resources.stone", is(0)) .BUILD_CITY(3).atNode(0, 0, "bottomRight").successfully() .getGameDetails(3).gameUser(3).check("resources.wheat", is(0)) .getGameDetails(3).gameUser(3).check("resources.stone", is(0)); }

Target:
public void should_successfully_build_city_even_if_user_does_not_have_resources_in_preparation_stage() { startNewGame(12, 2) .BUILD_SETTLEMENT(1).atNode(2, -2, "topLeft") .BUILD_ROAD(1).atEdge(2, -2, "topLeft") .END_TURN(1) .BUILD_SETTLEMENT(2).atNode(2, -1, "bottomRight") .BUILD_ROAD(2).atEdge(2, -1, "bottomRight") .END_TURN(2) .BUILD_SETTLEMENT(3).atNode(0, 2, "topRight") .BUILD_ROAD(3).atEdge(0, 2, "topRight") .END_TURN(3) .getGameDetails(3).gameUser(3).check("resources.wheat", is(0)) .getGameDetails(3).gameUser(3).check("resources.stone", is(0)) .BUILD_CITY(3).atNode(0, 0, "bottomRight").successfully(); }
Source:
public Void execute(final WriteBinding binding) { return withConnection(binding, new CallableWithConnection<Void>() { @Override public Void call(final Connection connection) { if (connection.getServerDescription().getVersion().compareTo(new ServerVersion(2, 6)) >= 0) { try { executeWrappedCommandProtocol(namespace.getDatabaseName(), getCommand(), connection); } catch (MongoCommandFailureException e) { throw checkForDuplicateKeyError(e); } } else { for (Index index : indexes) { asInsertProtocol(index).execute(connection); } } return null; } }); }

Target:
public Void execute(final WriteBinding binding) { return withConnection(binding, new CallableWithConnection<Void>() { @Override public Void call(final Connection connection) { if (serverIsAtLeastVersionTwoDotSix(connection)) { try { executeWrappedCommandProtocol(namespace.getDatabaseName(), getCommand(), connection); } catch (MongoCommandFailureException e) { throw checkForDuplicateKeyError(e); } } else { for (Index index : indexes) { asInsertProtocol(index).execute(connection); } } return null; } }); }
Source:
protected boolean beforeInvoke() throws Exception { if (0 <= commandTopologyId && commandTopologyId < handler.stateTransferManager.getFirstTopologyAsMember()) { if (handler.isTraceEnabled()) { handler.getLog().tracef("Ignoring command sent before the local node was a member " + "(command topology id is %d)", commandTopologyId); } response = CacheNotFoundResponse.INSTANCE; return false; } return true; }

Target:
protected Response beforeInvoke() throws Exception { if (0 <= commandTopologyId && commandTopologyId < handler.stateTransferManager.getFirstTopologyAsMember()) { if (handler.isTraceEnabled()) { handler.getLog().tracef("Ignoring command sent before the local node was a member " + "(command topology id is %d)", commandTopologyId); } return CacheNotFoundResponse.INSTANCE; } return null; }
Source:
public TaskResult runTask() { Optional<String> paramServerType = systemConfig.getOptional("param_server.database.type", String.class); if(!paramServerType.isPresent()){ throw new ConfigException("param_server.database.type is required to use this operator."); } Config params = request.getLocalConfig(); List<String> keys = params.getKeys(); if (keys.size() == 0) { throw new ConfigException("no key is set."); } paramServerClient.begin(); for (String key : keys) { Optional<String> value = params.getOptional(key, String.class); if (value.isPresent()) { paramServerClient.set(key, value.get(), request.getSiteId()); } } paramServerClient.finalize(); return TaskResult.empty(request); }

Target:
public TaskResult runTask() { Optional<String> paramServerType = systemConfig.getOptional("param_server.type", String.class); if (!paramServerType.isPresent()) { throw new ConfigException("param_server.type is required to use this operator."); } Config localParams = request.getLocalConfig(); List<String> keys = localParams.getKeys(); if (keys.size() == 0) { throw new ConfigException("no key is set."); } paramServerClient.doTransaction(client -> { for (String key : keys) { Optional<String> value = localParams.getOptional(key, String.class); if (value.isPresent()) { paramServerClient.set(key, value.get(), request.getSiteId()); } } }); return TaskResult.empty(request); }
Source:
public void setJSRuntimeArguments(String runtimeArgs) { if (fRuntimeArgs == null) { if (runtimeArgs == null) { return; } } else if (fRuntimeArgs.equals(runtimeArgs)) { return; } fRuntimeArgs = runtimeArgs; }

Target:
public void setJSRuntimeArguments(String runtimeArgs) { fRuntimeArgs = runtimeArgs; }
Source:
public void testAtleastOnce() throws Exception { try { HBaseTestHelper.clearHBase(); TestHBasePutOperator thop = new TestHBasePutOperator(); thop.getStore().setTableName("table1"); thop.getStore().setZookeeperQuorum("127.0.0.1"); thop.getStore().setZookeeperClientPort(2181); HBaseTuple t1=new HBaseTuple(); t1.setColFamily("colfam0");t1.setColName("street");t1.setRow("row1");t1.setColValue("ts"); HBaseTuple t2=new HBaseTuple(); t2.setColFamily("colfam0");t2.setColName("city");t2.setRow("row2");t2.setColValue("tc"); thop.setup(new OperatorContext() { @Override public <T> T getValue(Attribute<T> key) { if(key.equals(PROCESSING_MODE)){ return (T) ProcessingMode.AT_LEAST_ONCE; } return key.defaultValue; } @Override public AttributeMap getAttributes() { return null; } @Override public int getId() { return 0; } @Override public void setCounters(Object counters) { } @Override public void sendMetrics(Collection<String> collection) { } @Override public int getWindowsFromCheckpoint() { return 0; } @Override public String getName() { return "TestHBasePutOperator"; } }); thop.beginWindow(0); thop.input.process(t1); thop.input.process(t2); thop.endWindow(); HBaseTuple tuple; tuple = HBaseTestHelper .getHBaseTuple("row1", "colfam0", "street"); Assert.assertNotNull("Tuple", tuple); Assert.assertEquals("Tuple row", tuple.getRow(), "row1"); Assert.assertEquals("Tuple column family", tuple.getColFamily(), "colfam0"); Assert.assertEquals("Tuple column name", tuple.getColName(),"street"); Assert.assertEquals("Tuple column value", tuple.getColValue(),"ts"); } catch (IOException e) { logger.error(e.getMessage()); } }

Target:
public void testAtleastOnce() throws Exception { try { HBaseTestHelper.clearHBase(); TestHBasePutOperator thop = new TestHBasePutOperator(); thop.getStore().setTableName("table1"); thop.getStore().setZookeeperQuorum("127.0.0.1"); thop.getStore().setZookeeperClientPort(2181); HBaseTuple t1=new HBaseTuple(); t1.setColFamily("colfam0");t1.setColName("street");t1.setRow("row1");t1.setColValue("ts"); HBaseTuple t2=new HBaseTuple(); t2.setColFamily("colfam0");t2.setColName("city");t2.setRow("row2");t2.setColValue("tc"); AttributeMap.DefaultAttributeMap attributeMap = new AttributeMap.DefaultAttributeMap(); attributeMap.put(OperatorContext.PROCESSING_MODE, ProcessingMode.AT_LEAST_ONCE); thop.setup(mockOperatorContext(0, attributeMap)); thop.beginWindow(0); thop.input.process(t1); thop.input.process(t2); thop.endWindow(); HBaseTuple tuple; tuple = HBaseTestHelper .getHBaseTuple("row1", "colfam0", "street"); Assert.assertNotNull("Tuple", tuple); Assert.assertEquals("Tuple row", tuple.getRow(), "row1"); Assert.assertEquals("Tuple column family", tuple.getColFamily(), "colfam0"); Assert.assertEquals("Tuple column name", tuple.getColName(),"street"); Assert.assertEquals("Tuple column value", tuple.getColValue(),"ts"); } catch (IOException e) { logger.error(e.getMessage()); } }
Source:
public void canUpdateConservativeMetrics() { metrics.updateEnqueuedWrites(CONS_ZERO, 10); metrics.updateEntriesRead(CONS_ZERO, 21); metrics.updateNumberOfTombstones(CONS_ZERO, 1); metrics.updateAbortedWritesDeleted(CONS_ZERO, 2); metrics.updateSweepTimestamp(CONS_ZERO, 7); metrics.updateProgressForShard(CONS_ZERO, 4); waitForProgressToRecompute(); assertEnqueuedWritesConservativeEquals(10); assertEntriesReadConservativeEquals(21); assertTombstonesPutConservativeEquals(1); assertAbortedWritesDeletedConservativeEquals(2); assertSweepTimestampConservativeEquals(7); assertLastSweptTimestampConservativeEquals(4); puncherStore.put(3, 2); puncherStore.put(4, 4); puncherStore.put(5, 40); assertMillisSinceLastSweptConservativeEquals(4); }

Target:
public void canUpdateConservativeMetrics() { metrics.updateEnqueuedWrites(CONS_ZERO, 10); metrics.updateEntriesRead(CONS_ZERO, 21); metrics.updateNumberOfTombstones(CONS_ZERO, 1); metrics.updateAbortedWritesDeleted(CONS_ZERO, 2); metrics.updateSweepTimestamp(CONS_ZERO, 7); metrics.updateProgressForShard(CONS_ZERO, 4); waitForProgressToRecompute(); assertEnqueuedWritesConservativeEquals(10); assertEntriesReadConservativeEquals(21); assertTombstonesPutConservativeEquals(1); assertAbortedWritesDeletedConservativeEquals(2); assertSweepTimestampConservativeEquals(7); assertLastSweptTimestampConservativeEquals(4); puncherStore.put(3, 2); puncherStore.put(4, 15); puncherStore.put(5, 40); assertMillisSinceLastSweptConservativeEqualsClockTimeMinus(15); }
Source:
public static InterfaceParams getByName(String name) { if (name == null) return null; try { final NetworkInterface netif = NetworkInterface.getByName(name); if (netif != null) { final MacAddress macAddr = netif.isLoopback() ? null : MacAddress.fromBytes(netif.getHardwareAddress()); return new InterfaceParams( name, netif.getIndex(), macAddr, netif.getMTU()); } } catch (IllegalArgumentException|SocketException e) return null; }

Target:
public static InterfaceParams getByName(String name) { final NetworkInterface netif = getNetworkInterfaceByName(name); if (netif == null) return null; final MacAddress macAddr = getMacAddress(netif); try { return new InterfaceParams(name, netif.getIndex(), macAddr, netif.getMTU()); } catch (IllegalArgumentException|NullPointerException|SocketException e) { return null; } }
Source:
private PDataType getViewIndexType(Cell[] tableKeyValues) { Cell dataTypeKv = tableKeyValues[VIEW_INDEX_ID_DATA_TYPE]; return PDataType.fromTypeId(PInteger.INSTANCE.getCodec() .decodeInt(dataTypeKv.getValueArray(), dataTypeKv.getValueOffset(), SortOrder.getDefault())); }

Target:
private PDataType getViewIndexType(Cell[] tableKeyValues) { Cell dataTypeKv = tableKeyValues[VIEW_INDEX_ID_DATA_TYPE_INDEX]; return dataTypeKv == null ? MetaDataUtil.getLegacyViewIndexIdDataType() : PDataType.fromTypeId(PInteger.INSTANCE.getCodec() .decodeInt(dataTypeKv.getValueArray(), dataTypeKv.getValueOffset(), SortOrder.getDefault())); }
Source:
void updatePrimaryStar() { if (_env == null || !OTOptions.isEditable(_obsComp.getProgram(), _obsComp.getContextObservation())) return; final TargetEnvironment env = _dataObject.getTargetEnvironment(); final Option<SPTarget> targetOpt = getSelectedPos(); final Option<IndexedGuideGroup> iggOpt = targetOpt.flatMap(this::getTargetGroup).orElse(getSelectedGroup()); final boolean primaryGroupIsSelected = iggOpt.exists(igg -> igg.group().equals(env.getPrimaryGuideGroup())); iggOpt.foreach(igg -> { final GuideGroup primary = env.getPrimaryGuideGroup(); ImOption.apply(env.getGuideEnvironment()).foreach(ge -> { final GuideGrp grp = igg.group().grp(); if (ge != null && grp instanceof AutomaticGroup.Disabled$) { final TargetEnvironment envNew = env.setGuideEnvironment(ge.setAutomaticGroup(GuideGroup.AutomaticInitial()).setPrimaryIndex(0)); _dataObject.setTargetEnvironment(envNew); _model.enableAutoRow(envNew); } else if (ge != null && primary != igg.group() && confirmGroupChange(primary, igg.group())) { _dataObject.setTargetEnvironment(env.setGuideEnvironment(ge.setPrimaryIndex(igg.index()))); if (grp instanceof AutomaticGroup.Active) { updatePosAngle(((AutomaticGroup.Active) grp).posAngle()); } } }); }); final boolean autoGroup = targetOpt.flatMap(this::getTargetGroup).exists(igg -> igg.group().isAutomatic()); if (!autoGroup) { targetOpt.foreach(target -> { if (primaryGroupIsSelected || iggOpt.exists(igg -> igg.group().getAllContaining(target).forall(gpt -> gpt.getPrimary().forall(pt -> pt != target)))) { PrimaryTargetToggle.instance.toggle(_dataObject, target); } }); } }

Target:
void updatePrimaryStar() { if (_env == null || !OTOptions.isEditable(_obsComp.getProgram(), _obsComp.getContextObservation())) return; final TargetEnvironment env = _dataObject.getTargetEnvironment(); final Option<SPTarget> targetOpt = getSelectedPos(); final Option<IndexedGuideGroup> iggOpt = targetOpt.flatMap(this::getTargetGroup).orElse(getSelectedGroup()); final boolean primaryGroupIsSelected = iggOpt.exists(igg -> igg.group().equals(env.getPrimaryGuideGroup())); iggOpt.foreach(igg -> { final GuideGroup primary = env.getPrimaryGuideGroup(); ImOption.apply(env.getGuideEnvironment()).foreach(ge -> { final GuideGrp grp = igg.group().grp(); if (grp instanceof AutomaticGroup.Disabled$) { final TargetEnvironment envNew = env.setGuideEnvironment(ge.setAutomaticGroup(GuideGroup.AutomaticInitial()).setPrimaryIndex(0)); _dataObject.setTargetEnvironment(envNew); _model.enableAutoRow(envNew); } else if (primary != igg.group() && confirmGroupChange(primary, igg.group())) { _dataObject.setTargetEnvironment(env.setGuideEnvironment(ge.setPrimaryIndex(igg.index()))); if (grp instanceof AutomaticGroup.Active) { updatePosAngle(((AutomaticGroup.Active) grp).posAngle()); } } }); }); final boolean autoGroup = targetOpt.flatMap(this::getTargetGroup).exists(igg -> igg.group().isAutomatic()); if (!autoGroup) { targetOpt.foreach(target -> { if (primaryGroupIsSelected || iggOpt.exists(igg -> igg.group().getAllContaining(target).forall(gpt -> gpt.getPrimary().forall(pt -> pt != target)))) { PrimaryTargetToggle.instance.toggle(_dataObject, target); } }); } }
Source:
public void succededToHibernate() { TransactionSupport.executeInNewTransaction( new TransactionMethod<Object>() { @Override public Object runInTransaction() { VmDynamic vmDynamic = db().getVmDynamicDao().get(id); vmDynamic.setStatus(VMStatus.SavingState); update(vmDynamic); return null; } } ); }

Target:
public void succededToHibernate() { TransactionSupport.executeInNewTransaction( new TransactionMethod<Object>() { @Override public Object runInTransaction() { VmDynamic vmDynamic = getVmDynamicDao().get(id); vmDynamic.setStatus(VMStatus.SavingState); update(vmDynamic); return null; } } ); }
Source:
private void declareGenericFlowParameters(@Nullable FlowGenericParameterClauseTree flowGenericParameterClauseTree) { if (flowGenericParameterClauseTree != null) { List<IdentifierTree> genericParams = flowGenericParameterClauseTree.genericParameters().stream().map(FlowGenericParameterTree::identifier).collect(Collectors.toList()); declareParameters(genericParams); } }

Target:
private void declareGenericFlowParameters(@Nullable FlowGenericParameterClauseTree flowGenericParameterClauseTree) { if (flowGenericParameterClauseTree != null) { flowGenericParameterClauseTree.genericParameters().stream() .map(FlowGenericParameterTree::identifier) .forEach(identifier -> symbolModel.declareSymbol(identifier.name(), Symbol.Kind.FLOW_GENERIC_TYPE, currentScope) .addUsage(identifier, Usage.Kind.LEXICAL_DECLARATION)); } }
Source:
private double cleanNumber(double dirtyNumber) { double clean; if (dirtyNumber < 1) clean = 0; else clean = dirtyNumber; return clean; }

Target:
private double cleanNumber(double dirtyNumber) { return dirtyNumber < 1 ? 0 : dirtyNumber; }
Source:
void sendScheduledMessageAndReceive(MessagingEntityType entityType, boolean isSessionEnabled) { setSenderAndReceiver(entityType, 0, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); final OffsetDateTime scheduledEnqueueTime = OffsetDateTime.now().plusSeconds(2); sender.scheduleMessage(message, scheduledEnqueueTime).block(TIMEOUT); StepVerifier.create(Mono.delay(Duration.ofSeconds(4)).then(receiver.receiveMessages().next())) .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); receiver.complete(receivedMessage).block(Duration.ofSeconds(15)); messagesPending.decrementAndGet(); }) .verifyComplete(); }

Target:
void sendScheduledMessageAndReceive(MessagingEntityType entityType, boolean isSessionEnabled) { setSenderAndReceiver(entityType, 0, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); final OffsetDateTime scheduledEnqueueTime = OffsetDateTime.now().plusSeconds(2); sender.scheduleMessage(message, scheduledEnqueueTime).block(TIMEOUT); StepVerifier.create(Mono.delay(Duration.ofSeconds(4)).then(receiver.receiveMessages().next())) .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); receiver.complete(receivedMessage).block(OPERATION_TIMEOUT); messagesPending.decrementAndGet(); }) .verifyComplete(); }