auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testFlowSetupMetrics() throws InterruptedException { assertEquals(0, this.testUtil.getTimerCount(ExecMetrics.FLOW_SETUP_TIMER_NAME)); Timer.Context context = this.metrics.getFlowSetupTimerContext(); try { Thread.sleep(100); } finally { context.stop(); } assertEquals(1, this.testUtil.getTimerCount(ExecMetrics.FLOW_SETUP_TIMER_NAME)); Snapshot snapshot = this.testUtil.getTimerSnapshot(ExecMetrics.FLOW_SETUP_TIMER_NAME); double val = snapshot.getMax(); assertTrue(snapshot.getMax() > 100); }

Target:
public void testFlowSetupMetrics() throws InterruptedException { assertThat(this.testUtil.getTimerCount(ExecMetrics.FLOW_SETUP_TIMER_NAME)).isEqualTo(0); Timer.Context context = this.metrics.getFlowSetupTimerContext(); try { Thread.sleep(10); } finally { context.stop(); } assertThat(this.testUtil.getTimerCount(ExecMetrics.FLOW_SETUP_TIMER_NAME)).isEqualTo(1); Snapshot snapshot = this.testUtil.getTimerSnapshot(ExecMetrics.FLOW_SETUP_TIMER_NAME); double val = snapshot.getMax(); assertThat(snapshot.getMax()).isGreaterThanOrEqualTo(10); }
Source:
public void testPrepareThirdPartyOverrideUrlNull() { LicenseMojoUtils.prepareThirdPartyOverrideUrl( resolvedUrl, deprecatedFile, url, basedir, log ); }

Target:
public void testPrepareThirdPartyOverrideUrlNull() { String actual = LicenseMojoUtils.prepareThirdPartyOverrideUrl( resolvedUrl, deprecatedFile, url, basedir, log ); assertEquals( LicenseMojoUtils.NO_URL, actual ); }
Source:
private List<StoreKey> getConvertedStoreKeys(List<? extends StoreKey> storeKeys) throws Exception { Map<StoreKey, StoreKey> convertionMap = storeKeyConverterFactory.getStoreKeyConverter().convert(storeKeys); List<StoreKey> convertedStoreKeys = new ArrayList<>(); storeKeys.stream().forEach(storeKey -> convertedStoreKeys.add(convertionMap.get(storeKey))); return convertedStoreKeys; }

Target:
private List<StoreKey> getConvertedStoreKeys(List<? extends StoreKey> storeKeys) throws Exception { Map<StoreKey, StoreKey> conversionMap = storeKeyConverterFactory.getStoreKeyConverter().convert(storeKeys); List<StoreKey> convertedStoreKeys = new ArrayList<>(); for (StoreKey key : storeKeys) { StoreKey convertedKey = conversionMap.get(key); convertedStoreKeys.add(convertedKey == null ? key : convertedKey); } return convertedStoreKeys; }
Source:
boolean isAssignmentValid(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { return node.getFaultZone() == null || !clusterContext .getPartitionsForResourceAndFaultZone(node.getFaultZone(), replica.getResourceName()) .contains(replica.getPartitionName()); }

Target:
boolean isAssignmentValid(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { if (!node.hasFaultZone()) { return true; } return !clusterContext .getPartitionsForResourceAndFaultZone(replica.getResourceName(), node.getFaultZone()) .contains(replica.getPartitionName()); }
Source:
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) { if (element instanceof GoNamedElement) { String result = getSignature(element); if (result != "") { return result; } } return super.getQuickNavigateInfo(element, originalElement); }

Target:
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) { if (element instanceof GoNamedElement) { String result = getSignature(element); if (!result.isEmpty()) { return result; } } return super.getQuickNavigateInfo(element, originalElement); }
Source:
public Codec getCodec() { return new MLRCodec(); }

Target:
public Codec getCodec() { return mlrDataCodec; }
Source:
public void update(Observable arg0, Object arg1) { if (arg0 != player) { return; } if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION) { return; } if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION) { final String msg = "Error Event Received"; if (player != null && player.getError() != null) { Log.e(TAG, msg, player.getError()); } else { Log.e(TAG, msg); } return; } count++ ; String text="Notification Received: " + arg1 + " - state: " + player.getState() + "count: " +count; if(count==1) { try { Process process = new ProcessBuilder().command("logcat", "-c").redirectErrorStream(true).start(); } catch (IOException e) { } } File logFile = new File("sdcard/log.file"); if (!logFile.exists()) { try { logFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } try { BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true)); buf.append(text); buf.newLine(); buf.close(); } catch (IOException e) { e.printStackTrace(); } Log.d(TAG, "Notification Received: " + arg1 + " - state: " + player.getState()); }

Target:
public void update(Observable arg0, Object arg1) { if (arg0 != player) { return; } if (arg1 == OoyalaPlayer.TIME_CHANGED_NOTIFICATION) { return; } if (arg1 == OoyalaPlayer.ERROR_NOTIFICATION) { final String msg = "Error Event Received"; if (player != null && player.getError() != null) { Log.e(TAG, msg, player.getError()); } else { Log.e(TAG, msg); } return; } count++ ; String text="Notification Received: " + arg1 + " - state: " + player.getState() + "count: " +count; BasicPlaybackSampleAppLog BasicPlaybacklog= new BasicPlaybackSampleAppLog(); BasicPlaybacklog.writeToSdcardLog(count,text); Log.d(TAG, "Notification Received: " + arg1 + " - state: " + player.getState()); }
Source:
protected String getResource() { return "manualtaskmodel.bpmn"; }

