auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testSET_should_not_clearPreviousTTL_onFailure() { String key_NX = "nx_key"; String value_NX = "set only if key did not exist"; int secondsUntilExpiration = 20; SetParams setParamsEX = new SetParams(); setParamsEX.ex(secondsUntilExpiration); SetParams setParamsXX = new SetParams(); setParamsXX.xx(); SetParams setParamsNX = new SetParams(); setParamsNX.nx(); jedis.set(key_NX, value_NX, setParamsEX); String result_NX = jedis.set(key_NX, value_NX, setParamsNX); assertThat(result_NX).isNull(); Long result = jedis.ttl(key_NX); assertThat(result).isGreaterThan(15L); }

Target:
public void testSET_should_not_clearPreviousTTL_onFailure() { String key_NX = "nx_key"; String value_NX = "set only if key did not exist"; int secondsUntilExpiration = 20; SetParams setParamsEX = new SetParams(); setParamsEX.ex(secondsUntilExpiration); SetParams setParamsNX = new SetParams(); setParamsNX.nx(); jedis.set(key_NX, value_NX, setParamsEX); String result_NX = jedis.set(key_NX, value_NX, setParamsNX); assertThat(result_NX).isNull(); Long result = jedis.ttl(key_NX); assertThat(result).isGreaterThan(15L); }
Source:
public static TimestampBoundStore create( ConnectionManager connManager, TableReference timestampTable, String tablePrefixString) { return createWithStrategy( connManager, new LegacyPhysicalBoundStoreStrategy(timestampTable, tablePrefixString), false); }

Target:
public static TimestampBoundStore create( ConnectionManager connManager, TableReference timestampTable, String tablePrefixString) { return createWithStrategy( connManager, new LegacyPhysicalBoundStoreStrategy(timestampTable, tablePrefixString), AtlasDbConstants.DEFAULT_INITIALIZE_ASYNC); }
Source:
protected String getApiURl() { String hostUrl = null; String appType = null; String appMode = mProperties.getProperty(APP_MODE_KEY); try { if(mCloudProps.has("url")){ hostUrl = mCloudProps.getString("url"); } else { JSONObject hosts = mCloudProps.getJSONObject("hosts"); if ("dev".equalsIgnoreCase(appMode)) { hostUrl = hosts.getString("debugCloudUrl"); appType = hosts.getString("debugCloudType"); } else { hostUrl = hosts.getString("releaseCloudUrl"); appType = hosts.getString("releaseCloudType"); } hostUrl = hostUrl.endsWith("/") ? hostUrl : hostUrl + "/"; if ("node".equalsIgnoreCase(appType)) { hostUrl = hostUrl + getPath(); } else { String domain = mCloudProps.getString("domain"); String appId = mProperties.getProperty(APP_ID_KEY); hostUrl = hostUrl + "box/srv/1.1/act/" + domain + "/" + appId + "/" + mRemoteAct + "/" + appId; } } FHLog.v(LOG_TAG, "act url = " + hostUrl); } catch (Exception e) { FHLog.e(LOG_TAG, e.getMessage(), e); } return hostUrl; }

Target:
protected String getApiURl() { String hostUrl = null; String appType = null; String appMode = mProperties.getProperty(APP_MODE_KEY); try { if(mCloudProps.has("url")){ hostUrl = mCloudProps.getString("url"); appType = "node"; } else { JSONObject hosts = mCloudProps.getJSONObject("hosts"); if ("dev".equalsIgnoreCase(appMode)) { hostUrl = hosts.getString("debugCloudUrl"); appType = hosts.getString("debugCloudType"); } else { hostUrl = hosts.getString("releaseCloudUrl"); appType = hosts.getString("releaseCloudType"); } } hostUrl = hostUrl.endsWith("/") ? hostUrl : hostUrl + "/"; if ("node".equalsIgnoreCase(appType)) { hostUrl = hostUrl + getPath(); } else { String domain = mCloudProps.getString("domain"); String appId = mProperties.getProperty(APP_ID_KEY); hostUrl = hostUrl + "box/srv/1.1/act/" + domain + "/" + appId + "/" + mRemoteAct + "/" + appId; } FHLog.v(LOG_TAG, "act url = " + hostUrl); } catch (Exception e) { FHLog.e(LOG_TAG, e.getMessage(), e); } return hostUrl; }
Source:
public NetworkHttpClient() { RequestConfig config = RequestConfig.custom() .setConnectTimeout(CONNECTION_TIMEOUT) .setSocketTimeout(SOCKET_TIMEOUT) .build(); Collection<Header> headers = Lists.<Header>newArrayList( new BasicHeader("X-Twilio-Client", "java-" + Twilio.VERSION), new BasicHeader(HttpHeaders.USER_AGENT, "twilio-java/" + Twilio.VERSION + " (" + Twilio.JAVA_VERSION + ")"), new BasicHeader(HttpHeaders.ACCEPT, "application/json"), new BasicHeader(HttpHeaders.ACCEPT_ENCODING, "utf-8") ); String googleAppEngineVersion = System.getProperty("com.google.appengine.runtime.version"); boolean isGoogleAppEngine = googleAppEngineVersion != null && !googleAppEngineVersion.isEmpty(); org.apache.http.impl.client.HttpClientBuilder clientBuilder = HttpClientBuilder.create(); if (!isGoogleAppEngine) { clientBuilder.useSystemProperties(); } clientBuilder .setConnectionManager(new PoolingHttpClientConnectionManager()) .setDefaultRequestConfig(config) .setDefaultHeaders(headers) .setMaxConnPerRoute(10); client = clientBuilder.build(); }

Target:
public NetworkHttpClient() { RequestConfig config = RequestConfig.custom() .setConnectTimeout(CONNECTION_TIMEOUT) .setSocketTimeout(SOCKET_TIMEOUT) .build(); Collection<Header> headers = Lists.<Header>newArrayList( new BasicHeader("X-Twilio-Client", "java-" + Twilio.VERSION), new BasicHeader(HttpHeaders.USER_AGENT, "twilio-java/" + Twilio.VERSION + " (" + Twilio.JAVA_VERSION + ")"), new BasicHeader(HttpHeaders.ACCEPT, "application/json"), new BasicHeader(HttpHeaders.ACCEPT_ENCODING, "utf-8") ); String googleAppEngineVersion = System.getProperty("com.google.appengine.runtime.version"); boolean isNotGoogleAppEngine = Strings.isNullOrEmpty(googleAppEngineVersion); org.apache.http.impl.client.HttpClientBuilder clientBuilder = HttpClientBuilder.create(); if (isNotGoogleAppEngine) { clientBuilder.useSystemProperties(); } clientBuilder .setConnectionManager(new PoolingHttpClientConnectionManager()) .setDefaultRequestConfig(config) .setDefaultHeaders(headers) .setMaxConnPerRoute(10); client = clientBuilder.build(); }
Source:
private String getExceptionText(Exception e) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); e.printStackTrace(new PrintStream(bos)); return new String(bos.toByteArray()); } catch (Exception ex) { return null; } }

