auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { if (mDue != null && mStart.isAllDay() != mDue.isAllDay()) { throw new IllegalArgumentException("'start' and 'due' must have the same all-day flag"); } DateTime start = mStart; if (mDue != null && !TimeZoneEqualator.INSTANCE.areEqual(mStart, mDue)) { start = mStart.shiftTimeZone(mDue.getTimeZone()); } return doUpdateBuilder(start, mDue, mDuration, builder); }

Target:
public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { if (mDue.isPresent() && mStart.isAllDay() != mDue.value().isAllDay()) { throw new IllegalArgumentException("'start' and 'due' must have the same all-day flag"); } DateTime start = mStart; if (mDue.isPresent() && !mDue.value().isAllDay()) { start = mStart.shiftTimeZone(mDue.value().getTimeZone()); } return doUpdateBuilder(start, mDue, mDuration, builder); }
Source:
boolean isInternalUser() { CommandResult gitRes = RunUtil.getDefault().runTimedCmd(60000L, "git", "config", "--get", "user.email"); if (CommandStatus.SUCCESS.equals(gitRes.getStatus())) { String stdout = gitRes.getStdout(); if (stdout != null && stdout.trim().endsWith(INTERNAL_EMAIL)) { return true; } } try { String hostname = InetAddress.getLocalHost().getHostName(); if (hostname.endsWith(INTERNAL_HOSTNAME)) { return true; } } catch (UnknownHostException e) { } return false; }

Target:
boolean isInternalUser() { CommandResult gitRes = RunUtil.getDefault().runTimedCmd(60000L, "git", "config", "--get", "user.email"); if (CommandStatus.SUCCESS.equals(gitRes.getStatus())) { String stdout = gitRes.getStdout(); if (stdout != null && stdout.trim().endsWith(INTERNAL_EMAIL)) { return true; } } try { String hostname = InetAddress.getLocalHost().getHostName(); if (hostname.contains(INTERNAL_HOSTNAME)) { return true; } } catch (UnknownHostException e) { } return false; }
Source:
public void test_p_TestDescribeTable() throws InterruptedException, ExecutionException { RiakClient client = new RiakClient(cluster); Query query = new Query.Builder("DESCRIBE " + tableName).build(); final RiakFuture<QueryResult, String> resultFuture = client.executeAsync(query); resultFuture.await(); assertFutureSuccess(resultFuture); final QueryResult tableDescription = resultFuture.get(); assertEquals(7, tableDescription.getRowsCount()); assertEquals(7, tableDescription.getColumnDescriptionsCopy().size()); }

Target:
public void test_p_TestDescribeTable() throws InterruptedException, ExecutionException { RiakClient client = new RiakClient(cluster); Query query = new Query.Builder("DESCRIBE " + tableName).build(); final RiakFuture<QueryResult, String> resultFuture = client.executeAsync(query); resultFuture.await(); assertFutureSuccess(resultFuture); final QueryResult tableDescription = resultFuture.get(); assertEquals(7, tableDescription.getRowsCount()); int numColumnDesc = tableDescription.getColumnDescriptionsCopy().size(); assertTrue(numColumnDesc == 5 || numColumnDesc == 7); }
Source:
public LifecycleInjector createInjector(Stage stage, Module module) { final GovernatorFeatureSetImpl featureSet = new GovernatorFeatureSetImpl(features); final LifecycleManager manager = new LifecycleManager(); try { onBeforeInjectorCreate(); Injector injector = Guice.createInjector( stage, new LifecycleModule(), new LifecycleListenerModule(), new LegacyScopesModule(), new AbstractModule() { @Override protected void configure() { bind(GovernatorFeatureSet.class).toInstance(featureSet); bind(LifecycleManager.class).toInstance(manager); bind(new TypeLiteral<Set<String>>() {}).annotatedWith(Profiles.class).toInstance(profiles); bind(String[].class).annotatedWith(Arguments.class).toInstance(args); requestInjection(LifecycleInjectorCreator.this); } }, module ); manager.notifyStarted(); LifecycleInjector lifecycleInjector = LifecycleInjector.wrapInjector(injector, manager); onSuccessfulInjectorCreate(); return lifecycleInjector; } catch (Exception e) { LOG.error(String.format("Failed to create injector - %s@%d", e.getClass().getSimpleName(), System.identityHashCode(e)), e); onFailedInjectorCreate(e); try { manager.notifyStartFailed(e); } catch (Exception e2) { LOG.error("Failed to notify injector creation failure", e2 ); } if (!featureSet.get(GovernatorFeatures.SHUTDOWN_ON_ERROR)) { return LifecycleInjector.createFailedInjector(manager); } else { throw e; } } finally { onCompletedInjectorCreate(); } }

Target:
public LifecycleInjector createInjector(Stage stage, Module module) { final GovernatorFeatureSetImpl featureSet = new GovernatorFeatureSetImpl(features); final LifecycleManager manager = new LifecycleManager(); try { onBeforeInjectorCreate(); Injector injector = Guice.createInjector( stage, new LifecycleModule(), new LifecycleListenerModule(), new LegacyScopesModule(), new AbstractModule() { @Override protected void configure() { bind(GovernatorFeatureSet.class).toInstance(featureSet); bind(LifecycleManager.class).toInstance(manager); bind(new TypeLiteral<Set<String>>() {}).annotatedWith(Profiles.class).toInstance(profiles); bind(String[].class).annotatedWith(Arguments.class).toInstance(args); requestInjection(LifecycleInjectorCreator.this); } }, module ); manager.notifyStarted(); LifecycleInjector lifecycleInjector = LifecycleInjector.wrapInjector(injector, manager); onSuccessfulInjectorCreate(); return lifecycleInjector; } catch (Exception e) { LOG.error("Failed to create injector - {}@{}", e.getClass().getSimpleName(), System.identityHashCode(e), e); onFailedInjectorCreate(e); try { manager.notifyStartFailed(e); } catch (Exception e2) { LOG.error("Failed to notify injector creation failure", e2 ); } if (!featureSet.get(GovernatorFeatures.SHUTDOWN_ON_ERROR)) { return LifecycleInjector.createFailedInjector(manager); } else { throw e; } } finally { onCompletedInjectorCreate(); } }
Source:
public String getStrValue() { String key = strValue.toLowerCase().replace(" " , "_"); if(getDatasetFieldType().getMetadataBlock() == null){ return strValue; } else { return BundleUtil.getStringFromPropertyFile("controlledvocabulary." + this.datasetFieldType.getName() + "." + key, getDatasetFieldType().getMetadataBlock().getName()); } }