Target:
protected String getResource() { return "manualTaskModel.bpmn"; }
Source:
private Void uploadFile(final String remotePath) { try { return retryExecutor() .withRetryLimit(maxConnectionRetry) .withInitialRetryWait(500) .withMaxRetryWait(30 * 1000) .runInterruptible(new Retryable<Void>() { @Override public Void call() throws InterruptedException, IOException, RetryGiveupException { FileObject remoteFile = newSftpFile(getSftpFileUri(remotePath)); logger.info("new sftp file: {}", remoteFile.getPublicURIString()); try (BufferedOutputStream outputStream = new BufferedOutputStream(remoteFile.getContent().getOutputStream())) { try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(tempFile))) { IOUtils.copy(inputStream, outputStream); } } return null; } @Override public boolean isRetryableException(Exception exception) { return true; } @Override public void onRetry(Exception exception, int retryCount, int retryLimit, int retryWait) throws RetryGiveupException { String message = String.format("SFTP output failed. Retrying %d/%d after %d seconds. Message: %s", retryCount, retryLimit, retryWait / 1000, exception.getMessage()); if (retryCount % 3 == 0) { logger.warn(message, exception); } else { logger.warn(message); } } @Override public void onGiveup(Exception firstException, Exception lastException) throws RetryGiveupException { } }); } catch (RetryGiveupException ex) { throw Throwables.propagate(ex.getCause()); } catch (InterruptedException ex) { throw Throwables.propagate(ex); } }

Target:
private Void uploadFile(final String remotePath) { try { return retryExecutor() .withRetryLimit(maxConnectionRetry) .withInitialRetryWait(500) .withMaxRetryWait(30 * 1000) .runInterruptible(new Retryable<Void>() { @Override public Void call() throws IOException { FileObject remoteFile = newSftpFile(getSftpFileUri(remotePath)); logger.info("new sftp file: {}", remoteFile.getPublicURIString()); try (BufferedOutputStream outputStream = new BufferedOutputStream(remoteFile.getContent().getOutputStream())) { try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(tempFile))) { IOUtils.copy(inputStream, outputStream); } } return null; } @Override public boolean isRetryableException(Exception exception) { return true; } @Override public void onRetry(Exception exception, int retryCount, int retryLimit, int retryWait) throws RetryGiveupException { String message = String.format("SFTP output failed. Retrying %d/%d after %d seconds. Message: %s", retryCount, retryLimit, retryWait / 1000, exception.getMessage()); if (retryCount % 3 == 0) { logger.warn(message, exception); } else { logger.warn(message); } } @Override public void onGiveup(Exception firstException, Exception lastException) throws RetryGiveupException { } }); } catch (RetryGiveupException ex) { throw Throwables.propagate(ex.getCause()); } catch (InterruptedException ex) { throw Throwables.propagate(ex); } }
Source:
public void removeAllDownloads() { final String username = loginPrefs.getUsername(); final String sha1Username; if (TextUtils.isEmpty(username)) { return; } else { sha1Username = Sha1Util.SHA1(username); } db.getListOfOngoingDownloads(new DataCallback<List<VideoModel>>(false) { @Override public void onResult(List<VideoModel> result) { long videoIds = new long[result.size()]; int i = 0; for (VideoModel model : result) { db.deleteVideoByVideoId(model, null, sha1Username); videoIds[i] = model.getDmId(); i++; } dm.removeDownload(videoIds); EventBus.getDefault().post(new DownloadedVideoDeletedEvent()); } @Override public void onFail(Exception ex) { } }); }

Target:
public void removeAllDownloads() { final String username = loginPrefs.getUsername(); final String sha1Username; if (TextUtils.isEmpty(username)) { return; } else { sha1Username = Sha1Util.SHA1(username); } db.getListOfOngoingDownloads(new DataCallback<List<VideoModel>>(false) { @Override public void onResult(List<VideoModel> result) { long videoIds = new long[result.size()]; VideoModel model; for (int i=0; i<result.size(); i++) { model = result.get(i); db.deleteVideoByVideoId(model, null, sha1Username); videoIds[i] = model.getDmId(); } dm.removeDownloads(videoIds); EventBus.getDefault().post(new DownloadedVideoDeletedEvent()); } @Override public void onFail(Exception ex) { } }); }
Source:
public static Image create(String id, String name, OSFamliyType osFamily, OSType os, String osVersion, List<String> availableSites, int architecture, String osImageType, ImageType type, int minHddSize, List<Licenses> licenses, String state, String description, List<Hdd> hdds, String serverId, ImageFrequency frequency, int numImages, String creationDate) { return new AutoValue_Image(id, name, osFamily, os, osVersion, availableSites, architecture, osImageType, type, minHddSize, licenses, state, description, hdds, serverId, frequency, numImages, creationDate); }

Target:
public static Image create(String id, String name, OSFamliyType osFamily, OSType os, String osVersion, List<String> availableSites, int architecture, String osImageType, ImageType type, int minHddSize, List<Licenses> licenses, String state, String description, List<Hdd> hdds, String serverId, ImageFrequency frequency, int numImages, String creationDate) { return new AutoValue_Image(id, name, osFamily, os, osVersion, availableSites == null ? ImmutableList.<String>of() : availableSites, architecture, osImageType, type, minHddSize, licenses == null ? ImmutableList.<Licenses>of() : licenses, state, description, hdds == null ? ImmutableList.<Hdd>of() : hdds, serverId, frequency, numImages, creationDate); }
Source:
private ResultScanner<Row> streamRows(ReadRowsRequest request) { final ClientCall<ReadRowsRequest , ReadRowsResponse> readRowsCall = channel.newCall(BigtableServiceGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); final Iterator<ReadRowsResponse> results = ClientCalls.blockingServerStreamingCall( readRowsCall, request); return new ResultScanner<Row>() { @Override public void close() throws IOException { readRowsCall.cancel(); } @Override public Row[] next(int count) throws IOException { List<Row> rows = new ArrayList<>(); for (int i = 0; i < count; i++) { rows.add(next()); } return (Row[]) rows.toArray(new Row[rows.size()]); } @Override public Row next() throws IOException { if (!results.hasNext()) { return null; } StreamingBigtableResultScanner.RowMerger rowMerger = new StreamingBigtableResultScanner.RowMerger(); while (!rowMerger.isRowCommitted()) { Preconditions.checkState( results.hasNext(), "End of stream marker encountered while merging a row."); rowMerger.addPartialRow(results.next()); } return rowMerger.buildRow(); } }; }