Target:
private static String getExceptionText(Exception e) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); e.printStackTrace(new PrintStream(bos)); return new String(bos.toByteArray()); } catch (Exception ex) { return null; } }
Source:
public static InputStream asInputStream(final String inputString) { return IOUtils.toInputStream(Strings.nullToEmpty(inputString), StandardCharsets.UTF_8); }

Target:
public static InputStream asInputStream(final String inputString) { return new ByteArrayInputStream( Strings.nullToEmpty(inputString).getBytes(StandardCharsets.UTF_8)); }
Source:
public void clear() { if (handlerHelper == null || binder == null) { return; } if (panel != null) { for (Widget widget : panel){ ArrayList<InputElement> inputFields = new ArrayList<InputElement>(); ArrayList<TextAreaElement> textareaFields = new ArrayList<TextAreaElement>(); getFields(widget.getElement(),inputFields,textareaFields); for (InputElement field : inputFields) { setField(field.getId(),field.getValue()); } for (TextAreaElement field : textareaFields) { String containerId = field.getParentElement().getParentElement().getId(); String fieldId = containerId.substring(0,containerId.length() - 11); setField(fieldId,field.getValue()); } } } for (PropertyChangeUnsubscribeHandle handle : unsubscribeHandlers) { handle.unsubscribe(); } unsubscribeHandlers.clear(); formFields.clear(); fieldChangeManager.clear(); if (handlerHelper.supportsInputBinding()) { binder.unbind(); } }

Target:
public void clear() { if (handlerHelper == null || binder == null) { return; } for (PropertyChangeUnsubscribeHandle handle : unsubscribeHandlers) { handle.unsubscribe(); } unsubscribeHandlers.clear(); formFields.clear(); fieldChangeManager.clear(); if (handlerHelper.supportsInputBinding()) { binder.unbind(); } }
Source:
private byte getUsageCounter( long pageRef ) { return (byte) (UnsafeUtil.getLongVolatile( offFilePageId( pageRef ) ) & 0x07); }

Target:
private byte getUsageCounter( long pageRef ) { return (byte) (UnsafeUtil.getLongVolatile( offFilePageId( pageRef ) ) & MASK_USAGE_COUNT); }
Source:
public void testReadLines() throws IOException { String tmpPath = System.getProperty("java.io.tmpdir"); String userName = System.getProperty("user.name"); File tmpDir = new File(tmpPath, userName); tmpDir.mkdir(); tmpDir.deleteOnExit(); Path file = Paths.get(tmpDir.getAbsolutePath(), "tmp.txt"); Random rand = new Random(System.currentTimeMillis()); BufferedWriter writer = Files.newBufferedWriter(file); final int nLines = 5; String[] lines = new String[nLines]; for (int i = 0; i < nLines; i++) { String line = TEST_STRING + Integer.toString(rand.nextInt(100000000)); lines[i] = line; writer.write(line); writer.newLine(); } writer.close(); file.toFile().deleteOnExit(); IterableOnceIterator<String> retLines = IOUtil.readLines(file.toFile()); Stream<String> expectedLines = Stream.of(lines); Iterator<String> itExpected = expectedLines.iterator(); while (retLines.hasNext() && itExpected.hasNext()) { Assert.assertEquals(retLines.next(), itExpected.next()); } Assert.assertFalse(retLines.hasNext()); Assert.assertFalse(itExpected.hasNext()); }

Target:
public void testReadLines() throws IOException { final Path file = Files.createTempFile("tmp", ".txt"); file.toFile().deleteOnExit(); final int seed = 12394738; final Random rand = new Random(seed); final int nLines = 5; final List<String> lines = new ArrayList<String>(); try (final PrintWriter writer = new PrintWriter(Files.newBufferedWriter(file))) { for (int i = 0; i < nLines; i++) { final String line = TEST_STRING + Integer.toString(rand.nextInt(100000000)); lines.add(line); writer.println(line); } } final List<String> retLines = new ArrayList<String>(); IOUtil.readLines(file.toFile()).forEachRemaining(retLines::add); Assert.assertEquals(retLines, lines); }
Source:
private void handleExceptionDuringHandshake(HandshakeException cause, AlertLevel level, AlertDescription description, Record record) { if (AlertLevel.FATAL.equals(level)) { if (AlertDescription.UNKNOWN_PSK_IDENTITY != description) { terminateOngoingHandshake(record.getPeerAddress(), cause, description); } } discardRecord(record, cause); }

Target:
private void handleExceptionDuringHandshake(HandshakeException cause, AlertLevel level, AlertDescription description, Record record) { if (!AlertLevel.FATAL.equals(level)) { discardRecord(record, cause); return; } if (AlertDescription.UNKNOWN_PSK_IDENTITY == description) { discardRecord(record, cause); return; } terminateOngoingHandshake(record.getPeerAddress(), cause, description); }
Source:
private FilterSet getRef() { return getCheckedRef(FilterSet.class); }