Target:
public String getStrValue() { String key = strValue.toLowerCase().replace(" " , "_"); key = StringUtils.stripAccents(key); if(getDatasetFieldType().getMetadataBlock() == null){ return strValue; } else { return BundleUtil.getStringFromPropertyFile("controlledvocabulary." + this.datasetFieldType.getName() + "." + key, getDatasetFieldType().getMetadataBlock().getName()); } }
Source:
public void testOpenSessionEditorByDoubleClick4() { designerProject.convertToModelingProject(); SWTBotPerspective javaPerspective = bot.perspectiveByLabel("Java"); javaPerspective.activate(); SWTBotView packageExplorerView = bot.viewById("org.eclipse.jdt.ui.PackageExplorer"); packageExplorerView.setFocus(); SWTBot packageExplorerViewBot = packageExplorerView.bot(); SWTBotTreeItem expandedNode = packageExplorerViewBot.tree().expandNode("DesignerTestProject", true); SWTBotTreeItem node = expandedNode.getNode("My.aird"); node.doubleClick(); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor() != null; } @Override public String getFailureMessage() { return "Wrong Active editor is : " + PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor().getEditorSite().getId(); } }); assertEquals("The session editor has not opened.", "org.eclipse.sirius.ui.editor.session", PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor().getEditorSite().getId()); }

Target:
public void testOpenSessionEditorByDoubleClick4() { designerProject.convertToModelingProject(); SWTBotPerspective javaPerspective = bot.perspectiveByLabel("Java"); javaPerspective.activate(); SWTBotView packageExplorerView = bot.viewById("org.eclipse.jdt.ui.PackageExplorer"); packageExplorerView.setFocus(); SWTBot packageExplorerViewBot = packageExplorerView.bot(); assertSessionEditorOpened(packageExplorerViewBot); }
Source:
void restartServerOnVM(int index) { cluster.startServerVM(index, getProperties(), locatorPort); }

Target:
void restartServerOnVM(int index) { cluster.startServerVM(index, locatorPort); }
Source:
private TrackerClient getTrackerClientFromRing(Request request, RequestContext requestContext, Ring<URI> ring, Map<URI, TrackerClient> trackerClients) { if (ring == null) { return null; } Set<URI> excludedUris = LoadBalancerStrategy.ExcludedHostHints.getRequestContextExcludedHosts(requestContext); int hashCode = _requestHashFunction.hash(request); URI uri = ring.get(hashCode); TrackerClient trackerClient = trackerClients.get(uri); if (excludedUris == null) { excludedUris = new HashSet<>(); } if (trackerClient == null || excludedUris.contains(uri)) { Iterator<URI> ringIterator = ring.getIterator(hashCode); while (ringIterator.hasNext()) { uri = ringIterator.next(); trackerClient = trackerClients.get(uri); if (trackerClient != null && !excludedUris.contains(uri)) { break; } } } return trackerClient; }

Target:
private TrackerClient getTrackerClientFromRing(Request request, RequestContext requestContext, Ring<URI> ring, Map<URI, TrackerClient> trackerClients) { Set<URI> excludedUris = LoadBalancerStrategy.ExcludedHostHints.getRequestContextExcludedHosts(requestContext) == null ? new HashSet<>() : LoadBalancerStrategy.ExcludedHostHints.getRequestContextExcludedHosts(requestContext); int hashCode = _requestHashFunction.hash(request); URI uri = ring.get(hashCode); TrackerClient trackerClient = trackerClients.get(uri); if (trackerClient == null || excludedUris.contains(uri)) { Iterator<URI> ringIterator = ring.getIterator(hashCode); while (ringIterator.hasNext()) { uri = ringIterator.next(); trackerClient = trackerClients.get(uri); if (trackerClient != null && !excludedUris.contains(uri)) { break; } } trackerClient = null; } if (trackerClient == null) { trackerClient = trackerClients.values().stream() .filter(latestTrackerClient -> !excludedUris.contains(latestTrackerClient.getUri())) .findAny().orElse(null); if (trackerClient != null) { LOG.warn("Did not find a valid client from the ring, picked instead", trackerClient.getUri()); } } addToExcludedHosts(trackerClient, requestContext); return trackerClient; }
Source:
public void testIsStageNode() throws Exception { setupForStage(); assertTrue(CaseManagementCommandUtil.isStageNode(child)); }

Target:
public void testIsStageNode() { setupForStage(); assertTrue(CaseManagementCommandUtil.isStageNode(child)); }
Source:
public LockStep(String resource) { if (resource == null || resource.isEmpty()) { throw new IllegalArgumentException("must specify resource"); } if (LockableResourcesManager.get().fromName(resource) == null) { throw new IllegalArgumentException("resource [" + resource + "] does not exist, missing global definition?"); } this.resource = resource; }

Target:
public LockStep(String resource) { if (resource == null || resource.isEmpty()) { throw new IllegalArgumentException("must specify resource"); } this.resource = resource; }
Source:
public void bbCodesWithTextThatShouldPass(String postBody, String messageIfTestFails) throws Exception { info("Running a test case [" + messageIfTestFails + "]"); try { Topics.postAnswer(TEST_TOPIC, new Post(postBody)); } catch (ValidationException e) { fail(messageIfTestFails); } catch (CouldNotOpenPageException e) { fail("Something went wrong and user was thrown out of topic."); } }