Target:
private ResultScanner<Row> streamRows(ReadRowsRequest request) { final ClientCall<ReadRowsRequest, ReadRowsResponse> readRowsCall = channel.newCall(BigtableServiceGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); final Iterator<ReadRowsResponse> results = ClientCalls.blockingServerStreamingCall(readRowsCall, request); final Iterator<ReadRowsResponse> iterator = ClientCalls.blockingServerStreamingCall(readRowsCall, request); return new AbstractBigtableResultScanner() { @Override public void close() throws IOException { readRowsCall.cancel(); } @Override public Row next() throws IOException { if (!results.hasNext()) { return null; } RowMerger rowMerger = new RowMerger(); while (!rowMerger.isRowCommitted()) { Preconditions.checkState( results.hasNext(), "End of stream marker encountered while merging a row."); rowMerger.addPartialRow(results.next()); } return iterator.hasNext() ? RowMerger.readNextRow(iterator) : null; } }; }
Source:
public void canDoActionFailedGuestOsIsNotSupported() { VM vm = mockVmStatusUp(); vm.setVmOs(15); cretaeVirtIODisk(); when(osRepository.getOsName(15)).thenReturn("RHEL3x64"); when(osRepository.getDiskHotpluggableInterfaces(any(Integer.class), any(Version.class))).thenReturn(new ArrayList<String>()); assertFalse(command.canDoAction()); assertTrue(command.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED.toString())); }

Target:
public void canDoActionFailedGuestOsIsNotSupported() { VM vm = mockVmStatusUp(); vm.setVmOs(15); cretaeVirtIODisk(); when(osRepository.getOsName(15)).thenReturn("RHEL3x64"); when(osRepository.getDiskHotpluggableInterfaces(any(Integer.class), any(Version.class))).thenReturn(Collections.<String>emptySet()); assertFalse(command.canDoAction()); assertTrue(command.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED.toString())); }
Source:
private BlockAppender prepareMetaBlock(String name, Algorithm compressAlgo) throws IOException, MetaBlockAlreadyExists { if (blkInProgress) { throw new IllegalStateException("Cannot create Meta Block until previous block is closed."); } if (metaIndex.getMetaByName(name) != null) { throw new MetaBlockAlreadyExists("name=" + name); } MetaBlockRegister mbr = new MetaBlockRegister(name, compressAlgo); WBlockState wbs = new WBlockState(compressAlgo, out, fsOutputBuffer, conf, encryptionStrategy); BlockAppender ba = new BlockAppender(mbr, wbs); blkInProgress = true; metaBlkSeen = true; return ba; }

Target:
private BlockAppender prepareMetaBlock(String name, Algorithm compressAlgo) throws IOException, MetaBlockAlreadyExists { if (blkInProgress) { throw new IllegalStateException("Cannot create Meta Block until previous block is closed."); } if (metaIndex.getMetaByName(name) != null) { throw new MetaBlockAlreadyExists("name=" + name); } MetaBlockRegister mbr = new MetaBlockRegister(name, compressAlgo); WBlockState wbs = new WBlockState(compressAlgo, out, fsOutputBuffer, conf, encrypter); BlockAppender ba = new BlockAppender(mbr, wbs); blkInProgress = true; metaBlkSeen = true; return ba; }
Source:
public void createControl(final Composite parent) { container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout()); sash = new SashForm(container, SWT.VERTICAL); sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); sash.setBackground(sash.getDisplay().getSystemColor(SWT.COLOR_GRAY)); outputsScrolledComposite = new ScrolledComposite(sash, SWT.V_SCROLL); outputsScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); outputsContainer = new Composite(outputsScrolledComposite, SWT.NONE); final GridLayout outputsLayout = new GridLayout(4, false); outputsLayout.marginHeight = 10; outputsLayout.marginWidth = 0; outputsContainer.setLayout(outputsLayout); outputsScrolledComposite.setContent(outputsContainer); outputsScrolledComposite.setExpandHorizontal(true); outputsScrolledComposite.setExpandVertical(true); outputsContainer.layout(); outputsScrolledComposite.setMinSize(outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-5); tableContainer = new Composite(sash, SWT.NONE); final GridLayout tableLayout = new GridLayout(); tableLayout.marginHeight = 0; tableLayout.marginWidth = 0; tableContainer.setLayout(tableLayout); previewTable = new CustomEventsTablePreview(new CustomTxtTraceDefinition(), tableContainer, 0); previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); if (wizard.definition != null) { loadDefinition(wizard.definition); } setControl(container); }

Target:
public void createControl(final Composite parent) { container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout()); sash = new SashForm(container, SWT.VERTICAL); sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); sash.setBackground(sash.getDisplay().getSystemColor(SWT.COLOR_GRAY)); outputsScrolledComposite = new ScrolledComposite(sash, SWT.V_SCROLL); outputsScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); outputsContainer = new Composite(outputsScrolledComposite, SWT.NONE); final GridLayout outputsLayout = new GridLayout(4, false); outputsLayout.marginHeight = 10; outputsLayout.marginWidth = 0; outputsContainer.setLayout(outputsLayout); outputsScrolledComposite.setContent(outputsContainer); outputsScrolledComposite.setExpandHorizontal(true); outputsScrolledComposite.setExpandVertical(true); outputsContainer.layout(); outputsScrolledComposite.setMinSize(outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-5); tableContainer = new Composite(sash, SWT.NONE); final GridLayout tableLayout = new GridLayout(); tableLayout.marginHeight = 0; tableLayout.marginWidth = 0; tableContainer.setLayout(tableLayout); previewTable = new TmfEventsTable(tableContainer, 0, CustomEventTableColumns.generateColumns(new CustomTxtTraceDefinition())); previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); if (wizard.definition != null) { loadDefinition(wizard.definition); } setControl(container); }
Source:
public Boolean propagateResourceEvent(final long agentId, final ResourceState.Event event) throws AgentUnavailableException { final String msPeer = getPeerName(agentId); if (msPeer == null) { return null; } if (s_logger.isDebugEnabled()) { s_logger.debug("Propagating resource request event:" + event.toString() + " to agent:" + agentId); } final Command[] cmds = new Command[1]; cmds[0] = new PropagateResourceEventCommand(agentId, event); final String AnsStr = _clusterMgr.execute(msPeer, agentId, _gson.toJson(cmds), true); if (AnsStr == null) { throw new AgentUnavailableException(agentId); } final Answer[] answers = _gson.fromJson(AnsStr, Answer[].class); if (s_logger.isDebugEnabled()) { s_logger.debug("Result for agent change is " + answers[0].getResult()); } return answers[0].getResult(); }