Target:
protected FilterSet getRef() { return getCheckedRef(FilterSet.class); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_sensor_location); button = (Button)findViewById(R.id.saveSensorLocation); buttonCancel = (Button)findViewById(R.id.saveSensorLocationCancel); sensor_location_other = (EditText) findViewById(R.id.edit_sensor_location); sensor_location_other.setEnabled(false); DontAskAgain = (CheckBox)findViewById(R.id.sensorLocationDontAskAgain); radioGroup = (RadioGroup) findViewById(R.id.myRadioGroup); addListenerOnButton(); locations = new LinkedList<Location>(); locations.add(new Location("private", PRIVATE_ID)); locations.add(new Location("Upper arm", 1)); locations.add(new Location("Thigh", 2)); locations.add(new Location("Belly (abdomen)", 3)); locations.add(new Location("Lower back", 4)); locations.add(new Location("buttocks", 5)); locations.add(new Location("other", OTHER_ID)); for(Location location : locations) { AddButton(location.location, location.location_id); } radioGroup.check(PRIVATE_ID); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_sensor_location); button = (Button)findViewById(R.id.saveSensorLocation); buttonCancel = (Button)findViewById(R.id.saveSensorLocationCancel); sensor_location_other = (EditText) findViewById(R.id.edit_sensor_location); sensor_location_other.setEnabled(false); DontAskAgain = (CheckBox)findViewById(R.id.sensorLocationDontAskAgain); radioGroup = (RadioGroup) findViewById(R.id.myRadioGroup); addListenerOnButton(); locations = new LinkedList<Location>(); locations.add(new Location("I dont wish to share", PRIVATE_ID)); locations.add(new Location("Upper arm", 1)); locations.add(new Location("Thigh", 2)); locations.add(new Location("Belly (abdomen)", 3)); locations.add(new Location("Lower back", 4)); locations.add(new Location("buttocks", 5)); locations.add(new Location("other", OTHER_ID)); for(Location location : locations) { AddButton(location.location, location.location_id); } radioGroup.check(PRIVATE_ID); }
Source:
private void validateLocation(ISuspendedDMEvent suspendedEvent, String expectedFunction, String expectedFile, int expectedLine, int expectedDepth) throws Throwable { assertNotNull(suspendedEvent); assertTrue("Expected suspended event to be IMIDMEvent, but it was not.", suspendedEvent instanceof IMIDMEvent); Object miEvent = ((IMIDMEvent)suspendedEvent).getMIEvent(); assertTrue("Expected mi event to be MIStoppedEvent, but it was not.", suspendedEvent instanceof IMIDMEvent); MIStoppedEvent stoppedEvent = (MIStoppedEvent)miEvent; MIFrame frame = stoppedEvent.getFrame(); assertTrue("Not inside the expected function. Expected " + expectedFunction + " but got " + frame.getFunction(), frame.getFunction().endsWith(expectedFunction)); assertEquals(expectedLine, frame.getLine()); assertTrue("Not inside the expected file. Expected " + expectedFile + " but got " + frame.getFile(), frame.getFile().endsWith(expectedFile)); int newDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext()); assertEquals(expectedDepth, newDepth); checkGdbIsSuspended(); }

Target:
private void validateLocation(ISuspendedDMEvent suspendedEvent, String expectedFunction, String expectedFile, int expectedLine, int expectedDepth) throws Throwable { assertNotNull(suspendedEvent); assertTrue("Expected suspended event to be IMIDMEvent, but it was not.", suspendedEvent instanceof IMIDMEvent); Object miEvent = ((IMIDMEvent)suspendedEvent).getMIEvent(); assertTrue("Expected mi event to be MIStoppedEvent, but it was not.", miEvent instanceof MIStoppedEvent); MIStoppedEvent stoppedEvent = (MIStoppedEvent)miEvent; MIFrame frame = stoppedEvent.getFrame(); assertTrue("Not inside the expected function. Expected " + expectedFunction + " but got " + frame.getFunction(), frame.getFunction().endsWith(expectedFunction)); assertEquals(expectedLine, frame.getLine()); assertTrue("Not inside the expected file. Expected " + expectedFile + " but got " + frame.getFile(), frame.getFile().endsWith(expectedFile)); int newDepth = SyncUtil.getStackDepth(stoppedEvent.getDMContext()); assertEquals(expectedDepth, newDepth); checkGdbIsSuspended(); }
Source:
public void getObsByPatientId_shouldGetADefaultRepresentationOfAllObs() throws Exception { MockHttpServletRequest req = newGetRequest(getURI(), new Parameter("patient", "da7f524f-27ce-4bb2-86d6-6d1d05312bd5")); SimpleObject result = deserialize(handle(req)); List<Object> results = Util.getResultsList(result); Assert.assertNotNull(results); results.get(8); Assert.assertEquals(9, results.size()); Assert.assertNotNull(PropertyUtils.getProperty(result, "links")); Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid")); Assert.assertNotNull(PropertyUtils.getProperty(result, "display")); }

Target:
public void getObsByPatientId_shouldGetADefaultRepresentationOfAllObs() throws Exception { MockHttpServletRequest req = newGetRequest(getURI(), new Parameter("patient", "5946f880-b197-400b-9caa-a3c661d23041")); SimpleObject result = deserialize(handle(req)); List<Object> results = Util.getResultsList(result); Assert.assertNotNull(results); Object obs = results.get(8); Assert.assertEquals(9, results.size()); Assert.assertNotNull(PropertyUtils.getProperty(obs, "links")); Assert.assertNotNull(PropertyUtils.getProperty(obs, "uuid")); Assert.assertNotNull(PropertyUtils.getProperty(obs, "display")); }
Source:
public void testTaskSummaryAdmin() { final List<String> dataSets = Arrays.asList( HUMAN_TASKS_WITH_ADMIN_DATASET, HUMAN_TASKS_WITH_USER_DATASET, HUMAN_TASKS_DATASET, HUMAN_TASKS_WITH_VARIABLES_DATASET); for (final String dataSet : dataSets) { when(dataSetMock.getUUID()).thenReturn(dataSet); final TaskSummary summary; if(HUMAN_TASKS_WITH_ADMIN_DATASET.equals(dataSet)) { summary = new TaskAdminSummaryDataSetMapper().apply(dataSetMock, 0); }else { summary = new TaskSummaryDataSetMapper().apply(dataSetMock, 0); } assertNotNull(summary); assertEquals(HUMAN_TASKS_WITH_ADMIN_DATASET.equals(dataSet), summary.isForAdmin()); } }

Target:
public void testTaskSummaryAdmin() { final List<String> dataSets = Arrays.asList( HUMAN_TASKS_WITH_ADMIN_DATASET, HUMAN_TASKS_WITH_USER_DATASET, HUMAN_TASKS_DATASET, HUMAN_TASKS_WITH_VARIABLES_DATASET); for (final String dataSet : dataSets) { when(dataSetMock.getUUID()).thenReturn(dataSet); final TaskSummary summary = new TaskSummaryDataSetMapper().apply(dataSetMock, 0); assertNotNull(summary); assertEquals(HUMAN_TASKS_WITH_ADMIN_DATASET.equals(dataSet), summary.isForAdmin()); } }
Source:
public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int indexOfChangeIdLine = 0; boolean inFooter = false; for (int i = lines.length - 1; i >= 0; --i) { if (!inFooter && isEmptyLine(lines[i])) continue; inFooter = true; if (changeIdPattern.matcher(lines[i].trim()).matches()) { indexOfChangeIdLine = i; break; } else if (isEmptyLine(lines[i]) || i == 0) return -1; } int indexOfChangeIdLineinString = 0; for (int i = 0; i < indexOfChangeIdLine; ++i) indexOfChangeIdLineinString += lines[i].length() + delimiter.length(); return indexOfChangeIdLineinString + lines[indexOfChangeIdLine].indexOf(CHANGE_ID); }