Target:
public void bbCodesWithTextThatShouldPass(String postBody, String messageIfTestFails) throws Exception { info("Running a test case [" + messageIfTestFails + "]"); try { Topics.postAnswer(TEST_TOPIC, new Post(postBody)); } catch (ValidationException e) { fail(messageIfTestFails); } }
Source:
public JiraSite getSite() { List<JiraSite> sites = JiraGlobalConfiguration.getInstance().getSites(); if (siteName == null && sites.size() > 0) { return sites.get(0); } for (JiraSite site : sites) { if (site.getName().equals(siteName)) { return site; } } ItemGroup itemGroup = owner.getParent(); if (itemGroup instanceof AbstractFolder<?>) { do { AbstractFolder<?> folder = (AbstractFolder<?>) itemGroup; JiraFolderProperty jiraFolderProperty = folder.getProperties() .get(JiraFolderProperty.class); if (jiraFolderProperty != null) { for (JiraSite site : jiraFolderProperty.getSites()) { if (site.getName().equals(siteName)) { return site; } } } itemGroup = folder.getParent(); } while (itemGroup instanceof AbstractFolder<?>); } return null; }

Target:
public JiraSite getSite() { List<JiraSite> sites = JiraGlobalConfiguration.get().getSites(); if (siteName == null && sites.size() > 0) { return sites.get(0); } Stream<JiraSite> streams = sites.stream(); if (owner != null) { Stream<JiraSite> stream2 = JiraFolderProperty.getSitesFromFolders(owner.getParent()) .stream(); streams = Stream.concat(streams, stream2).parallel(); } return streams.filter(jiraSite -> jiraSite.getName().equals(siteName)) .findFirst().orElse(null); }
Source:
public Tracer getTracer(StagemonitorPlugin.InitArguments initArguments) { final brave.Tracer braveTracer = brave.Tracer.newBuilder() .localServiceName(initArguments.getMeasurementSession().getApplicationName()) .reporter(getZipkinReporterBuilder(initArguments).build()) .sampler(getSampler()) .build(); return BraveTracer.newBuilder(braveTracer) .textMapPropagation(B3HeaderFormat.INSTANCE, Propagation.B3_STRING) .build(); }

Target:
public Tracer getTracer(StagemonitorPlugin.InitArguments initArguments) { final Tracing braveTracer = Tracing.newBuilder() .localServiceName(initArguments.getMeasurementSession().getApplicationName()) .reporter(getZipkinReporterBuilder(initArguments).build()) .sampler(getSampler()) .build(); return BraveTracer.newBuilder(braveTracer) .textMapPropagation(B3HeaderFormat.INSTANCE, Propagation.B3_STRING) .build(); }
Source:
public static void initializeSPA() { final String METHOD_NAME = "initializeSPA()"; specialAbilities = new Hashtable<>(); edgeTriggers = new Hashtable<>(); implants = new Hashtable<>(); Document xmlDoc = null; try { InputStream is = new FileInputStream("data/universe/defaultspa.xml"); DocumentBuilder db = MekHqXmlUtil.newSafeDocumentBuilder(); xmlDoc = db.parse(is); is.close(); } catch (Exception ex) { MekHQ.getLogger().error(SpecialAbility.class, METHOD_NAME, ex); } Element spaEle = xmlDoc.getDocumentElement(); NodeList nl = spaEle.getChildNodes(); spaEle.normalize(); PersonnelOptions options = new PersonnelOptions(); for (int x = 0; x < nl.getLength(); x++) { Node wn = nl.item(x); if (wn.getParentNode() != spaEle) continue; int xc = wn.getNodeType(); if (xc == Node.ELEMENT_NODE) { String xn = wn.getNodeName(); if (xn.equalsIgnoreCase("ability") || xn.equalsIgnoreCase("edgeTrigger") || xn.equalsIgnoreCase("implant")) { SpecialAbility.generateInstanceFromXML(wn, options, null); } } } SpecialAbility.trackDefaultSPA(); }

Target:
public static void initializeSPA() { final String METHOD_NAME = "initializeSPA()"; specialAbilities = new Hashtable<>(); edgeTriggers = new Hashtable<>(); implants = new Hashtable<>(); Document xmlDoc = null; try (InputStream is = new FileInputStream("data/universe/defaultspa.xml")) { DocumentBuilder db = MekHqXmlUtil.newSafeDocumentBuilder(); xmlDoc = db.parse(is); } catch (Exception ex) { MekHQ.getLogger().error(SpecialAbility.class, METHOD_NAME, ex); } Element spaEle = xmlDoc.getDocumentElement(); NodeList nl = spaEle.getChildNodes(); spaEle.normalize(); PersonnelOptions options = new PersonnelOptions(); for (int x = 0; x < nl.getLength(); x++) { Node wn = nl.item(x); if (wn.getParentNode() != spaEle) continue; int xc = wn.getNodeType(); if (xc == Node.ELEMENT_NODE) { String xn = wn.getNodeName(); if (xn.equalsIgnoreCase("ability") || xn.equalsIgnoreCase("edgeTrigger") || xn.equalsIgnoreCase("implant")) { SpecialAbility.generateInstanceFromXML(wn, options, null); } } } SpecialAbility.trackDefaultSPA(); }
Source:
private boolean isDisabledByStorage(ThingUID thingUID) { return storage == null || Boolean.FALSE.equals(storage.get(thingUID.getAsString())); }

Target:
private boolean isDisabledByStorage(ThingUID thingUID) { return storage != null && Boolean.FALSE.equals(storage.get(thingUID.getAsString())); }
Source:
public void id3EnergyWiriter() { try { String res = averageEnergy + "-" + inTransitionTimes.toString() + "-" + outTransitionTimes.toString(); tag.deleteField("TXXX"); FrameBodyTXXX txxxBody = new FrameBodyTXXX(); txxxBody.setDescription("Average Energy and into and outro transitions"); txxxBody.setText(res); AbstractID3v2Frame frame = null; if (tag instanceof ID3v23Tag) { frame = new ID3v23Frame("TXXX"); } else if (tag instanceof ID3v24Tag) { frame = new ID3v24Frame("TXXX"); } frame.setBody(txxxBody); tag.setField(frame); song.setTag(tag); song.commit(); tag = song.getID3v2Tag(); } catch (FieldDataInvalidException | CannotWriteException e) { log.error("Error in Track while writing energyLevels to ID3"); log.trace(StackTrace.stackTrace(e)); } }