Target:
public Boolean propagateResourceEvent(final long agentId, final ResourceState.Event event) throws AgentUnavailableException { final String msPeer = getPeerName(agentId); if (msPeer == null) { return null; } s_logger.debug("Propagating resource request event:" + event.toString() + " to agent:" + agentId); final Command[] cmds = new Command[1]; cmds[0] = new PropagateResourceEventCommand(agentId, event); final String AnsStr = _clusterMgr.execute(msPeer, agentId, _gson.toJson(cmds), true); if (AnsStr == null) { throw new AgentUnavailableException(agentId); } final Answer[] answers = _gson.fromJson(AnsStr, Answer[].class); if (s_logger.isDebugEnabled()) { s_logger.debug("Result for agent change is " + answers[0].getResult()); } return answers[0].getResult(); }
Source:
public void theBundleRequestContainsAGetPeriodicMeterReadsActionWithParameters(final Map<String, String> parameters) throws Throwable { final BundleRequest request = (BundleRequest) ScenarioContext.current() .get(PlatformSmartmeteringKeys.BUNDLE_REQUEST); final GetPeriodicMeterReadsRequest action = new GetPeriodicMeterReadsRequestBuilder() .fromParameterMap(parameters).build(); this.addActionToBundleRequest(request, action); }

Target:
public void theBundleRequestContainsAGetPeriodicMeterReadsActionWithParameters(final Map<String, String> parameters) throws Throwable { final GetPeriodicMeterReadsRequest action = new GetPeriodicMeterReadsRequestBuilder() .fromParameterMap(parameters).build(); this.addActionToBundleRequest(action); }
Source:
public void onStartup(Set<Class<?>> classes, ServletContext context) throws ServletException { System.err.println(">>>>>>> ON START ...... " ); Collection<? extends ServletRegistration> registrations = context .getServletRegistrations().values(); if (registrations.isEmpty()) { return; } DeploymentConfiguration config = StubServletConfig .createDeploymentConfiguration(context, registrations.iterator().next(), VaadinServlet.class); initDevModeHandler(classes, context, config); }

Target:
public void onStartup(Set<Class<?>> classes, ServletContext context) throws ServletException { Collection<? extends ServletRegistration> registrations = context .getServletRegistrations().values(); if (registrations.isEmpty()) { return; } DeploymentConfiguration config = StubServletConfig .createDeploymentConfiguration(context, registrations.iterator().next(), VaadinServlet.class); initDevModeHandler(classes, context, config); }
Source:
public void run() { if (!fStateSystemAssigned) { System.err.println("Cannot run event manager without assigning a target state system first!"); return; } @NonNull ITmfEvent event; event = checkNotNull(fEventsQueue.take()); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = checkNotNull(fEventsQueue.take()); continue; } currentEvent = event; eventHandle(event); event = checkNotNull(fEventsQueue.take()); } closeStateSystem(); }

Target:
public void run() { if (!fStateSystemAssigned) { System.err.println("Cannot run event manager without assigning a target state system first!"); return; } @NonNull ITmfEvent event = checkNotNull(fEventsQueue.take()); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = checkNotNull(fEventsQueue.take()); continue; } currentEvent = event; eventHandle(event); event = checkNotNull(fEventsQueue.take()); } closeStateSystem(); }
Source:
public synchronized void init0() throws Throwable { localDatabase.init(); }

Target:
public void init0() throws Throwable { localDatabase.init(); }
Source:
private void validateQualifiers(Element element, Map<Element, Element> parametersToTheirMethods) { int numberOfQualifiersOnElement = 0; for (AnnotationMirror annotation : element.getAnnotationMirrors()) { if (annotation.getAnnotationType().asElement().getAnnotation(Qualifier.class) != null) { switch (element.getKind()) { case FIELD: numberOfQualifiersOnElement++; if (element.getAnnotation(Inject.class) == null) { warning("Dagger will ignore qualifier annotations on fields that are not " + "annotated with @Inject: " + elementToString(element), element); } break; case METHOD: numberOfQualifiersOnElement++; if (!isProvidesMethod(element)) { warning("Dagger will ignore qualifier annotations on methods that are not " + "@Provides methods: " + elementToString(element), element); } break; case PARAMETER: numberOfQualifiersOnElement++; if (!isInjectableConstructorParameter(element, parametersToTheirMethods) && !isProvidesMethodParameter(element, parametersToTheirMethods)) { warning("Dagger will ignore qualifier annotations on parameters that are not " + "@Inject constructor parameters or @Provides method parameters: " + elementToString(element), element); } break; default: error("Qualifier annotations are only allowed on fields, methods, and parameters: " + elementToString(element), element); } } } if (numberOfQualifiersOnElement > 1) { error("Only one qualifier annotation is allowed per element: " + elementToString(element), element); } }