Target:
public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int indexOfChangeIdLine = 0; boolean inFooter = false; for (int i = lines.length - 1; i >= 0; --i) { if (!inFooter && isEmptyLine(lines[i])) continue; inFooter = true; if (changeIdPattern.matcher(trimRight(lines[i])).matches()) { indexOfChangeIdLine = i; break; } else if (isEmptyLine(lines[i]) || i == 0) return -1; } int indexOfChangeIdLineinString = 0; for (int i = 0; i < indexOfChangeIdLine; ++i) indexOfChangeIdLineinString += lines[i].length() + delimiter.length(); return indexOfChangeIdLineinString + lines[indexOfChangeIdLine].indexOf(CHANGE_ID); }
Source:
public void save(final Map<?, ?> options) throws IOException { TransactionalEditingDomain domain = ((ModelSet) getResourceSet()).getTransactionalEditingDomain(); CompoundCommand compoundCommand = new CompoundCommandNonDirty("Modify top tables"); for (final EObject top : getContents()) { if (top instanceof Table) { compoundCommand.append(getDisposeTableCommand(domain, (Table) top)); } } domain.getCommandStack().execute(compoundCommand); super.save(options); }

Target:
public void save(final Map<?, ?> options) throws IOException { final TransactionalEditingDomain domain = ((ModelSet) getResourceSet()).getTransactionalEditingDomain(); final CompoundCommand compoundCommand = new CompoundCommand("Modify top tables"); for (final EObject top : getContents()) { if (top instanceof Table) { compoundCommand.append(getDisposeTableCommand(domain, (Table) top)); } } try { GMFUnsafe.write(domain, compoundCommand); } catch (InterruptedException e) { Activator.log.error(e); } catch (RollbackException e) { Activator.log.error(e); } finally { super.save(options); } }
Source:
private long countMapWithAtleastOneQueryCache(Node node) { return maps.stream().filter(distributedObject -> { MapConfig config = node.getConfig().getMapConfig(distributedObject.getName()); if (config != null) { return config.getQueryCacheConfigs().size() >= 1; } return false; }).count(); }

Target:
private long countMapWithAtleastOneQueryCache(Node node) { return maps.stream().filter(distributedObject -> { MapConfig config = node.getConfig().getMapConfig(distributedObject.getName()); if (config != null) { return !config.getQueryCacheConfigs().isEmpty(); } return false; }).count(); }
Source:
public void loadDashboards(RuntimeModel runtimeModel) { NavTree navTree = runtimeModel.getNavTree(); Menus menus = menusHelper.buildMenusFromNavTree(navTree).build(); view.addMenus(menus); goToIndex(runtimeModel.getLayoutTemplates()); }

Target:
public void loadDashboards(RuntimeModel runtimeModel) { NavTree navTree = runtimeModel.getNavTree(); Menus menus = menusHelper.buildMenusFromNavTree(navTree).build(); view.addMenus(menus); }
Source:
private String createFxmlPath(Class<?> viewType) { String emptyPath = ""; final StringBuilder pathBuilder = new StringBuilder(); FxmlPath annotation = viewType.getDeclaredAnnotation(FxmlPath.class); String path = annotation != null ? annotation.value() : emptyPath; if (!emptyPath.equalsIgnoreCase(path)) { pathBuilder.append(path); } else { pathBuilder.append("/"); if (viewType.getPackage() != null) { pathBuilder.append(viewType.getPackage().getName().replaceAll("\\.", "/")); pathBuilder.append("/"); } pathBuilder.append(viewType.getSimpleName()); pathBuilder.append(".fxml"); } return pathBuilder.toString(); }

Target:
private String createFxmlPath(Class<?> viewType) { final StringBuilder pathBuilder = new StringBuilder(); final FxmlPath pathAnnotation = viewType.getDeclaredAnnotation(FxmlPath.class); final String fxmlPath = Optional.ofNullable(pathAnnotation) .map(FxmlPath::value) .map(String::trim) .orElse(""); if (fxmlPath.isEmpty()) { pathBuilder.append("/"); if (viewType.getPackage() != null) { pathBuilder.append(viewType.getPackage().getName().replaceAll("\\.", "/")); pathBuilder.append("/"); } pathBuilder.append(viewType.getSimpleName()); pathBuilder.append(".fxml"); } else { pathBuilder.append(fxmlPath); } return pathBuilder.toString(); }
Source:
public IntervalListTest() { fileHeader = IntervalList.fromFile(new File(TEST_DIR, "/IntervalListchr123_empty.interval_list")).getHeader(); fileHeader.setSortOrder(SAMFileHeader.SortOrder.unsorted); list1 = new IntervalList(fileHeader); list2 = new IntervalList(fileHeader); list3 = new IntervalList(fileHeader); list1.add(new Interval("1", 1, 100)); list1.add(new Interval("1", 101, 200)); list1.add(new Interval("1", 202, 300)); list1.add(new Interval("2", 200, 300)); list1.add(new Interval("2", 100, 150)); list2.add(new Interval("1", 50, 150)); list2.add(new Interval("1", 301, 500)); list2.add(new Interval("2", 1, 150)); list2.add(new Interval("2", 250, 270)); list2.add(new Interval("2", 290, 400)); list3.add(new Interval("1", 25, 400)); list3.add(new Interval("2", 200, 600)); list3.add(new Interval("3", 50, 470)); }

Target:
public IntervalListTest() { fileHeader = IntervalList.fromPath(TEST_DIR.resolve("IntervalListchr123_empty.interval_list")).getHeader(); fileHeader.setSortOrder(SAMFileHeader.SortOrder.unsorted); list1 = new IntervalList(fileHeader); list2 = new IntervalList(fileHeader); list3 = new IntervalList(fileHeader); list1.add(new Interval("1", 1, 100)); list1.add(new Interval("1", 101, 200)); list1.add(new Interval("1", 202, 300)); list1.add(new Interval("2", 200, 300)); list1.add(new Interval("2", 100, 150)); list2.add(new Interval("1", 50, 150)); list2.add(new Interval("1", 301, 500)); list2.add(new Interval("2", 1, 150)); list2.add(new Interval("2", 250, 270)); list2.add(new Interval("2", 290, 400)); list3.add(new Interval("1", 25, 400)); list3.add(new Interval("2", 200, 600)); list3.add(new Interval("3", 50, 470)); }
Source:
public SResolver normalResolution(final VirtualFrame frame, final SResolver resolver, final Object result, final boolean haltOnResolver, final boolean haltOnResolution) { SPromise promise = resolver.getPromise(); if (haltOnResolver || promise.haltOnResolver()) { haltNode.executeEvaluated(frame, result); } resolvePromise(Resolution.SUCCESSFUL, resolver, result, haltOnResolution || promise.haltOnResolution()); return resolver; }