Target:
public void id3EnergyWiriter() { try { String res = averageEnergy + "/" + differences.toString(); tag.deleteField(customWriteTag); FrameBodyTXXX txxxBody = new FrameBodyTXXX(); txxxBody.setDescription("Average Energy and into and outro transitions"); txxxBody.setText(res); AbstractID3v2Frame frame = null; if (tag instanceof ID3v23Tag) { frame = new ID3v23Frame(customWriteTag); } else if (tag instanceof ID3v24Tag) { frame = new ID3v24Frame(customWriteTag); } frame.setBody(txxxBody); tag.setField(frame); song.setTag(tag); song.commit(); tag = song.getID3v2Tag(); } catch (FieldDataInvalidException | CannotWriteException e) { log.error("Error in Track while writing energyLevels to ID3"); log.trace(StackTrace.stackTrace(e)); } }
Source:
public static void setObjectRetention_test1() throws Exception { String methodName = "setObjectRetention(SetObjectRetentionArgs args)"; if (!mintEnv) { System.out.println("Test: " + methodName); } long startTime = System.currentTimeMillis(); String bucketName = getRandomName(); String objectName = getRandomName(); try { client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).objectLock(true).build()); try { ZonedDateTime retentionUntil = ZonedDateTime.now(Time.UTC).plusDays(1).withNano(0); Retention expectedConfig = new Retention(RetentionMode.GOVERNANCE, retentionUntil); try (final InputStream is = new ContentInputStream(1 * KB)) { PutObjectOptions options = new PutObjectOptions(1 * KB, -1); options.setContentType(customContentType); client.putObject(bucketName, objectName, is, options); } client.setObjectRetention( SetObjectRetentionArgs.builder() .bucket(bucketName) .object(objectName) .config(expectedConfig) .build()); Retention emptyConfig = new Retention(); client.setObjectRetention( SetObjectRetentionArgs.builder() .bucket(bucketName) .object(objectName) .config(emptyConfig) .bypassGovernanceMode(true) .build()); } finally { client.removeObject( RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); client.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build()); } mintSuccessLog(methodName, null, startTime); } catch (Exception e) { handleException(methodName, null, startTime, e); } }

Target:
public static void setObjectRetention_test1() throws Exception { String methodName = "setObjectRetention(SetObjectRetentionArgs args)"; if (!mintEnv) { System.out.println("Test: " + methodName); } long startTime = System.currentTimeMillis(); String bucketName = getRandomName(); String objectName = getRandomName(); try { client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).objectLock(true).build()); try { client.putObject( bucketName, objectName, new ContentInputStream(1 * KB), new PutObjectOptions(1 * KB, -1)); ZonedDateTime retentionUntil = ZonedDateTime.now(Time.UTC).plusDays(1); Retention expectedConfig = new Retention(RetentionMode.GOVERNANCE, retentionUntil); client.setObjectRetention( SetObjectRetentionArgs.builder() .bucket(bucketName) .object(objectName) .config(expectedConfig) .build()); Retention emptyConfig = new Retention(); client.setObjectRetention( SetObjectRetentionArgs.builder() .bucket(bucketName) .object(objectName) .config(emptyConfig) .bypassGovernanceMode(true) .build()); } finally { client.removeObject( RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); client.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build()); } mintSuccessLog(methodName, null, startTime); } catch (Exception e) { handleException(methodName, null, startTime, e); } }
Source:
public QueryResponse process(QueryResponse input) throws PluginExecutionException, StopProcessingException { LOGGER.trace("ENTERING: process (for PostFederatedQueryPlugin)"); if (null != input) { Set<ProcessingDetails> processingDetails = input.getProcessingDetails(); List<Result> results = input.getResults(); Iterator<ProcessingDetails> iterator = processingDetails.iterator(); while (iterator.hasNext()) { ProcessingDetails next = iterator.next(); if (next != null && next.getException() != null) { String sourceId = next.getSourceId(); updateMetric(sourceId, EXCEPTIONS_SCOPE, 1); } } Map<String, Integer> totalHitsPerSource = new HashMap<String, Integer>(); for (Result result : results) { String sourceId = result.getMetacard().getSourceId(); if (totalHitsPerSource.containsKey(sourceId)) { totalHitsPerSource.put(sourceId, totalHitsPerSource.get(sourceId) + 1); } else { totalHitsPerSource.put(sourceId, 1); } } for (Map.Entry<String, Integer> source : totalHitsPerSource.entrySet()) { updateMetric(source.getKey(), QUERIES_TOTAL_RESULTS_SCOPE, source.getValue()); } for (Map.Entry<String, Serializable> property : input.getProperties().entrySet()) { String key = property.getKey(); if (key.startsWith(METRICS_SOURCE_ELAPSED)) { String source = key.substring(METRICS_SOURCE_ELAPSED.length()); updateMetric(source, QUERIES_LATENCY_SCOPE, (int) property.getValue()); } } } LOGGER.trace("EXITING: process (for PostFederatedQueryPlugin)"); return input; }

Target:
public QueryResponse process(QueryResponse input) throws PluginExecutionException, StopProcessingException { LOGGER.trace("ENTERING: process (for PostFederatedQueryPlugin)"); if (null != input) { Set<ProcessingDetails> processingDetails = input.getProcessingDetails(); List<Result> results = input.getResults(); updateExceptionsMetric(processingDetails); updateTotalHitsMetric(results); updateLatencyMetric(input); } LOGGER.trace("EXITING: process (for PostFederatedQueryPlugin)"); return input; }
Source:
public void run() { count--; AbstractContributionItem[] copy = itemsToUpdateLater.toArray(new AbstractContributionItem[] {}); itemsToUpdateLater.clear(); for (AbstractContributionItem it : copy) { it.updateItemEnablement(); } }