Target:
private void validateQualifiers(Element element, Map<Element, Element> parametersToTheirMethods) { boolean suppressWarnings = element.getAnnotation(SuppressWarnings.class) != null && Arrays.asList( element.getAnnotation(SuppressWarnings.class).value()).contains("qualifiers"); int numberOfQualifiersOnElement = 0; for (AnnotationMirror annotation : element.getAnnotationMirrors()) { if (annotation.getAnnotationType().asElement().getAnnotation(Qualifier.class) == null) { continue; } switch (element.getKind()) { case FIELD: numberOfQualifiersOnElement++; if (element.getAnnotation(Inject.class) == null && !suppressWarnings) { warning("Dagger will ignore qualifier annotations on fields that are not " + "annotated with @Inject: " + elementToString(element), element); } break; case METHOD: numberOfQualifiersOnElement++; if (!isProvidesMethod(element) && !suppressWarnings) { warning("Dagger will ignore qualifier annotations on methods that are not " + "@Provides methods: " + elementToString(element), element); } break; case PARAMETER: numberOfQualifiersOnElement++; if (!isInjectableConstructorParameter(element, parametersToTheirMethods) && !isProvidesMethodParameter(element, parametersToTheirMethods) && !suppressWarnings) { warning("Dagger will ignore qualifier annotations on parameters that are not " + "@Inject constructor parameters or @Provides method parameters: " + elementToString(element), element); } break; default: error("Qualifier annotations are only allowed on fields, methods, and parameters: " + elementToString(element), element); } } if (numberOfQualifiersOnElement > 1) { error("Only one qualifier annotation is allowed per element: " + elementToString(element), element); } }
Source:
TypeToExtend(PackageElement typePackage, TypeElement typeToExtend, TypeElement... supertypes) { this.typeToExtend = typeToExtend; this.typePackage = typePackage; List<ExecutableElement> allMethods = extractMethods(typeToExtend); for (TypeElement supertype : supertypes) { allMethods.addAll(extractMethods(supertype)); } Map<String, ExecutableElement> unifiedMethods = allMethods .stream() .collect(Collectors.toMap(ExecutableElement::toString, Function.identity(), (name1, name2) -> name1)); methods = Sets.newHashSet(unifiedMethods.values()); constructors = extractConstructors(typeToExtend); }

Target:
TypeToExtend(PackageElement typePackage, TypeElement typeToExtend, TypeElement... supertypes) { this.typeToExtend = typeToExtend; this.typePackage = typePackage; List<ExecutableElement> allMethods = extractMethods(typeToExtend); for (TypeElement supertype : supertypes) { allMethods.addAll(extractMethods(supertype)); } Map<String, ExecutableElement> methodSignatureToMethod = allMethods .stream() .collect(Collectors.toMap(ExecutableElement::toString, Function.identity(), (methodSignature1, methodSignature2) -> methodSignature1)); methods = Sets.newHashSet(methodSignatureToMethod.values()); constructors = extractConstructors(typeToExtend); }
Source:
protected int incrementCount() { return ++this.count; }

Target:
protected int incrementCount() { return ++count; }
Source:
public Response resetPasswordByAdmin(UserCredentialWrapper credentials) throws MDMAPIException { UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); ResponsePayload responsePayload = new ResponsePayload(); try { byte[] decodedNewPassword = Base64.decodeBase64(credentials.getNewPassword()); userStoreManager.updateCredentialByAdmin(credentials.getUsername(), new String( decodedNewPassword, "UTF-8")); responsePayload.setStatusCode(HttpStatus.SC_CREATED); responsePayload.setMessageFromServer("User password by username: " + credentials.getUsername() + " was successfully changed."); return Response.status(HttpStatus.SC_CREATED).entity(responsePayload).build(); } catch (UserStoreException e) { String errorMsg = "Exception in trying to change the password by username: " + credentials.getUsername(); log.error(errorMsg, e); responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST); responsePayload.setMessageFromServer("Could not change the password."); return Response.status(HttpStatus.SC_BAD_REQUEST).entity(responsePayload).build(); } catch (UnsupportedEncodingException e) { String errorMsg = "Exception in trying to change the password by username: " + credentials.getUsername(); log.error(errorMsg, e); throw new MDMAPIException(errorMsg, e); } }

Target:
public Response resetPasswordByAdmin(UserCredentialWrapper credentials) throws MDMAPIException { return CredentialManagementResponseBuilder.buildResetPasswordResponse(credentials); }
Source:
public void register() { getChart().getPlotArea().addMouseTrackListener(this); fTooltipHandler.activateHoverHelp(getChart().getPlotArea()); }

Target:
public void register() { fTooltipHandler.activateHoverHelp(getChart().getPlotArea()); }
Source:
public void rollback() { if ( !isActive() ) { if ( jpaCompliance.isJpaTransactionComplianceEnabled() ) { throw new IllegalStateException( "JPA compliance dictates throwing IllegalStateException when #rollback " + "is called on non-active transaction" ); } } TransactionStatus status = getStatus(); if ( status == TransactionStatus.ROLLED_BACK || status == TransactionStatus.NOT_ACTIVE ) { if ( LOG.isDebugEnabled() ) { LOG.debug( "rollback() called on an inactive transaction" ); } return; } if ( !status.canRollback() ) { throw new TransactionException( "Cannot rollback transaction in current status [" + status.name() + "]" ); } if ( LOG.isDebugEnabled() ) { LOG.debug( "rolling back" ); } if ( status != TransactionStatus.FAILED_COMMIT || allowFailedCommitToPhysicallyRollback() ) { internalGetTransactionDriverControl().rollback(); } }

Target:
public void rollback() { if ( !isActive() ) { if ( jpaCompliance.isJpaTransactionComplianceEnabled() ) { throw new IllegalStateException( "JPA compliance dictates throwing IllegalStateException when #rollback " + "is called on non-active transaction" ); } } TransactionStatus status = getStatus(); if ( status == TransactionStatus.ROLLED_BACK || status == TransactionStatus.NOT_ACTIVE ) { LOG.debug( "rollback() called on an inactive transaction" ); return; } if ( !status.canRollback() ) { throw new TransactionException( "Cannot rollback transaction in current status [" + status.name() + "]" ); } LOG.debug( "rolling back" ); if ( status != TransactionStatus.FAILED_COMMIT || allowFailedCommitToPhysicallyRollback() ) { internalGetTransactionDriverControl().rollback(); } }
Source:
public LabelTypes getLabelTypes() { Map<String, LabelType> types = Maps.newLinkedHashMap(); List<ProjectState> projects = Lists.newArrayList(tree()); Collections.reverse(projects); for (ProjectState s : projects) { for (LabelType type : s.getConfig().getLabelSections().values()) { LabelType old = types.get(type.getName()); if (old == null || !old.canOverride()) { types.put(type.getName(), type); } } } List<LabelType> all = Lists.newArrayListWithCapacity(types.size()); for (LabelType type : types.values()) { if (!type.getValues().isEmpty()) { all.add(type); } } labelTypes = new LabelTypes(Collections.unmodifiableList(all)); }