Target:
public SResolver normalResolution(final VirtualFrame frame, final SResolver resolver, final Object result, final boolean haltOnResolver, final boolean haltOnResolution) { SPromise promise = resolver.getPromise(); if (haltOnResolver || promise.getHaltOnResolver()) { haltNode.executeEvaluated(frame, result); } resolvePromise(Resolution.SUCCESSFUL, resolver, result, haltOnResolution || promise.getHaltOnResolution()); return resolver; }
Source:
String getPluginName() { return pluginName; }

Target:
protected String getPluginName() { return pluginName; }
Source:
protected ComplianceReasonTranslator initObjectTranslator() { return this.ComplianceReasonTranslator; }

Target:
protected ComplianceReasonTranslator initObjectTranslator() { this.translator = new ComplianceReasonTranslator(); return this.translator; }
Source:
public void test_setAttribute_empty_array() { final SAMFileHeader header = new SAMFileHeader(); final String arrayTag = "XA"; final SAMRecord record = new SAMRecord(header); Assert.assertNull(record.getStringAttribute(arrayTag)); record.setAttribute(arrayTag, new int[0]); Assert.assertNotNull(record.getSignedIntArrayAttribute(arrayTag)); Assert.assertEquals(record.getSignedIntArrayAttribute(arrayTag),new int[0]); record.getSAMString(); Assert.assertEquals(record.getAttribute(arrayTag), new char[0]); record.setAttribute(arrayTag, null); Assert.assertNull(record.getStringAttribute(arrayTag)); }

Target:
public void test_setAttribute_empty_array() { final SAMFileHeader header = new SAMFileHeader(); final SAMRecord record = new SAMRecord(header); Assert.assertNull(record.getStringAttribute(ARRAY_TAG)); record.setAttribute(ARRAY_TAG, new int[0]); Assert.assertNotNull(record.getSignedIntArrayAttribute(ARRAY_TAG)); Assert.assertEquals(record.getSignedIntArrayAttribute(ARRAY_TAG), new int[0]); Assert.assertEquals(record.getAttribute(ARRAY_TAG), new char[0]); record.setAttribute(ARRAY_TAG, null); Assert.assertNull(record.getStringAttribute(ARRAY_TAG)); }
Source:
public void testCopy() { final String definition = "Human lives in \"{city}\""; final String drl = "Human(city==\"{city}\")"; final DSLSentence original = makeDslSentence(definition, drl); final DSLSentence copy = original.copy(); assertEquals(copy.getDefinition(), original.getDefinition()); assertEquals(copy.getDrl(), original.getDrl()); assertEquals(copy.getValues().size(), original.getValues().size()); }

Target:
public void testCopy() { final String definition = "Human lives in \"{city}\""; final String drl = "Human(city==\"{city}\")"; final DSLSentence original = makeDslSentence(definition, drl); final DSLSentence copy = original.copy(); assertEquals(original.getDefinition(), copy.getDefinition()); assertEquals(original.getDrl(), copy.getDrl()); assertEquals(original.getValues(), copy.getValues()); assertEquals(firstValue(original), firstValue(copy)); assertNotSame(firstValue(original), firstValue(copy)); }
Source:
protected boolean deleteAndVerifyContainerGone(String container) { return this.api.deleteContainerMetadata(this.getUserWorkspace(), container); }

Target:
protected boolean deleteAndVerifyContainerGone(String container) { this.api.deleteContainerViaWorkspaceApi(this.getUserWorkspace(), container); return !containerExists(container); }
Source:
public Cohort removePatientFromCohort(Cohort cohort, Patient patient) { if (cohort.contains(patient)) { cohort.removeMember(patient); Context.getCohortService().saveCohort(cohort); } return cohort; }

Target:
public Cohort removePatientFromCohort(Cohort cohort, Patient patient) { if (cohort.contains(patient.getPatientId())) { cohort.removeMember(patient); Context.getCohortService().saveCohort(cohort); } return cohort; }
Source:
private String resolveEnvParams(String content) { Pattern pattern = Pattern.compile("\\$\\{(\\w+(:-.+)?)\\}"); Matcher m = pattern.matcher(content); while (m.find()) { String[] parts = m.group(1).split(":-"); String v = env.get(parts[0]); if (v != null) { content = content.replace(m.group(), v); } else if (parts.length == 2) { content = content.replace(m.group(), parts[1]); } } return content; }

Target:
private String resolveEnvParams(String content) { Pattern pattern = Pattern.compile("\\$\\{(\\w+(:-.+)?)\\}"); Matcher m = pattern.matcher(content); while (m.find()) { String[] parts = m.group(1).split(":-"); String v = System.getenv(parts[0]); if (v != null) { content = content.replace(m.group(), v); } else if (parts.length == 2) { content = content.replace(m.group(), parts[1]); } } return content; }
Source:
public VoltDBPSerialAggregate( RelOptCluster cluster, RelTraitSet traitSet, RelNode child, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls, RexNode postPredicate, int splitCount, boolean isCoordinatorAggr) { this(cluster, traitSet, child, indicator, groupSet, groupSets, aggCalls, postPredicate, splitCount, isCoordinatorAggr, null, null); }

Target:
public VoltDBPSerialAggregate( RelOptCluster cluster, RelTraitSet traitSet, RelNode child, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls, RexNode postPredicate, int splitCount, boolean isCoordinatorAggr) { super(cluster, traitSet, child, indicator, groupSet, groupSets, aggCalls, postPredicate, splitCount, isCoordinatorAggr); m_offset = null; m_limit = null; }
Source:
public void visitBinaryExpression(BinaryExpressionTree tree) { Tree.Kind peek = stack.peek(); Tree.Kind kind = getKind(tree); if (requiresParenthesis(peek, kind)) { raiseIssue(); } stack.push(kind); super.visitBinaryExpression(tree); stack.pop(); }