Target:
public void run() { count = 0; AbstractContributionItem[] copy = itemsToUpdateLater.toArray(new AbstractContributionItem[] {}); itemsToUpdateLater.clear(); for (AbstractContributionItem it : copy) { it.updateItemEnablement(); } }
Source:
public int readUnsignedByte() { byte b; if (bitOffset != 0) { b = (byte) ((data[byteOffset] << bitOffset) | ((data[byteOffset + 1] & 0xFF) >> (8 - bitOffset))); } else { b = data[byteOffset]; } byteOffset++; return b & 0xFF; }

Target:
public int readUnsignedByte() { int value; if (bitOffset != 0) { value = (data[byteOffset] << bitOffset) | ((data[byteOffset + 1] & 0xFF) >>> (8 - bitOffset)); } else { value = data[byteOffset]; } byteOffset++; return value & 0xFF; }
Source:
public void testFileSystemInaccessible() throws Exception { File inaccessibleDir = null; boolean tcSuccessfull = true; try { String dirPath = getContext().getFilesDir() + File.separator + "inaccessible"; inaccessibleDir = new File(dirPath); inaccessibleDir.mkdir(); final FileRotator rotate = new FileRotator( inaccessibleDir, PREFIX, SECOND_IN_MILLIS, SECOND_IN_MILLIS); Libcore.os.chmod(inaccessibleDir.getPath(), 0); rotate.maybeRotate(TEST_TIME); } catch (Exception e) { tcSuccessfull = false; } assertTrue("unable to delete directory", inaccessibleDir.delete()); assertTrue("test failed with an exception", tcSuccessfull); }

Target:
public void testFileSystemInaccessible() throws Exception { File inaccessibleDir = null; String dirPath = getContext().getFilesDir() + File.separator + "inaccessible"; inaccessibleDir = new File(dirPath); final FileRotator rotate = new FileRotator(inaccessibleDir, PREFIX, SECOND_IN_MILLIS, SECOND_IN_MILLIS); rotate.maybeRotate(TEST_TIME); }
Source:
public void withProfvis(String userAction, final Command command) { withDependencies( "Preparing Profiler", userAction, profvisDependenciesArray(), false, new CommandWithArg<Boolean>() { @Override public void execute(Boolean succeeded) { if (succeeded) command.execute(); } } ); }

Target:
public void withProfvis(String userAction, final Command command) { withDependencies( "Preparing Profiler", userAction, new Dependency[] { Dependency.embeddedPackage("profvis") }, false, new CommandWithArg<Boolean>() { @Override public void execute(Boolean succeeded) { if (succeeded) command.execute(); } } ); }
Source:
public void execute(URI uri, final ConnectionCallback connectionCallback) { final boolean isSsl = "https".equalsIgnoreCase(uri.getScheme()); int port = uri.getPort(); if (port < 0) { if (isSsl) { port = 443; } else { port = 80; } } final InetSocketAddress remoteAddress = new InetSocketAddress(uri.getHost(), port); if (enablePooling) { ListenableFuture<?> acquireFuture = connectionPermits.acquire(); acquireFuture.addListener(new Runnable() { @Override public void run() { connectionPermitAcquired(isSsl, remoteAddress, connectionCallback); } }, executor); } else { ChannelFuture future = bootstrap.connect(remoteAddress); if (isSsl) { future.addListener(new SslConnectionListener(remoteAddress, connectionCallback, openChannels)); } else { future.addListener(new CallbackConnectionListener(remoteAddress, connectionCallback, openChannels)); } } }

Target:
public void execute(URI uri, final ConnectionCallback connectionCallback) { final boolean isSsl = "https".equalsIgnoreCase(uri.getScheme()); int port = uri.getPort(); if (port < 0) { if (isSsl) { port = 443; } else { port = 80; } } final InetSocketAddress remoteAddress = new InetSocketAddress(uri.getHost(), port); if (enablePooling) { ListenableFuture<?> acquireFuture = connectionPermits.acquire(); acquireFuture.addListener(new Runnable() { @Override public void run() { connectionPermitAcquired(isSsl, remoteAddress, connectionCallback); } }, executor); } else { openConnecton(isSsl, remoteAddress, connectionCallback); } }
Source:
public void init() { this.context.register(BatchConfiguration.class); this.context.refresh(); JobRepository jobRepository = this.context.getBean(JobRepository.class); JobLauncher jobLauncher = this.context.getBean(JobLauncher.class); this.jobs = new JobBuilderFactory(jobRepository); PlatformTransactionManager transactionManager = this.context .getBean(PlatformTransactionManager.class); this.steps = new StepBuilderFactory(jobRepository, transactionManager); Tasklet tasklet = (contribution, chunkContext) -> null; this.step = this.steps.get("step").tasklet(tasklet).build(); this.job = this.jobs.get("job").start(this.step).build(); this.jobExplorer = this.context.getBean(JobExplorer.class); this.runner = new TaskJobLauncherCommandLineRunner(jobLauncher, this.jobExplorer); this.context.getBean(BatchConfiguration.class).clear(); }

Target:
public void init() { this.jobs = new JobBuilderFactory(this.jobRepository); this.steps = new StepBuilderFactory(this.jobRepository, this.transactionManager); Tasklet tasklet = (contribution, chunkContext) -> null; this.step = this.steps.get("step").tasklet(tasklet).build(); this.job = this.jobs.get("job").start(this.step).build(); this.runner = new TaskJobLauncherCommandLineRunner(this.jobLauncher, this.jobExplorer); }
Source:
public int cancel () { if (parent() != null) parent().removeChildAction(this); int outcome; synchronized (_cancelLock) { if (TxStats.enabled() && running()) TxStats.getInstance().incrementApplicationRollbacks(); outcome = super.Abort(); } if (outcome == ActionStatus.ABORTED) { afterCompletion(outcome); } return outcome; }