Target:
public LabelTypes getLabelTypes() { Map<String, LabelType> types = Maps.newLinkedHashMap(); List<ProjectState> projects = Lists.newArrayList(tree()); Collections.reverse(projects); for (ProjectState s : projects) { for (LabelType type : s.getConfig().getLabelSections().values()) { LabelType old = types.get(type.getName()); if (old == null || !old.canOverride()) { types.put(type.getName(), type); } } } List<LabelType> all = Lists.newArrayListWithCapacity(types.size()); for (LabelType type : types.values()) { if (!type.getValues().isEmpty()) { all.add(type); } } return new LabelTypes(Collections.unmodifiableList(all)); }
Source:
private String fenToChessboard(String text) { Boolean showBlack = false; Matcher mf = fFenPattern.matcher(text); StringBuffer sb = new StringBuffer(); while (mf.find()) { if (mf.group(1) != null) { Matcher mo = fFenOrientationPattern.matcher(mf.group(1)); if (mo.find() && mo.group(1) != null && mo.group(1).equalsIgnoreCase("black")) { showBlack = true; } } try { mf.appendReplacement(sb, "<script type=\"text/javascript\">document.write(" + String.format(Locale.US, fRenderFen, mf.group(2), showBlack) + ");</script>"); } catch (Exception e) { Timber.e("ChessFilter exception: %s", e); } } mf.appendTail(sb); return sb.toString(); }

Target:
private String fenToChessboard(String text) { Boolean showBlack = false; Matcher mf = fFenPattern.matcher(text); StringBuffer sb = new StringBuffer(); while (mf.find()) { if (mf.group(1) != null) { Matcher mo = fFenOrientationPattern.matcher(mf.group(1)); if (mo.find() && mo.group(1) != null && mo.group(1).equalsIgnoreCase("black")) { showBlack = true; } } try { mf.appendReplacement(sb, "<script type=\"text/javascript\">document.write(" + String.format(Locale.US, fRenderFen, mf.group(2), showBlack) + ");</script>"); } catch (Exception e) { Timber.e(e, "ChessFilter exception: "); } } mf.appendTail(sb); return sb.toString(); }
Source:
private List evaluateSingleSource(QueryMetadata metadata, Map<Expression<?>, Iterable<?>> iterables, boolean count) { final Expression<?> source = metadata.getJoins().get(0).getTarget(); final List<Expression<?>> sources = Collections.<Expression<?>>singletonList(source); final Iterable<?> iterable = iterables.values().iterator().next(); List<?> list; if (iterable instanceof List) { list = (List)iterable; } else { list = IteratorAdapter.asList(iterable.iterator()); } if (metadata.getWhere() != null) { Evaluator<List<?>> evaluator = (Evaluator)evaluatorFactory .createEvaluator(metadata, source, metadata.getWhere()); list = evaluator.evaluate(list); } if (!count && !list.isEmpty()) { if (!metadata.getOrderBy().isEmpty()) { if (list == iterable) { list = new ArrayList(list); } order(metadata, sources, list); } if (!metadata.getProjection().equals(source)) { list = project(metadata, sources, list); } if (metadata.getModifiers().isRestricting()) { list = metadata.getModifiers().subList(list); } if (list.isEmpty()) { return list; } } if (metadata.isDistinct()) { list = distinct(list); } return list; }

Target:
private List evaluateSingleSource(QueryMetadata metadata, Map<Expression<?>, Iterable<?>> iterables, boolean count) { final Expression<?> source = metadata.getJoins().get(0).getTarget(); final List<Expression<?>> sources = Collections.<Expression<?>>singletonList(source); final Iterable<?> iterable = iterables.values().iterator().next(); List<?> list; if (iterable instanceof List) { list = (List)iterable; } else { list = IteratorAdapter.asList(iterable.iterator()); } if (metadata.getWhere() != null) { Evaluator<List<?>> evaluator = (Evaluator)evaluatorFactory .createEvaluator(metadata, source, metadata.getWhere()); list = evaluator.evaluate(list); } if (!count && !list.isEmpty()) { if (!metadata.getOrderBy().isEmpty()) { if (list == iterable) { list = new ArrayList(list); } order(metadata, sources, list); } if (metadata.getProjection() != null && !metadata.getProjection().equals(source)) { list = project(metadata, sources, list); } if (metadata.getModifiers().isRestricting()) { list = metadata.getModifiers().subList(list); } if (list.isEmpty()) { return list; } } if (metadata.isDistinct()) { list = distinct(list); } return list; }
Source:
public void setExpirationTime(final Date expirationTime) { this.expirationTime = expirationTime; }

Target:
public void setExpirationTime(final Date expirationTime) { this.expirationTime = new Date(expirationTime.getTime()); }
Source:
public void testFetch() throws JGitInternalException, IOException, GitAPIException, URISyntaxException { Repository db2 = createWorkRepository(); Git git2 = new Git(db2); final Config config = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(config, "test"); URIish uri = new URIish(db2.getDirectory().toURI().toURL()); remoteConfig.addURI(uri); remoteConfig.update(config); RevCommit commit = git2.commit().setMessage("initial commit").call(); RevTag tag = git2.tag().setName("tag").call(); Git git1 = new Git(db); RefSpec spec = new RefSpec("refs/heads/master:refs/heads/x"); git1.fetch().setRemote("test").setRefSpecs(spec) .call(); assertTrue(commit.getId().equals( db.resolve(commit.getId().getName() + "^{commit}"))); assertTrue(tag.getId().equals(db.resolve(tag.getId().getName()))); }

Target:
public void testFetch() throws JGitInternalException, IOException, GitAPIException, URISyntaxException { Repository db2 = createWorkRepository(); Git git2 = new Git(db2); final Config config = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(config, "test"); URIish uri = new URIish(db2.getDirectory().toURI().toURL()); remoteConfig.addURI(uri); remoteConfig.update(config); RevCommit commit = git2.commit().setMessage("initial commit").call(); RevTag tag = git2.tag().setName("tag").call(); Git git1 = new Git(db); RefSpec spec = new RefSpec("refs/heads/master:refs/heads/x"); git1.fetch().setRemote("test").setRefSpecs(spec) .call(); assertEquals(commit.getId(), db.resolve(commit.getId().getName() + "^{commit}")); assertEquals(tag.getId(), db.resolve(tag.getId().getName())); }
Source:
void checkFile(@TempDir File tempDir, @TempDir Path ref) { final Path path = tempDir.toPath(); assertEquals(ref.toAbsolutePath(), path.toAbsolutePath()); assertTrue(Files.exists(path)); }

Target:
void checkFile(@TempDir File tempDir, @TempDir Path ref) { Path path = tempDir.toPath(); assertEquals(ref.toAbsolutePath(), path.toAbsolutePath()); assertTrue(Files.exists(path)); }
Source:
public MobileArticlePageObject openSections(String wikiURL){ getUrl(wikiURL + articleSections); waitForElementByElement(tocWrapper); PageObjectLogging.log("openSections", "sections page was opened", true, driver); return new MobileArticlePageObject(driver); }

Target:
public MobileArticlePageObject openSections(String wikiURL){ getUrl(wikiURL + URLsContent.articleSections); waitForElementByElement(tocWrapper); PageObjectLogging.log("openSections", "sections page was opened", true, driver); return new MobileArticlePageObject(driver); }
Source:
private String[] getVariableNameProposals(ITypeBinding arrayTypeBinding, IJavaProject project) { String[] variableNames= getUsedVariableNames(); String name= fArrayBinding.getName(); String baseName= modifybasename(name); if (name.length() > 2 && name.charAt(name.length() - 1) == 's') { baseName= name.substring(0, name.length() - 1); } String[] elementSuggestions= StubUtility.getLocalNameSuggestions(project, baseName, 0, variableNames); String type= arrayTypeBinding.getElementType().getName(); String[] typeSuggestions= StubUtility.getLocalNameSuggestions(project, type, arrayTypeBinding.getDimensions() - 1, variableNames); String[] result= new String[elementSuggestions.length + typeSuggestions.length]; System.arraycopy(elementSuggestions, 0, result, 0, elementSuggestions.length); System.arraycopy(typeSuggestions, 0, result, elementSuggestions.length, typeSuggestions.length); return result; }

Target:
private String[] getVariableNameProposals(ITypeBinding arrayTypeBinding, IJavaProject project) { String[] variableNames= getUsedVariableNames(); String name= fArrayBinding.getName(); String baseName= modifybasename(name); String[] elementSuggestions= StubUtility.getLocalNameSuggestions(project, baseName, 0, variableNames); String type= arrayTypeBinding.getElementType().getName(); String[] typeSuggestions= StubUtility.getLocalNameSuggestions(project, type, arrayTypeBinding.getDimensions() - 1, variableNames); String[] result= new String[elementSuggestions.length + typeSuggestions.length]; System.arraycopy(elementSuggestions, 0, result, 0, elementSuggestions.length); System.arraycopy(typeSuggestions, 0, result, elementSuggestions.length, typeSuggestions.length); return result; }
Source:
private static boolean containsAll(String text, final Collection<String> items) { final String _text = text.toLowerCase(); return items.stream() .allMatch((String it) -> { return _text.contains(it); }); }

Target:
private static boolean containsAll(String text, final Collection<String> items) { final String _text = text.toLowerCase(); return items.stream() .allMatch(it -> { return _text.contains(it); }); }
Source:
private Patient getPatientByUuid(Config config, String uuid) { Validate.notEmpty(uuid, "Patient Id cannot be empty"); Patient patient; try { patient = patientResource.getPatientById(config, uuid); } catch (HttpServerErrorException | HttpClientErrorException e) { throw new OpenMRSException(String.format("Could not get Patient with uuid: %s. %s %s", uuid, e.getMessage(), e.getResponseBodyAsString()), e); } Identifier motechIdentifier = getMotechIdentifier(config, patient); patient.setMotechIdentifierValues(motechIdentifier); List<Identifier> identifiers = patient.getIdentifiers(); identifiers.remove(motechIdentifier); List<Identifier> supportedIdentifierTypeList = getSupportedIdentifierTypeList(config, identifiers); patient.setIdentifiers(supportedIdentifierTypeList); return patient; }

Target:
private Patient getPatientByUuid(Config config, String uuid) { Validate.notEmpty(uuid, "Patient Id cannot be empty"); Patient patient; try { patient = patientResource.getPatientById(config, uuid); } catch (HttpStatusCodeException e) { throw new OpenMRSException(String.format("Could not get Patient with uuid: %s. %s %s", uuid, e.getMessage(), e.getResponseBodyAsString()), e); } Identifier motechIdentifier = getMotechIdentifier(config, patient); patient.setMotechIdentifierValues(motechIdentifier); List<Identifier> identifiers = patient.getIdentifiers(); identifiers.remove(motechIdentifier); List<Identifier> supportedIdentifierTypeList = getSupportedIdentifierTypeList(config, identifiers); patient.setIdentifiers(supportedIdentifierTypeList); return patient; }
Source:
private void updateMemoryWatchpoint(boolean toggle, boolean interactive, IWorkbenchPart part, IRepositionableMemoryRendering rendering) throws CoreException { int addressableSize = 1; IMemoryBlock memblock = rendering.getMemoryBlock(); if (memblock instanceof IMemoryBlockExtension) { try { addressableSize = ((IMemoryBlockExtension)memblock).getAddressableSize(); } catch (DebugException e) { CDebugUIPlugin.log(e); } } String memorySpace = getMemorySpace(rendering.getMemoryBlock(), null); String address = getSelectedAddress(rendering.getSelectedAddress(), ""); String range = getRange(rendering.getSelectedAsBytes(), addressableSize, "1"); address = "*" + address; createWatchpoint(interactive, part, "", ResourcesPlugin.getWorkspace().getRoot(), -1, -1, -1, address, memorySpace, range); }