Target:
public void visitBinaryExpression(BinaryExpressionTree tree) { Tree.Kind peek = stack.peek(); Tree.Kind kind = getKind(tree); if (requiresParenthesis(peek, kind)) { raiseIssue(tree.operatorToken().line(), tree); } stack.push(kind); super.visitBinaryExpression(tree); stack.pop(); }
Source:
public Proc launch(ProcStarter ps) throws IOException { if (!ps.quiet) { maskedPrintCommandLine(ps.commands, ps.masks, ps.pwd); } EnvVars jobEnv = inherit(ps.envs); String[] jobCmd = new String[ps.commands.size()]; for ( int idx = 0 ; idx < jobCmd.length; idx++ ) jobCmd[idx] = jobEnv.expand(ps.commands.get(idx)); if (Functions.isWindows()) { jobCmd = new ArgumentListBuilder(jobCmd).toWindowsCommand().toCommandArray(); } return new LocalProc(jobCmd, Util.mapToEnv(jobEnv), ps.reverseStdin ?LocalProc.SELFPUMP_INPUT:ps.stdin, ps.reverseStdout?LocalProc.SELFPUMP_OUTPUT:ps.stdout, ps.reverseStderr?LocalProc.SELFPUMP_OUTPUT:ps.stderr, toFile(ps.pwd)); }

Target:
public Proc launch(ProcStarter ps) throws IOException { if (!ps.quiet) { maskedPrintCommandLine(ps.commands, ps.masks, ps.pwd); } EnvVars jobEnv = inherit(ps.envs); String[] jobCmd = new String[ps.commands.size()]; for ( int idx = 0 ; idx < jobCmd.length; idx++ ) jobCmd[idx] = jobEnv.expand(ps.commands.get(idx)); if (!isUnix()) { jobCmd = escapeForWindows(jobCmd); } return new LocalProc(jobCmd, Util.mapToEnv(jobEnv), ps.reverseStdin ?LocalProc.SELFPUMP_INPUT:ps.stdin, ps.reverseStdout?LocalProc.SELFPUMP_OUTPUT:ps.stdout, ps.reverseStderr?LocalProc.SELFPUMP_OUTPUT:ps.stderr, toFile(ps.pwd)); }
Source:
public Opt<Identity> enter(final Request req) throws IOException { final Iterator<String> headers = new RqHeaders.Base(req) .header(this.header).iterator(); Opt<Identity> user = new Opt.Empty<>(); String head = ""; while (headers.hasNext()) { final String nexthead = headers.next(); if (nexthead.trim().startsWith("Bearer")) { head = nexthead; break; } } final String dot = "\\."; if (head.length() > 0) { final String jwt = head.trim().split(" ", 2)[1].trim(); final byte[] jwtheader = jwt.split(dot)[0].getBytes(); final byte[] jwtpayload = jwt.split(dot)[1].getBytes(); final byte[] jwtsign = jwt.split(dot)[2].getBytes(); final ByteBuffer tocheck = ByteBuffer.allocate( jwtheader.length + jwtpayload.length + 1 ); tocheck.put(jwtheader).put(".".getBytes()).put(jwtpayload); final byte[] checked = this.signature.sign(tocheck.array()); if (Arrays.equals(jwtsign, checked)) { final JsonObject jsonv = Json.createReader( new StringReader( new String(new Base64().decode(jwtpayload)) ) ) .readObject(); user = new Opt.Single<Identity>( new Identity.Simple( jsonv.getString(Token.Jwt.SUBJECT) ) ); } } return user; }

Target:
public Opt<Identity> enter(final Request req) throws IOException { final Iterator<String> headers = new RqHeaders.Base(req) .header(this.header).iterator(); Opt<Identity> user = new Opt.Empty<>(); String head = ""; while (headers.hasNext()) { final String nexthead = headers.next(); if (nexthead.trim().startsWith("Bearer")) { head = nexthead; break; } } final String dot = "\\."; if (head.length() > 0) { final String jwt = head.split(" ", 2)[1].trim(); final String[] parts = jwt.split(dot); final byte[] jwtheader = parts[0].getBytes(); final byte[] jwtpayload = parts[1].getBytes(); final byte[] jwtsign = parts[2].getBytes(); final ByteBuffer tocheck = ByteBuffer.allocate( jwtheader.length + jwtpayload.length + 1 ); tocheck.put(jwtheader).put(".".getBytes()).put(jwtpayload); final byte[] checked = this.signature.sign(tocheck.array()); if (Arrays.equals(jwtsign, checked)) { final JsonObject jsonv = Json.createReader( new StringReader( new String(new Base64().decode(jwtpayload)) ) ) .readObject(); user = new Opt.Single<Identity>( new Identity.Simple( jsonv.getString(Token.Jwt.SUBJECT) ) ); } } return user; }
Source:
public Object fromMessage(Message message) throws MessageConversionException { Object result = this.delegate.fromMessage(message); if (result instanceof RemoteInvocationResult) { try { result = ((RemoteInvocationResult) result).recreate(); } catch (Throwable e) { throw new AmqpException(e); } } return result; }

Target:
public Object fromMessage(Message message) throws MessageConversionException { Object result = this.delegate.fromMessage(message); if (result instanceof RemoteInvocationResult) { try { result = ((RemoteInvocationResult) result).recreate(); } catch (Throwable e) { throw new AmqpRemoteException(e); } } return result; }
Source:
private void testMiniMesosReportsFrameworkRole(String role) throws UnirestException, JsonParseException, JsonMappingException { LOGGER.info("Starting Elasticsearch scheduler with framework role: " + role); ElasticsearchSchedulerContainer scheduler = new ElasticsearchSchedulerContainer( clusterArchitecture.dockerClient, CLUSTER.getZkContainer().getIpAddress(), role, CLUSTER); CLUSTER.addAndStartContainer(scheduler); LOGGER.info("Started Elasticsearch scheduler on " + scheduler.getIpAddress() + ":" + getTestConfig().getSchedulerGuiPort()); ESTasks esTasks = new ESTasks(TEST_CONFIG, scheduler.getIpAddress()); new TasksResponse(esTasks, 3); new ElasticsearchNodesResponse(esTasks, 3); Awaitility.await().atMost(30, TimeUnit.SECONDS).pollInterval(5, TimeUnit.SECONDS).until(() -> CLUSTER.getStateInfo().getFramework("elasticsearch") != null); Assert.assertEquals(role, CLUSTER.getStateInfo().getFramework("elasticsearch").getRole()); }

Target:
private void testMiniMesosReportsFrameworkRole(String role) throws UnirestException, JsonParseException, JsonMappingException { LOGGER.info("Starting Elasticsearch scheduler with framework role: " + role); ElasticsearchSchedulerContainer scheduler = new ElasticsearchSchedulerContainer( clusterArchitecture.dockerClient, CLUSTER.getZkContainer().getIpAddress(), role, CLUSTER); CLUSTER.addAndStartContainer(scheduler); LOGGER.info("Started Elasticsearch scheduler on " + scheduler.getIpAddress() + ":" + getTestConfig().getSchedulerGuiPort()); ESTasks esTasks = new ESTasks(TEST_CONFIG, scheduler.getIpAddress()); new TasksResponse(esTasks, TEST_CONFIG.getElasticsearchNodesCount()); new ElasticsearchNodesResponse(esTasks, TEST_CONFIG.getElasticsearchNodesCount()); Awaitility.await().atMost(30, TimeUnit.SECONDS).pollInterval(5, TimeUnit.SECONDS).until(() -> CLUSTER.getStateInfo().getFramework("elasticsearch") != null); Assert.assertEquals(role, CLUSTER.getStateInfo().getFramework("elasticsearch").getRole()); }
Source:
protected void setUp() throws Exception { super.setUp(); initAccessToServer(getContext()); Log.v(LOG_TAG, "Setting up the remote fixture..."); mFullPath2FileToShare = mBaseFolderPath + FILE_TO_SHARE; File textFile = getActivity().extractAsset(TestActivity.ASSETS__TEXT_FILE_NAME); RemoteOperationResult result = getActivity().uploadFile( textFile.getAbsolutePath(), mFullPath2FileToShare, "txt/plain"); if (!result.isSuccess()) { Utils.logAndThrow(LOG_TAG, result); } result = getActivity().createShare( mFullPath2FileToShare, ShareType.PUBLIC_LINK, "", false, "", OCShare.READ_PERMISSION_FLAG); if (result.isSuccess()){ mShare = (OCShare) result.getData().get(0); } else{ mShare = null; } mFullPath2FolderToShare = mBaseFolderPath + FOLDER_TO_SHARE; result = getActivity().createFolder( mFullPath2FolderToShare, true); if (!result.isSuccess()) { Utils.logAndThrow(LOG_TAG, result); } result = getActivity().createShare( mFullPath2FolderToShare, ShareType.PUBLIC_LINK, "", false, "", OCShare.READ_PERMISSION_FLAG); if (result.isSuccess()){ mFolderShare = (OCShare) result.getData().get(0); } else{ mFolderShare = null; } Log.v(LOG_TAG, "Remote fixtures created."); }

Target:
protected void setUp() throws Exception { super.setUp(); initAccessToServer(getContext()); Log.v(LOG_TAG, "Setting up the remote fixture..."); mFullPath2FileToShare = mBaseFolderPath + FILE_TO_SHARE; File textFile = getActivity().extractAsset(TestActivity.ASSETS__TEXT_FILE_NAME); RemoteOperationResult result = getActivity().uploadFile( textFile.getAbsolutePath(), mFullPath2FileToShare, "txt/plain"); if (!result.isSuccess()) { Utils.logAndThrow(LOG_TAG, result); } result = getActivity().createShare( mFullPath2FileToShare, ShareType.PUBLIC_LINK, "", false, "", OCShare.READ_PERMISSION_FLAG); if (result.isSuccess()){ mShare = (OCShare) result.getData().get(0); } else{ Utils.logAndThrow(LOG_TAG, result); } mFullPath2FolderToShare = mBaseFolderPath + FOLDER_TO_SHARE; result = getActivity().createFolder( mFullPath2FolderToShare, true); if (!result.isSuccess()) { Utils.logAndThrow(LOG_TAG, result); } result = getActivity().createShare( mFullPath2FolderToShare, ShareType.PUBLIC_LINK, "", false, "", OCShare.READ_PERMISSION_FLAG); if (result.isSuccess()){ mFolderShare = (OCShare) result.getData().get(0); } else{ Utils.logAndThrow(LOG_TAG, result); } Log.v(LOG_TAG, "Remote fixtures created."); }
Source:
public void inputChanged(@Nullable Viewer viewer, @Nullable Object oldInput, @Nullable Object newInput) { fTableViewer = (TableViewer) viewer; if (newInput instanceof ISegmentStore<?>) { ISegmentStore<?> segmentStore = (ISegmentStore<?>) newInput; fSegmentArray = Iterables.toArray(segmentStore, ISegment.class); if (fComparator != null) { Arrays.sort(fSegmentArray, fComparator); } } else if (newInput instanceof ISegment[]) { fSegmentArray = ((ISegment[]) newInput).clone(); if (fComparator != null) { Arrays.sort(fSegmentArray, fComparator); } } else { fSegmentArray = null; } }

Target:
public void inputChanged(@Nullable Viewer viewer, @Nullable Object oldInput, @Nullable Object newInput) { fTableViewer = (TableViewer) viewer; if (newInput instanceof ISegmentStore) { ISegmentStore<ISegment> segmentStore = (ISegmentStore<ISegment>) newInput; fSegmentArray = Iterables.toArray(segmentStore, ISegment.class); if (fComparator != null) { Arrays.sort(fSegmentArray, fComparator); } } else if (newInput instanceof ISegment[]) { fSegmentArray = ((ISegment[]) newInput).clone(); if (fComparator != null) { Arrays.sort(fSegmentArray, fComparator); } } else { fSegmentArray = null; } }
Source:
default Optional<PaxosValue> getLearnedValueAtSeqIfExists(long seq) { return learnerRecords().containsKey(seq) ? Optional.of(learnerRecords().get(seq)) : Optional.empty(); }

Target:
default Optional<PaxosValue> getLearnedValueAtSeqIfExists(long seq) { return Optional.ofNullable(learnerRecords().getOrDefault(seq, null)); }
Source:
protected abstract void initialize() throws ResourceManagerException; protected abstract void terminate() throws Throwable; protected CompletableFuture<Void> prepareLeadershipAsync() { return CompletableFuture.completedFuture(null); }

Target:
protected abstract void initialize() throws ResourceManagerException; protected abstract void terminate() throws Exception; protected CompletableFuture<Void> prepareLeadershipAsync() { return CompletableFuture.completedFuture(null); }
Source:
public void start(Collection<? extends Location> locations) { super.start(locations); subscribeToMembers(this, Startable.SERVICE_UP, new SensorEventListener<Boolean>() { public void onEvent(SensorEvent<Boolean> event) { setAnyRouter(); } }); AbstractMembershipTrackingPolicy policy = new AbstractMembershipTrackingPolicy(MutableMap.of("name", "Router cluster membership tracker")) { @Override protected void onEntityAdded(Entity member) { setAnyRouter(); } protected void onEntityRemoved(Entity member) { setAnyRouter(); } }; addPolicy(policy); policy.setGroup(this); }

Target:
public void start(Collection<? extends Location> locations) { super.start(locations); AbstractMembershipTrackingPolicy policy = new AbstractMembershipTrackingPolicy(MutableMap.of("name", "Router cluster membership tracker")) { @Override protected void onEntityAdded(Entity member) { setAnyRouter(); } protected void onEntityRemoved(Entity member) { setAnyRouter(); } @Override protected void onEntityChange(Entity member) { setAnyRouter(); } }; addPolicy(policy); policy.setGroup(this); }
Source:
private boolean isPlayerHit(Entity source) { if (source instanceof GlowPlayer) { return true; } else if (source instanceof GlowTntPrimed) { return ((GlowTntPrimed)source).getPlayer() != null && (((GlowTntPrimed)source).getPlayer().getGameMode() == GameMode.SURVIVAL || ((GlowTntPrimed)source).getPlayer().getGameMode() == GameMode.ADVENTURE); } else if (source instanceof GlowWolf) { return ((GlowWolf)source).isTamed(); } return false; }

Target:
private boolean isPlayerHit(Entity source) { if (source instanceof GlowPlayer) { return true; } if (source instanceof GlowTntPrimed) { GlowPlayer player = (GlowPlayer)((GlowTntPrimed) source).getSource(); return player != null && (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE); } if (source instanceof GlowWolf) { return ((GlowWolf) source).isTamed(); } return false; }
Source:
public void testItalicWithWhitespace() { String html; Pattern expectedPattern = Pattern.compile("<body><p>normal\\s*<i>\\s*italic text\\s*</i>\\s*normal</p></body>"); html = parser.parseToHtml("normal '' italic text'' normal"); TestUtil.println(html); assertTrue(expectedPattern.matcher(html).find()); html = parser.parseToHtml("normal ''italic text '' normal"); TestUtil.println(html); assertTrue(expectedPattern.matcher(html).find()); html = parser.parseToHtml("normal '' italic text '' normal"); TestUtil.println(html); assertTrue(expectedPattern.matcher(html).find()); }

Target:
public void testItalicWithWhitespace() { String html; html = parser.parseToHtml("normal '' italic text'' normal"); TestUtil.println(html); assertTrue(html.contains("<body><p>normal <i> italic text</i> normal</p></body>")); html = parser.parseToHtml("normal ''italic text '' normal"); TestUtil.println(html); assertTrue(html.contains("<body><p>normal <i>italic text </i> normal</p></body>")); html = parser.parseToHtml("normal '' italic text '' normal"); TestUtil.println(html); assertTrue(html.contains("<body><p>normal <i> italic text </i> normal</p></body>")); }
Source:
public void testRotationWithNoData() throws InterruptedException { GenericFileOutputOperator writer = new GenericFileOutputOperator(); File dir = new File(testMeta.getDir()); writer.setFilePath(testMeta.getDir()); writer.setOutputFileName("output.txt"); writer.setMaxIdleWindows(5); writer.setAlwaysWriteToTmp(true); writer.setup(testMeta.testOperatorContext); for (int i = 0; i < 30; ++i) { writer.beginWindow(i); Thread.sleep(100L); writer.endWindow(); } writer.committed(29); Collection<File> files = FileUtils.listFiles(dir, null, false); Assert.assertEquals("Number of part files", 0, files.size()); }

Target:
public void testRotationWithNoData() throws InterruptedException { GenericFileOutputOperator writer = new GenericFileOutputOperator(); File dir = new File(testMeta.getDir()); writer.setFilePath(testMeta.getDir()); writer.setOutputFileName("output.txt"); writer.setMaxIdleWindows(5); writer.setAlwaysWriteToTmp(true); writer.setup(testMeta.testOperatorContext); for (int i = 0; i < 30; ++i) { writer.beginWindow(i); writer.endWindow(); } writer.committed(29); Collection<File> files = FileUtils.listFiles(dir, null, false); Assert.assertEquals("Number of part files", 0, files.size()); }
Source:
public Properties generate(SourceOfRandomness random, GenerationStatus status) { int size = status.size(); Properties properties = new Properties(); for (int i = 0; i < size; ++i) { properties.setProperty( stringGenerator.generate(random, status), stringGenerator.generate(random, status)); } return properties; }

Target:
@Override public Properties generate(SourceOfRandomness random, GenerationStatus status) { int size = status.size(); Properties properties = new Properties(); for (int i = 0; i < size; ++i) { properties.setProperty( stringGenerator.generate(random, status), stringGenerator.generate(random, status)); } return properties; }
Source:
public void testSendingInvokesEndpointContextMatcher() throws Exception { TestEndpointContextMatcher endpointMatcher = new TestEndpointContextMatcher(3); client.setEndpointContextMatcher(endpointMatcher); LatchDecrementingRawDataChannel channel = serverHelper.givenAnEstablishedSession(client, false); EndpointContext endpointContext = endpointMatcher.getConnectionEndpointContext(1); RawData outboundMessage = RawData.outbound(new byte[] { 0x01 }, endpointContext, null, false); CountDownLatch latch = new CountDownLatch(1); channel.setLatch(latch); client.send(outboundMessage); assertThat(endpointMatcher.await(TIMEOUT_IN_MILLIS, TimeUnit.MILLISECONDS), is(true)); assertThat(endpointMatcher.getConnectionEndpointContext(2), is(endpointContext)); assertThat(endpointMatcher.getMessageEndpointContext(2), is(endpointContext)); assertTrue("DTLS client timed out after " + MAX_TIME_TO_WAIT_SECS + " seconds waitng for response!", latch.await(MAX_TIME_TO_WAIT_SECS, TimeUnit.SECONDS)); }

Target:
public void testSendingInvokesEndpointContextMatcher() throws Exception { TestEndpointContextMatcher endpointMatcher = new TestEndpointContextMatcher(3); client.setEndpointContextMatcher(endpointMatcher); LatchDecrementingRawDataChannel channel = serverHelper.givenAnEstablishedSession(client, false); EndpointContext endpointContext = endpointMatcher.getConnectionEndpointContext(1); RawData outboundMessage = RawData.outbound(new byte[] { 0x01 }, endpointContext, null, false); CountDownLatch latch = new CountDownLatch(1); channel.setLatch(latch); client.send(outboundMessage); assertThat(endpointMatcher.await(TIMEOUT_IN_MILLIS, TimeUnit.MILLISECONDS), is(true)); assertThat(endpointMatcher.getConnectionEndpointContext(2), is(endpointContext)); assertThat(endpointMatcher.getMessageEndpointContext(2), is(endpointContext)); assertTrue("DTLS client timed out after " + MAX_TIME_TO_WAIT_SECS + " seconds waiting for response!", latch.await(MAX_TIME_TO_WAIT_SECS, TimeUnit.SECONDS)); }