Target:
public int cancel () { if (parent() != null) parent().removeChildAction(this); int outcome = super.Abort(true); if (outcome == ActionStatus.ABORTED) { afterCompletion(outcome); } return outcome; }
Source:
public void onResetClusterEmulatedMachine() { ConfirmationModel model = (ConfirmationModel) getWindow(); if (model.getProgress() != null) { return; } ArrayList<VdcActionParametersBase> prms = new ArrayList<VdcActionParametersBase>(); for (Object vdsGroup : getSelectedItems()) { ManagementNetworkOnClusterOperationParameters currentParam = new ManagementNetworkOnClusterOperationParameters(((VDSGroup) vdsGroup)); currentParam.setForceResetEmulatedMachine(true); prms.add(currentParam); } model.startProgress(null); Frontend.getInstance().runMultipleAction(VdcActionType.UpdateVdsGroup, prms, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { ConfirmationModel localModel = (ConfirmationModel) result.getState(); localModel.stopProgress(); cancel(); } }, model); }

Target:
public void onResetClusterEmulatedMachine() { final ConfirmationModel model = (ConfirmationModel) getWindow(); if (model.getProgress() != null) { return; } ArrayList<VdcActionParametersBase> prms = new ArrayList<VdcActionParametersBase>(); for (VDSGroup vdsGroup : getSelectedItems()) { ManagementNetworkOnClusterOperationParameters currentParam = new ManagementNetworkOnClusterOperationParameters(((VDSGroup) vdsGroup)); currentParam.setForceResetEmulatedMachine(true); prms.add(currentParam); } model.startProgress(null); Frontend.getInstance().runMultipleAction(VdcActionType.UpdateVdsGroup, prms, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { model.stopProgress(); cancel(); } }); }
Source:
public static void getPresignedObjectUrl_test4() throws Exception { String methodName = "getPresignedObjectUrl(GetPresignedObjectUrlArgs args)"; if (!mintEnv) { System.out.println("Test: presigned put object: " + methodName); } long startTime = System.currentTimeMillis(); try { String objectName = getRandomName(); String urlString = client.getPresignedObjectUrl( GetPresignedObjectUrlArgs.builder() .method(Method.PUT) .bucket(bucketName) .object(objectName) .build()); byte[] data = "hello, world".getBytes(StandardCharsets.UTF_8); writeObject(urlString, data); client.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); mintSuccessLog(methodName, "presigned put object", startTime); } catch (Exception e) { handleException(methodName, "presigned put object", startTime, e); } }