Target:
private void updateMemoryWatchpoint(boolean toggle, boolean interactive, IWorkbenchPart part, IRepositionableMemoryRendering rendering) throws CoreException { int addressableSize = 1; IMemoryBlock memblock = rendering.getMemoryBlock(); if (memblock instanceof IMemoryBlockExtension) { try { addressableSize = ((IMemoryBlockExtension)memblock).getAddressableSize(); } catch (DebugException e) { CDebugUIPlugin.log(e); } } String memorySpace = getMemorySpace(rendering.getMemoryBlock(), null); String address = getSelectedAddress(rendering.getSelectedAddress(), ""); String range = getRange(rendering.getSelectedAsBytes(), addressableSize, "1"); createWatchpoint(interactive, part, "", ResourcesPlugin.getWorkspace().getRoot(), -1, -1, -1, address, memorySpace, range); }
Source:
public String getImageUrl(String imageName) { for (WebElement elem:imagesNewFiles) { String href = elem.findElement(parentBy).getAttribute("href"); if (href.contains(imageName)){ return href; } } throw new RuntimeException("there is no " + imageName + " on Special:NewFiles page"); }

Target:
public String getImageUrl(String imageName) { for (WebElement elem:imagesNewFiles) { String href = elem.findElement(parentBy).getAttribute("href"); if (href.contains(imageName)){ return href; } } throw new NoSuchElementException("there is no " + imageName + " on Special:NewFiles page"); }
Source:
public void mbusDeviceWithDeviceIDIsInactive(String mbusDeviceId) throws Throwable { this.deviceHooks.inactivateDevice(mbusDeviceId); }

Target:
public void mbusDeviceWithDeviceIDIsInactive(String mbusDeviceId) { this.deviceHooks.deactivateDevice(mbusDeviceId); }
Source:
public void reset() { RxAndroidPlugins.getInstance().reset(); final TestScheduler testScheduler = new TestScheduler(); RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return testScheduler; } }); AndroidSchedulers.reset(); assertTrue(AndroidSchedulers.mainThread().equals(testScheduler)); RxAndroidPlugins.getInstance().reset(); RxAndroidPlugins.getInstance().registerSchedulersHook(RxAndroidSchedulersHook.getDefaultInstance()); AndroidSchedulers.reset(); assertTrue(AndroidSchedulers.mainThread() instanceof LooperScheduler); }

Target:
public void reset() { RxAndroidPlugins.getInstance().reset(); final TestScheduler testScheduler = new TestScheduler(); RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return testScheduler; } }); AndroidSchedulers.reset(); assertSame(AndroidSchedulers.mainThread(), testScheduler); RxAndroidPlugins.getInstance().reset(); RxAndroidPlugins.getInstance().registerSchedulersHook(RxAndroidSchedulersHook.getDefaultInstance()); AndroidSchedulers.reset(); assertTrue(AndroidSchedulers.mainThread() instanceof LooperScheduler); }
Source:
void handleBody(InputStream payload) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData; switch (getOperationFlag()) { case Blob: blobData = MessageFormatRecord.deserializeBlob(payload); break; default: BlobAll blobAll = MessageFormatRecord.deserializeBlobAll(payload, blobIdFactory); blobInfo = blobAll.getBlobInfo(); blobData = blobAll.getBlobData(); break; } BlobType blobType = blobData.getBlobType(); chunkIndexToBuffer = new TreeMap<>(); if (blobType == BlobType.MetadataBlob) { handleMetadataBlob(blobData); } else { handleSimpleBlob(blobData); } successfullyDeserialized = true; state = ChunkState.Complete; } else { } }

Target:
void handleBody(InputStream payload) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData; if (getOperationFlag() == MessageFormatFlags.Blob) { blobData = MessageFormatRecord.deserializeBlob(payload); } else { BlobAll blobAll = MessageFormatRecord.deserializeBlobAll(payload, blobIdFactory); blobInfo = blobAll.getBlobInfo(); blobData = blobAll.getBlobData(); } BlobType blobType = blobData.getBlobType(); chunkIndexToBuffer = new TreeMap<>(); if (blobType == BlobType.MetadataBlob) { handleMetadataBlob(blobData); } else { handleSimpleBlob(blobData); } successfullyDeserialized = true; state = ChunkState.Complete; } else { } }
Source:
private Schema getGroupKeySchema(Schema inputSchema) { List<Schema.Field> fields = new ArrayList<>(); for (String groupByField : conf.getGroupByFields()) { fields.add(inputSchema.getField(groupByField)); } return Schema.recordOf("group.key.schema", fields); }

Target:
private Schema getGroupKeySchema(Schema inputSchema) { List<Schema.Field> fields = new ArrayList<>(); for (String groupByField : conf.getGroupByFields()) { Schema.Field fieldSchema = inputSchema.getField(groupByField); if (fieldSchema == null) { throw new IllegalArgumentException(String.format( "Cannot group by field '%s' because it does not exist in input schema %s", groupByField, inputSchema)); } fields.add(fieldSchema); } return Schema.recordOf("group.key.schema", fields); }
Source:
public void starImportedFactAlsoDeclaredInDRL() throws Exception { AgendaEventListener ael = mock(AgendaEventListener.class); session.addEventListener(ael); List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(KieServices.Factory.get().getCommands().newInsert(new TestEvent(1, "event 1", 0))); commands.add(KieServices.Factory.get().getCommands().newFireAllRules()); session.execute(KieServices.Factory.get().getCommands().newBatchExecution(commands, null)); try { verify(ael, times(1)).afterMatchFired(any(AfterMatchFiredEvent.class)); } catch (WantedButNotInvoked e) { Assertions.fail("BZ 973264", e); } }

Target:
public void starImportedFactAlsoDeclaredInDRL() throws Exception { session.setGlobal("LOGGER", LOGGER); AgendaEventListener ael = mock(AgendaEventListener.class); session.addEventListener(ael); List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(getCommands().newInsert(new TestEvent(1, "event 1", 0))); commands.add(getCommands().newFireAllRules()); session.execute(getCommands().newBatchExecution(commands, null)); try { verify(ael, times(1)).afterMatchFired(any(AfterMatchFiredEvent.class)); } catch (WantedButNotInvoked e) { Assertions.fail("The rule does not fire. For more information see BZ 973264", e); } }