Target:
public static void getPresignedObjectUrl_test4() throws Exception { String methodName = "getPresignedObjectUrl(GetPresignedObjectUrlArgs args)"; if (!mintEnv) { System.out.println("Test: " + methodName + " presigned put"); } long startTime = System.currentTimeMillis(); try { String objectName = getRandomName(); String urlString = client.getPresignedObjectUrl( GetPresignedObjectUrlArgs.builder() .method(Method.PUT) .bucket(bucketName) .object(objectName) .build()); byte[] data = "hello, world".getBytes(StandardCharsets.UTF_8); writeObject(urlString, data); client.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); mintSuccessLog(methodName, null, startTime); } catch (Exception e) { handleException(methodName, null, startTime, e); } }
Source:
public void testGetResources() throws Exception { URL testJar = ZipUtilsTest.class.getResource("/codenvy/codenvy.jar"); @SuppressWarnings("unchecked") Consumer<InputStream> consumer = mock(Consumer.class); ZipUtils.getResources(new ZipFile(testJar.getFile()), Pattern.compile(".*[ verify(consumer, times(2)).accept(any(InputStream.class)); }

Target:
public void testGetResources() throws Exception { URL testJar = ZipUtilsTest.class.getResource("/che/che.jar"); @SuppressWarnings("unchecked") Consumer<InputStream> consumer = mock(Consumer.class); ZipUtils.getResources(new ZipFile(testJar.getFile()), Pattern.compile(".*[ verify(consumer, times(2)).accept(any(InputStream.class)); }
Source:
public WorkspaceImpl create(WorkspaceImpl workspace) throws ConflictException, ServerException { requireNonNull(workspace, "Required non-null workspace"); try { doCreate(workspace); eventService.publish(new WorkspaceCreatedEvent(workspace)); } catch (DuplicateKeyException dkEx) { throw new ConflictException(format("Workspace with id '%s' or name '%s' in namespace '%s' already exists", workspace.getId(), workspace.getConfig().getName(), workspace.getNamespace())); } catch (RuntimeException x) { throw new ServerException(x.getMessage(), x); } return new WorkspaceImpl(workspace); }

Target:
public WorkspaceImpl create(WorkspaceImpl workspace) throws ConflictException, ServerException { requireNonNull(workspace, "Required non-null workspace"); try { doCreate(workspace); } catch (DuplicateKeyException dkEx) { throw new ConflictException(format("Workspace with id '%s' or name '%s' in namespace '%s' already exists", workspace.getId(), workspace.getConfig().getName(), workspace.getNamespace())); } catch (RuntimeException x) { throw new ServerException(x.getMessage(), x); } return new WorkspaceImpl(workspace); }
Source:
protected void validateExpression() throws IllegalArgumentException { DayOfMonthExpressionPart domPart = (DayOfMonthExpressionPart) getExpressionPart(DayOfMonthExpressionPart.class); DayOfWeekExpressionPart dowPart = (DayOfWeekExpressionPart) getExpressionPart(DayOfWeekExpressionPart.class); if (domPart.isNotSpecific() && dowPart.isNotSpecific()) { throw new IllegalArgumentException( "The DayOfMonth and DayOfWeek rule parts CAN NOT be not specific at the same time."); } YearsExpressionPart yearsPart = (YearsExpressionPart) getExpressionPart(YearsExpressionPart.class); if (yearsPart == null) { List<@NonNull CronExpressionPart> ep = getExpressionParts(); List<@NonNull CronExpressionPart> parts = new LinkedList<@NonNull CronExpressionPart>(); parts.addAll(ep); try { parts.add(new YearsExpressionPart("*")); } catch (ParseException e) { throw new IllegalArgumentException("Year rule part can contain * as a token"); } setExpressionParts(parts); } }

Target:
protected void validateExpression() throws IllegalArgumentException { DayOfMonthExpressionPart domPart = (DayOfMonthExpressionPart) getExpressionPart(DayOfMonthExpressionPart.class); DayOfWeekExpressionPart dowPart = (DayOfWeekExpressionPart) getExpressionPart(DayOfWeekExpressionPart.class); if (domPart.isNotSpecific() && dowPart.isNotSpecific()) { throw new IllegalArgumentException( "The DayOfMonth and DayOfWeek rule parts CAN NOT be not specific at the same time."); } YearsExpressionPart yearsPart = (YearsExpressionPart) getExpressionPart(YearsExpressionPart.class); if (yearsPart == null) { List<@NonNull CronExpressionPart> ep = getExpressionParts(); List<@NonNull CronExpressionPart> parts = new LinkedList<@NonNull CronExpressionPart>(); parts.addAll(ep); try { parts.add(new YearsExpressionPart("*")); } catch (ParseException e) { throw new IllegalArgumentException("Year rule part must contain * as a token"); } setExpressionParts(parts); } }
Source:
public Collection<String> expectedQueueNames() { this.isListener = true; Collection<String> replyQueue = null; if (this.replyAddress != null) { Address address = new Address(this.replyAddress); if ("".equals(address.getExchangeName())) { replyQueue = Collections.singletonList(address.getRoutingKey()); } else { logger.debug("Cannot verify reply queue because it has the form 'exchange/routingKey'"); } } else if (this.replyAddress == null || this.replyAddress.equals(Address.AMQ_RABBITMQ_REPLY_TO)) { throw new IllegalStateException("A listener container must not be provided when using direct reply-to"); } return replyQueue; }

Target:
public Collection<String> expectedQueueNames() { this.isListener = true; Collection<String> replyQueue = null; if (this.replyAddress == null || this.replyAddress.equals(Address.AMQ_RABBITMQ_REPLY_TO)) { throw new IllegalStateException("A listener container must not be provided when using direct reply-to"); } else if (this.replyAddress != null) { Address address = new Address(this.replyAddress); if ("".equals(address.getExchangeName())) { replyQueue = Collections.singletonList(address.getRoutingKey()); } else { logger.info("Cannot verify reply queue because 'replyAddress' is not a simple queue name: " + this.replyAddress); } } return replyQueue; }
Source:
public void shouldMoveDocsToColdStorage() throws OperationException, IOException { ACE[] aces = { new ACE("linda", SecurityConstants.READ, true), new ACE("linda", SecurityConstants.WRITE, true), new ACE("linda", SecurityConstants.WRITE_COLD_STORAGE, true) }; List<DocumentModel> documents = List.of(createFileDocument(session, true, "MyFile1", aces), createFileDocument(session, true, "MyFile2", aces), createFileDocument(session, true, "MyFile3", aces)); try (CloseableCoreSession userSession = CoreInstance.openCoreSession(session.getRepositoryName(), "linda")) { moveContentToColdStorage(userSession, documents); } documents = List.of(createFileDocument(session, true, "MyFile4", aces), createFileDocument(session, true, "MyFile5", aces), createFileDocument(session, true, "MyFile6", aces)); moveContentToColdStorage(session, documents); }

Target:
public void shouldMoveDocsToColdStorage() throws OperationException, IOException { ACE[] aces = { new ACE("linda", SecurityConstants.READ, true), new ACE("linda", SecurityConstants.WRITE, true), new ACE("linda", SecurityConstants.WRITE_COLD_STORAGE, true) }; List<DocumentModel> documents = List.of(createFileDocument(session, true, aces), createFileDocument(session, true, aces), createFileDocument(session, true, aces)); try (CloseableCoreSession userSession = CoreInstance.openCoreSession(session.getRepositoryName(), "linda")) { moveContentToColdStorage(userSession, documents); } documents = List.of(createFileDocument(session, true), createFileDocument(session, true), createFileDocument(session, true)); moveContentToColdStorage(session, documents); }
Source:
public Iterator<List<CandidateCellForSweeping>> getCandidateCellsForSweeping( TableReference tableRef, CandidateCellForSweepingRequest request, ConsistencyLevel consistencyLevel) { Iterator<List<CassandraRawCellValue>> rawIter = cellPager.createCellIterator( tableRef, request.startRowInclusive(), request.batchSizeHint().orElse(100), consistencyLevel); return new CellGroupingIterator(rawIter, request); }

Target:
public Iterator<List<CandidateCellForSweeping>> getCandidateCellsForSweeping( TableReference tableRef, CandidateCellForSweepingRequest request, ConsistencyLevel consistencyLevel) { Iterator<List<CassandraRawCellValue>> rawIter = cellPager.createCellIterator( tableRef, request.startRowInclusive(), request.batchSizeHint().orElse(AtlasDbConstants.DEFAULT_SWEEP_CANDIDATE_BATCH_HINT), consistencyLevel); return new CellGroupingIterator(rawIter, request); }
Source:
public void testListRules() { List<FirewallRule> firewalls = firewallApi().getRuleList(dataCenter.id(), testServer.id(), testNic.id()); assertNotNull(firewalls); assertFalse(firewalls.isEmpty()); assertEquals(firewalls.size(), 1); }

Target:
public void testListRules() { List<FirewallRule> firewalls = firewallApi().list(dataCenter.id(), testServer.id(), testNic.id()); assertNotNull(firewalls); assertFalse(firewalls.isEmpty()); assertTrue(Iterables.any(firewalls, new Predicate<FirewallRule>() { @Override public boolean apply(FirewallRule input) { return input.id().equals(testFirewallRule.id()); } })); }
Source:
public AddVmParameters(VmStatic vmStatic) { super(vmStatic); }

Target:
public AddVmParameters(VmStatic vmStatic) { super(vmStatic); diskInfoList = new ArrayList<DiskImage>(); }
Source:
public void beginTask(String name, int totalWork) { fTaskName = name; fSubTaskName = ""; updateLabel(); if ((totalWork == IProgressMonitor.UNKNOWN || totalWork == 0) && !fProgressIndicator.isDisposed()) { fProgressIndicator.beginAnimatedTask(); } else { fProgressIndicator.beginTask(totalWork); } if (fToolBar != null && !fToolBar.isDisposed()) { fToolBar.setVisible(true); fToolBar.setFocus(); } }

Target:
public void beginTask(String name, int totalWork) { fTaskName = name; fSubTaskName = ""; updateLabel(); if (!fProgressIndicator.isDisposed()) { if (totalWork == IProgressMonitor.UNKNOWN || totalWork == 0) { fProgressIndicator.beginAnimatedTask(); } else { fProgressIndicator.beginTask(totalWork); } } if (fToolBar != null && !fToolBar.isDisposed()) { fToolBar.setVisible(true); fToolBar.setFocus(); } }
Source:
static ChannelStateByteBuffer wrap(BufferBuilder bufferBuilder) { final byte[] buf = new byte[1024]; return new ChannelStateByteBuffer() { @Override public boolean isWritable() { return !bufferBuilder.isFull(); } @Override public int writableBytes() { return bufferBuilder.writableBytes(); } @Override public int writeBytes(InputStream input, int upToBytes) throws IOException { int left = upToBytes; for (int toRead = getToRead(left); toRead > 0; toRead = getToRead(left)) { int read = input.read(buf, 0, toRead); int copied = bufferBuilder.append(java.nio.ByteBuffer.wrap(buf, 0, read)); Preconditions.checkState(copied == read); left -= read; } bufferBuilder.commit(); return upToBytes - left; } private int getToRead(int bytesToRead) { return min(bytesToRead, min(buf.length, writableBytes())); } }; }

Target:
static ChannelStateByteBuffer wrap(BufferBuilder bufferBuilder) { final byte[] buf = new byte[1024]; return new ChannelStateByteBuffer() { @Override public boolean isWritable() { return !bufferBuilder.isFull(); } @Override public int writeBytes(InputStream input, int bytesToRead) throws IOException { int left = bytesToRead; for (int toRead = getToRead(left); toRead > 0; toRead = getToRead(left)) { int read = input.read(buf, 0, toRead); int copied = bufferBuilder.append(java.nio.ByteBuffer.wrap(buf, 0, read)); Preconditions.checkState(copied == read); left -= read; } bufferBuilder.commit(); return bytesToRead - left; } private int getToRead(int bytesToRead) { return min(bytesToRead, min(buf.length, bufferBuilder.getWritableBytes())); } }; }
Source:
private void setupRecyclerView(List<Layer> layers) { mLayersAdapter = new LayersAdapter(this); mLayersRecyclerView.setAdapter(mLayersAdapter); for (Layer layer : layers) { if (layer.canShowInLegend()) { layer.addDoneLoadingListener(() -> { mLayersAdapter.addLayer(layer); }); layer.loadAsync(); } } }

Target:
private void setupRecyclerView(List<Layer> layers) { mLayersAdapter = new LayersAdapter(this); mLayersRecyclerView.setAdapter(mLayersAdapter); for (Layer layer : layers) { if (layer.canShowInLegend()) { layer.addDoneLoadingListener(() -> mLayersAdapter.addLayer(layer)); layer.loadAsync(); } } }
Source:
private static boolean isCalled(final int totalDepth, final int altDepth, final double sumOfAltQualities, final double alleleFraction, final double logOddsThreshold) { final double threshold = 10.0 * (altDepth * -Math.log10(alleleFraction) + (totalDepth - altDepth) * -Math.log10(1.0 - alleleFraction) + logOddsThreshold); return sumOfAltQualities > threshold; }

Target:
static boolean isCalled(final int totalDepth, final int altDepth, final double sumOfAltQualities, final double alleleFraction, final double logOddsThreshold) { final double threshold = 10.0 * (altDepth * -Math.log10(alleleFraction) + (totalDepth - altDepth) * -Math.log10(1.0 - alleleFraction) + logOddsThreshold); return sumOfAltQualities > threshold; }
Source:
public void execute(SensorContext context) { List<InputFile> inputFiles = new ArrayList<>(); fileSystem.inputFiles(mainFilesPredicate).forEach(inputFiles::add); if (inputFiles.isEmpty()) { return; } ProgressReport progressReport = new ProgressReport("Report about progress of XML analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(inputFiles.stream().map(InputFile::toString).collect(Collectors.toList())); boolean successfullyCompleted = false; boolean cancelled = false; try { for (InputFile inputFile : inputFiles) { if (context.isCancelled()) { cancelled = true; break; } scanFile(context, inputFile); progressReport.nextFile(); } successfullyCompleted = !cancelled; } finally { if (successfullyCompleted) { progressReport.stop(); } else { progressReport.cancel(); } } }

Target:
public void execute(SensorContext context) { List<InputFile> inputFiles = new ArrayList<>(); fileSystem.inputFiles(mainFilesPredicate).forEach(inputFiles::add); if (inputFiles.isEmpty()) { return; } ProgressReport progressReport = new ProgressReport("Report about progress of XML analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(inputFiles.stream().map(InputFile::toString).collect(Collectors.toList())); boolean cancelled = false; try { for (InputFile inputFile : inputFiles) { if (context.isCancelled()) { cancelled = true; break; } scanFile(context, inputFile); progressReport.nextFile(); } } finally { if (!cancelled) { progressReport.stop(); } else { progressReport.cancel(); } } }
Source:
public ByteBuf writeRequest(final ByteBufAllocator alloc, final ByteBuffer dst) { writeBinaryHeader(dst, OpCode.FLUSH, 0, 4, 4, 0, opaque); if (delay >= 0) { dst.putInt(delay); } return toBuffer(alloc, dst); }

Target:
public ByteBuf writeRequest(final ByteBufAllocator alloc, final ByteBuffer dst) { writeBinaryHeader(dst, OpCode.FLUSH, 0, 4, 4, 0, opaque); dst.putInt(delay); return toBuffer(alloc, dst); }
Source:
public void testTaskWithDisableAutoClaimTaskWithGroupOnly() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); env.set("Autoclaim", new String("false")); ksession.setEnvironment(env); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Ready, task.getStatus()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }

Target:
public void testTaskWithDisableAutoClaimTaskWithGroupOnly() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); env.set("Autoclaim", "false"); ksession.setEnvironment(env); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Ready, task.getStatus()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }