auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testBloomFilterVirtualColumnNumber() throws Exception { BloomKFilter filter = new BloomKFilter(1500); filter.addFloat(20.2f); byte[] bytes = BloomFilterSerializersModule.bloomKFilterToBytes(filter); String base64 = StringUtils.encodeBase64String(bytes); testQuery( StringUtils.format("SELECT COUNT(*) FROM druid.foo WHERE bloom_filter_test(2 * CAST(dim1 AS float), '%s')", base64), ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(QSS(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns( EXPRESSION_VIRTUAL_COLUMN("v0", "(2 * CAST(\"dim1\", 'DOUBLE'))", ValueType.FLOAT) ) .filters( new BloomDimFilter("v0", BloomKFilterHolder.fromBloomKFilter(filter), null) ) .aggregators(AGGS(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L} ) ); }

Target:
public void testBloomFilterVirtualColumnNumber() throws Exception { BloomKFilter filter = new BloomKFilter(1500); filter.addFloat(20.2f); byte[] bytes = BloomFilterSerializersModule.bloomKFilterToBytes(filter); String base64 = StringUtils.encodeBase64String(bytes); testQuery( StringUtils.format("SELECT COUNT(*) FROM druid.foo WHERE bloom_filter_test(2 * CAST(dim1 AS float), '%s')", base64), ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns( expressionVirtualColumn("v0", "(2 * CAST(\"dim1\", 'DOUBLE'))", ValueType.FLOAT) ) .filters( new BloomDimFilter("v0", BloomKFilterHolder.fromBloomKFilter(filter), null) ) .aggregators(aggregators(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L} ) ); }
Source:
public void testCountStarWithDegenerateFilter() throws Exception { testQuery( "SELECT COUNT(*) FROM druid.foo WHERE dim2 = 'a' and (dim1 > 'a' OR dim1 < 'b')", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .filters( selector("dim2", "a", null) ) .aggregators(aggregators(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{NullHandling.sqlCompatible() ? 2L : 2L} ) ); }

Target:
public void testCountStarWithDegenerateFilter() throws Exception { testQuery( "SELECT COUNT(*) FROM druid.foo WHERE dim2 = 'a' and (dim1 > 'a' OR dim1 < 'b')", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .filters( selector("dim2", "a", null) ) .aggregators(aggregators(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{2L} ) ); }
Source:
private static String getSecretStreamXchacha20poly1305EncryptedBase64String(final byte[] state, final String data, final short tag) { final int[] clen = new int[0]; final byte[] ad = new byte[0]; final byte[] dataBytes = data.getBytes(); final byte[] encryptedData = new byte[dataBytes.length + XCHACHA20POLY1305_ABYTES]; NaCl.sodium().crypto_secretstream_xchacha20poly1305_push( state, encryptedData, clen, dataBytes, dataBytes.length, ad, 0, tag); return Base64.encodeToString(encryptedData, BASE64_ENCODE_FLAGS); }

Target:
private static String getSecretStreamXchacha20poly1305EncryptedBase64String(final byte[] state, final String data, final short tag) { final int[] encryptedDataLengthOutput = new int[0]; final byte[] additionalData = new byte[0]; final int additionalDataLength = 0; final byte[] dataBytes = data.getBytes(); final byte[] encryptedData = new byte[dataBytes.length + XCHACHA20POLY1305_ABYTES]; NaCl.sodium().crypto_secretstream_xchacha20poly1305_push( state, encryptedData, encryptedDataLengthOutput, dataBytes, dataBytes.length, additionalData, additionalDataLength, tag); return Base64.encodeToString(encryptedData, BASE64_ENCODE_FLAGS); }
Source:
private static GatewaySenderEventImpl createMockGatewaySenderEventImpl(int transactionId, boolean isLastEventInTransaction, Region region) { GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class); when(event.getTransactionId()).thenReturn(new TXId(null, transactionId)); when(event.makeHeapCopyIfOffHeap()).thenReturn(event); when(event.isLastEventInTransaction()).thenReturn(isLastEventInTransaction); when(event.getRegion()).thenReturn(region); return event; }

Target:
private GatewaySenderEventImpl createMockGatewaySenderEventImpl(int transactionId, boolean isLastEventInTransaction, Region region) { GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class); when(event.getTransactionId()).thenReturn(new TXId(null, transactionId)); when(event.makeHeapCopyIfOffHeap()).thenReturn(event); when(event.isLastEventInTransaction()).thenReturn(isLastEventInTransaction); when(event.getRegion()).thenReturn(region); return event; }
Source:
private static Integer getSelectionIndex(SWTBotView viewBot) { final TimeGraphControl timegraph = viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); return UIThreadRunnable.syncExec(new IntResult() { @Override public Integer run() { return timegraph.getSelectedIndex(); } }); }

Target:
private static Integer getSelectionIndex(SWTBotView viewBot) { final TimeGraphControl timegraph = viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); return UIThreadRunnable.syncExec(() -> { return timegraph.getSelectedIndex(); }); }
Source:
protected CompletionStage<Void> asyncWrite(MultipartOutput multipartOutput, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, AsyncOutputStream entityStream) { String boundary = mediaType.getParameters().get("boundary"); if (boundary == null) boundary = multipartOutput.getBoundary(); httpHeaders.putSingle(HttpHeaderNames.CONTENT_TYPE, mediaType.toString() + "; boundary=" + multipartOutput.getBoundary()); byte[] boundaryBytes = ("--" + boundary).getBytes(); return asyncWriteParts(multipartOutput, entityStream, boundaryBytes) .thenCompose(v -> entityStream.asyncWrite(boundaryBytes)) .thenCompose(v -> entityStream.asyncWrite("--".getBytes())); }

Target:
protected CompletionStage<Void> asyncWrite(MultipartOutput multipartOutput, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, AsyncOutputStream entityStream) { String boundary = mediaType.getParameters().get("boundary"); if (boundary == null) boundary = multipartOutput.getBoundary(); httpHeaders.putSingle(HttpHeaderNames.CONTENT_TYPE, mediaType.toString() + "; boundary=" + multipartOutput.getBoundary()); byte[] boundaryBytes = ("--" + boundary).getBytes(StandardCharsets.US_ASCII); return asyncWriteParts(multipartOutput, entityStream, boundaryBytes) .thenCompose(v -> entityStream.asyncWrite(boundaryBytes)) .thenCompose(v -> entityStream.asyncWrite(DOUBLE_DASH_BYTES)); }
Source:
public void setExpirationTimer(String number, int messageExpirationTimer) throws InvalidNumberException { ContactInfo c = account.getContactStore().getContact(canonicalizeAndResolveSignalServiceAddress(number)); c.messageExpirationTime = messageExpirationTimer; System.err.println("Set message expiration " + c.number + " -> " + c.messageExpirationTime + " seconds"); account.getContactStore().updateContact(c); account.save(); }

Target:
public void setExpirationTimer(String number, int messageExpirationTimer) throws IOException, InvalidNumberException { SignalServiceAddress address = canonicalizeAndResolveSignalServiceAddress(number); setExpirationTimer(address, messageExpirationTimer); }
Source:
public SimpleMapPersistable(IMemento memento) throws ClassNotFoundException { IMemento type = memento.getChild(KEY_TYPE); fType = (Class<V>)Class.forName(type.getTextData()); IMemento[] list = memento.getChildren(KEY_NAME); Map<String, V> values = new TreeMap<String, V>(); for (IMemento elem : list) { values.put(elem.getID(), getValue(elem)); } synchronized(fValues) { fValues.clear(); fValues.putAll(values); } }

Target:
public SimpleMapPersistable(IMemento memento) throws CoreException { IMemento type = memento.getChild(KEY_TYPE); if (type == null) { throw new CoreException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Missing key for type.", null)); } try { fType = (Class<V>)Class.forName(type.getTextData()); } catch (ClassNotFoundException e) { throw new CoreException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, e.getMessage(), e)); } IMemento[] list = memento.getChildren(KEY_NAME); Map<String, V> values = new TreeMap<String, V>(); for (IMemento elem : list) { values.put(elem.getID(), getValue(elem)); } synchronized(fValues) { fValues.clear(); fValues.putAll(values); } }
Source:
public RulesProcessor build() { ObjectMapper mapper = new ObjectMapper(); RulesProcessor rulesProcessor = null; try { rulesProcessor = mapper.readValue(json, RulesProcessor.class); } catch (IOException e) { log.error("Error creating RulesProcessor object when deserializing JSON string. Check JSON string.", e); } return rulesProcessor; }

Target:
public RulesProcessor build() { ObjectMapper mapper = new ObjectMapper(); RulesProcessor rulesProcessor = null; try { rulesProcessor = mapper.readValue(rulesProcessorJson, RulesProcessor.class); } catch (IOException e) { LOG.error("Error during deserialization of JSON string: {}", rulesProcessorJson, e); } return rulesProcessor; }
Source:
public void createWithPrimaryKeyField_invalidFieldNameThrows() { String[] fieldNames = new String[] { null, "", "foo.bar", TestHelper.getRandomString(65) }; for (String fieldName : fieldNames) { try { realmSchema.createWithPrimaryKeyField("Foo", fieldName, int.class); fail(); } catch (IllegalArgumentException ignored) { } } }

Target:
public void createWithPrimaryKeyField_invalidFieldNameThrows() { String[] invalidFieldNames = new String[] { null, "", "foo.bar", TestHelper.getRandomString(65) }; for (String fieldName : invalidFieldNames) { try { realmSchema.createWithPrimaryKeyField("Foo", fieldName, int.class); fail(); } catch (IllegalArgumentException ignored) { } } }
Source:
protected Map<String, Object> getEntityFromResultSet(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); Map<String, Object> resultsMap = new HashMap<>(); for (int i = 1; i <= columnCount; ++i) { String columnName = metaData.getColumnName(i).toLowerCase(); Object object = resultSet.getObject(i); resultsMap.put(columnName, object); } return resultsMap; }

Target:
protected static Map<String, Object> getEntityFromResultSet(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); Map<String, Object> resultsMap = new HashMap<>(); for (int i = 1; i <= columnCount; ++i) { String columnName = metaData.getColumnName(i).toLowerCase(); Object object = resultSet.getObject(i); resultsMap.put(columnName, object); } return resultsMap; }
Source:
public void reconfigure(Map<String, ?> configs) { synchronized (LOCK) { this.mbeanPredicate = JmxReporter.compilePredicate(configPrefix, configs); mbeans.forEach((name, mbean) -> { if (mbeanPredicate.test(name)) { reregister(mbean); } else { unregister(mbean); } }); } }

Target:
public void reconfigure(Map<String, ?> configs) { synchronized (LOCK) { this.mbeanPredicate = JmxReporter.compilePredicate(configs); mbeans.forEach((name, mbean) -> { if (mbeanPredicate.test(name)) { reregister(mbean); } else { unregister(mbean); } }); } }
Source:
public UpdateQuery build() { Checks.checkNotNull(uri, "Please specify uri"); return new UpdateQuery( uri, where, whereArgs ); }

Target:
public UpdateQuery build() { checkNotNull(uri, "Please specify uri"); return new UpdateQuery( uri, where, whereArgs ); }
Source:
protected DocumentModel createFileDocument(CoreSession session, boolean withBlobContent, ACE... aces) { return createFileDocument(session, withBlobContent, "MyFile", aces); }

Target:
protected DocumentModel createFileDocument(CoreSession session, boolean withBlobContent, ACE... aces) { DocumentModel documentModel = session.createDocumentModel("/", "MyFile", "File"); if (withBlobContent) { documentModel.setPropertyValue(ColdStorageHelper.FILE_CONTENT_PROPERTY, (Serializable) Blobs.createBlob(FILE_CONTENT)); } DocumentModel document = session.createDocument(documentModel); if (aces.length > 0) { ACP acp = documentModel.getACP(); ACL acl = acp.getOrCreateACL(); acl.addAll(List.of(aces)); document.setACP(acp, true); } return document; }
Source:
protected boolean populateCache(final IProgressMonitor monitor) { if (fProjects == null) initialize(monitor); if (!fProjects.isEmpty()) { final IProject project = fProjects.remove(0); IFile manifest = project.getFile("META-INF/MANIFEST.MF"); if (manifest.exists()) { try { final String pluginName = getPluginName(manifest.getContents()); if (pluginName == null) { return !fProjects.isEmpty(); } project.accept((IResourceProxyVisitor) proxy -> { switch (proxy.getType()) { case IResource.PROJECT : case IResource.FOLDER : return true; case IResource.FILE : if (isImageName(proxy.getName())) { try { IFile resource = (IFile) proxy.requestResource(); addImageElement(new ImageElement(createImageData(resource), pluginName, resource.getProjectRelativePath().toPortableString())); } catch (Exception e) { } if (monitor.isCanceled()) throw new OperationCanceledException(); } break; } return false; }, IResource.DEPTH_INFINITE, IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN); } catch (CoreException | IOException e) { PDEPlugin.log(e); } } return true; } return false; }

Target:
protected boolean populateCache(final IProgressMonitor monitor) { if (fProjects == null) initialize(monitor); if (!fProjects.isEmpty()) { final IProject project = fProjects.remove(0); IFile manifest = project.getFile("META-INF/MANIFEST.MF"); if (manifest.exists()) { try { Optional<String> name = getPluginName(manifest.getContents()); if (!name.isPresent()) { return !fProjects.isEmpty(); } final String pluginName = name.get(); project.accept((IResourceProxyVisitor) proxy -> { switch (proxy.getType()) { case IResource.PROJECT : case IResource.FOLDER : return true; case IResource.FILE : if (isImageName(proxy.getName())) { try { IFile resource = (IFile) proxy.requestResource(); addImageElement(new ImageElement(createImageData(resource), pluginName, resource.getProjectRelativePath().toPortableString())); } catch (Exception e) { } if (monitor.isCanceled()) throw new OperationCanceledException(); } break; } return false; }, IResource.DEPTH_INFINITE, IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN); } catch (CoreException | IOException e) { PDEPlugin.log(e); } } return true; } return false; }
Source:
public void postProcessWorkflowDefinitions() { if (persistWorkflowDefinitions) { workflowDefinitions.values().forEach(workflowDefinitionDao::storeWorkflowDefinition); } }

Target:
public void postProcessWorkflowDefinitions() { if (!autoInit && persistWorkflowDefinitions) { workflowDefinitions.values().forEach(workflowDefinitionDao::storeWorkflowDefinition); } }
Source:
private void unzipToTempDirectory(final GraphContext context, final Path tempFolder, final File inputZipFile, final ArchiveModel archiveModel) { final FileModelService fileService = new FileModelService(context); String appArchiveName = archiveModel.getArchiveName(); final Path appArchiveFolder = getAppArchiveFolder(tempFolder, appArchiveName); try { Files.createDirectories(appArchiveFolder); } catch (IOException e) { throw new WindupException("Could not create a temporary directory for application \"" + appArchiveName + "\" at \"" + appArchiveFolder.toString() + "\" due to: " + e.getMessage(), e); } LOG.info("Unzipping " + inputZipFile.getPath() + " to " + appArchiveFolder.toString()); try { ZipUtil.unzipToFolder(inputZipFile, appArchiveFolder.toFile()); } catch (Throwable e) { ClassificationService classificationService = new ClassificationService(context); classificationService.attachClassification(archiveModel, ArchiveModel.MALFORMED_ARCHIVEMODEL, "Cannot unzip the file"); return; } FileModel newFileModel = fileService.createByFilePath(appArchiveFolder.toString()); archiveModel.setUnzippedDirectory(newFileModel); newFileModel.setParentArchive(archiveModel); recurseAndAddFiles(context, tempFolder, fileService, archiveModel, newFileModel); }

Target:
private void unzipToTempDirectory(final GraphContext context, final Path tempFolder, final File inputZipFile, final ArchiveModel archiveModel) { final FileModelService fileService = new FileModelService(context); String appArchiveName = archiveModel.getArchiveName(); final Path appArchiveFolder = getAppArchiveFolder(tempFolder, appArchiveName); try { Files.createDirectories(appArchiveFolder); } catch (IOException e) { throw new WindupException("Could not create a temporary directory for application \"" + appArchiveName + "\" at \"" + appArchiveFolder.toString() + "\" due to: " + e.getMessage(), e); } LOG.info("Unzipping " + inputZipFile.getPath() + " to " + appArchiveFolder.toString()); try { ZipUtil.unzipToFolder(inputZipFile, appArchiveFolder.toFile()); } catch (Throwable e) { ClassificationService classificationService = new ClassificationService(context); classificationService.attachClassification(archiveModel, ArchiveModel.MALFORMED_ARCHIVE, "Cannot unzip the file"); LOG.warning("Cannot unzip the file " + inputZipFile.getPath() + " to " + appArchiveFolder.toString() + ". The ArchiveModel was classified as malformed."); return; } FileModel newFileModel = fileService.createByFilePath(appArchiveFolder.toString()); archiveModel.setUnzippedDirectory(newFileModel); newFileModel.setParentArchive(archiveModel); recurseAndAddFiles(context, tempFolder, fileService, archiveModel, newFileModel); }
Source:
public void testStateAdvancedChange_startFails() throws InterruptedException { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void start( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); }

Target:
public void testStateAdvancedChange_startFails() { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void start( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); }
Source:
public CoapServer(final NetworkConfig config, final int... ports) { if (config != null) { this.config = config; } else { this.config = NetworkConfig.getStandard(); } this.root = new RootResource(); this.deliverer = new ServerMessageDeliverer(root); CoapResource wellKnown = new CoapResource(".well-known"); wellKnown.setVisible(false); wellKnown.add(new DiscoveryResource(root)); root.add(wellKnown); this.endpoints = new ArrayList<>(); if(null != config) { this.executor = Executors.newScheduledThreadPool( config.getInt(NetworkConfig.Keys.PROTOCOL_STAGE_THREAD_COUNT), new Utils.NamedThreadFactory("CoapServer#")); } if(null != this.config) { for (int port : ports) { addEndpoint(new CoapEndpoint(port, this.config)); } } }

Target:
public CoapServer(final NetworkConfig config, final int... ports) { if (config != null) { this.config = config; } else { this.config = NetworkConfig.getStandard(); } this.root = createRoot(); this.deliverer = new ServerMessageDeliverer(root); CoapResource wellKnown = new CoapResource(".well-known"); wellKnown.setVisible(false); wellKnown.add(new DiscoveryResource(root)); root.add(wellKnown); this.endpoints = new ArrayList<>(); this.executor = Executors.newScheduledThreadPool( this.config.getInt(NetworkConfig.Keys.PROTOCOL_STAGE_THREAD_COUNT), new Utils.NamedThreadFactory("CoapServer#")); for (int port : ports) { addEndpoint(new CoapEndpoint(port, this.config)); } }
Source:
public IsMergeablePredicate(Provider<ReviewDb> dbProvider) { super(ChangeField.MERGEABLE, "1"); this.dbProvider = dbProvider; }

Target:
IsMergeablePredicate(Provider<ReviewDb> dbProvider) { super(ChangeField.MERGEABLE, "1"); this.dbProvider = dbProvider; }
Source:
public IDescriptionPreprocessor caseCategory(Category object) { Collection<EStructuralFeature> featuresToIgnore = Lists.newArrayList(); Collection<EStructuralFeature> featuresToCopy = Lists.newArrayList(); return new DefaultDescriptionPreprocessorWithFiltering<Category>(Category.class, featuresToIgnore, featuresToCopy); }

Target:
public Optional<IDescriptionPreprocessor> caseCategory(Category object) { return Optional.of(new DefaultDescriptionPreprocessorWithFiltering<Category>(Category.class, new ArrayList<>(), new ArrayList<>())); }
Source:
public Object getResult(VarianceData data) { return new Double(data.squaredSum / data.count); }

Target:
public Double getResult(VarianceData data) { return data.squaredSum / data.count; }
Source:
public static Tuple generateTestTuple(final String source, final String index, final String type, final String id) { TopologyBuilder builder = new TopologyBuilder(); GeneralTopologyContext topologyContext = new GeneralTopologyContext( builder.createTopology(), new Config(), new CustomIndexArray<String>(0,1), new HashMap<>(), new HashMap<>(), "") { @Override public Fields getComponentOutputFields(final String componentId, final String streamId) { return new Fields("source", "index", "type", "id"); } }; return new TupleImpl(topologyContext, new Values(source, index, type, id), source, 1, ""); }

Target:
public static Tuple generateTestTuple(final String source, final String index, final String type, final String id) { TopologyBuilder builder = new TopologyBuilder(); GeneralTopologyContext topologyContext = new GeneralTopologyContext( builder.createTopology(), new Config(), new CustomIndexArray<String>(0,0), new HashMap<>(), new HashMap<>(), "") { @Override public Fields getComponentOutputFields(final String componentId, final String streamId) { return new Fields("source", "index", "type", "id"); } }; return new TupleImpl(topologyContext, new Values(source, index, type, id), source, 1, ""); }
Source:
public Uri getQueryUri(Query query) { return null; }

Target:
public Uri getQueryUri(Query query) { return Data.CONTENT_URI; }
Source:
static <T> Iterator<Optional<T>> yieldingIteratorFrom(WorkProcessor<T> processor) { return new AbstractIterator<Optional<T>>() { @Override protected Optional<T> computeNext() { while (true) { if (processor.process()) { if (processor.isFinished()) { return endOfData(); } return Optional.of(processor.getResult()); } else if (processor.isBlocked()) { try { processor.getBlockedFuture().get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } else { return Optional.empty(); } } } }; }

Target:
static <T> Iterator<Optional<T>> yieldingIteratorFrom(WorkProcessor<T> processor) { return new YieldingIterator<>(processor); }
Source:
private Set<Object> getNonExistingDecorators() { Set<Object> decorators = dataService.findAll(DYNAMIC_DECORATOR).map(Entity::getIdValue).collect(toSet()); decorators.removeAll(registry.getFactoryIds().collect(toSet())); return decorators; }

Target:
private Set<String> getNonExistingDecorators() { Set<String> decorators = dataService.findAll(DYNAMIC_DECORATOR, DynamicDecorator.class) .map(DynamicDecorator::getId) .collect(toSet()); decorators.removeAll(registry.getFactoryIds().collect(toSet())); return decorators; }
Source:
public static Algorithm RSA256(RSAKey key) throws IllegalArgumentException { RSAPublicKey publicKey = key instanceof PublicKey ? (RSAPublicKey) key : null; RSAPrivateKey privateKey = key instanceof PrivateKey ? (RSAPrivateKey) key : null; return RSA256(publicKey, privateKey); }

Target:
public static Algorithm RSA256(RSAKey key) throws IllegalArgumentException { RSAPublicKey publicKey = key instanceof RSAPublicKey ? (RSAPublicKey) key : null; RSAPrivateKey privateKey = key instanceof RSAPrivateKey ? (RSAPrivateKey) key : null; return RSA256(publicKey, privateKey); }
Source:
protected AsyncService getAsyncService(String executionId) { try { String serviceClass = (String) getTransientStore().getParameter(executionId, TRANSIENT_STORE_SERVICE); return (AsyncService) Framework.getService(Class.forName(serviceClass)); } catch (ClassNotFoundException e) { return null; } }

Target:
protected AsyncService getAsyncService(String executionId) { String serviceClass = (String) getTransientStore().getParameter(executionId, TRANSIENT_STORE_SERVICE); try { return (AsyncService) Framework.getService(Class.forName(serviceClass)); } catch (ClassNotFoundException e) { log.error("AsyncService class not found", serviceClass); return null; } }
Source:
private long getTransferSize() { DiskImage image = getDiskImage(); Guid domainId = image.getStorageIds().get(0); if (getParameters().getTransferType() == TransferType.Download) { if (image.getVolumeFormat() == VolumeFormat.COW) { DiskImage imageInfoFromVdsm = imagesHandler.getVolumeInfoFromVdsm( image.getStoragePoolId(), domainId, image.getId(), image.getImageId()); return imageInfoFromVdsm.getApparentSizeInBytes(); } else { return image.getSize(); } } if (getParameters().getTransferSize() != 0) { return getParameters().getTransferSize(); } boolean isBlockDomain = image.getStorageTypes().get(0).isBlockDomain(); return isBlockDomain ? image.getActualSizeInBytes() : image.getSize(); }

Target:
private long getTransferSize() { DiskImage image = getDiskImage(); Guid domainId = image.getStorageIds().get(0); if (getParameters().getTransferType() == TransferType.Download) { if (image.getVolumeFormat() == VolumeFormat.COW) { DiskImage imageInfoFromVdsm = imagesHandler.getVolumeInfoFromVdsm( image.getStoragePoolId(), domainId, image.getId(), image.getImageId()); return imageInfoFromVdsm.getApparentSizeInBytes(); } else { return image.getSize(); } } if (getParameters().getTransferSize() != 0) { return getParameters().getTransferSize(); } boolean isBlockDomain = getDiskImage().getStorageTypes().get(0).isBlockDomain(); return isBlockDomain ? getDiskImage().getActualSizeInBytes() : image.getSize(); }
Source:
protected String replace(String in) { reporter.trace("Replace: %s", in); if (in == null) { reporter.error("null??"); in = "<<???>>"; } Matcher matcher = MACRO.matcher(in); int last = 0; StringBuilder sb = new StringBuilder(); while (matcher.find()) { int n = matcher.start(); sb.append(in, last, n); String replacement = get(matcher.group(2)); if (replacement == null) sb.append(matcher.group(1)); else sb.append(replacement); last = matcher.end(); } if (last == 0) return in; sb.append(in, last, in.length()); return sb.toString(); }

Target:
protected String replace(String in) { reporter.trace("Replace: %s", in); if (in == null) { reporter.error("No input to replace. Setting it to <<???>>"); in = "<<???>>"; } Matcher matcher = MACRO.matcher(in); int last = 0; StringBuilder sb = new StringBuilder(); while (matcher.find()) { int n = matcher.start(); sb.append(in, last, n); String replacement = get(matcher.group(2)); if (replacement == null) sb.append(matcher.group(1)); else sb.append(replacement); last = matcher.end(); } if (last == 0) return in; sb.append(in, last, in.length()); return sb.toString(); }
Source:
public List<String> getListTypes() { if (null == exTypes) { exTypes = new ArrayList<>(); exTypes.add("FHIR"); exTypes.add("UDDI"); } return exTypes; }

Target:
public EXCHANGE_TYPE[] getListTypes() { return EXCHANGE_TYPE.values(); }
Source:
private void setUpHomeMenuIcon() { editOptionIndicatorDot.setVisibility(Prefs.showActionFeedIndicator() ? VISIBLE : GONE); }

Target:
void setUpHomeMenuIcon() { drawerIconDot.setVisibility(AccountUtil.isLoggedIn() && Prefs.showActionFeedIndicator() && ReleaseUtil.isPreBetaRelease() ? VISIBLE : GONE); }
Source:
public List<JobConfig> prepareJobs() { String appId = new ApplicationConfig(appDesc.getConfig()).getGlobalAppId(); return ApplicationDescriptors.forType( taskAppDesc -> { try { return Collections.singletonList(JobPlanner.this.prepareTaskJob(taskAppDesc)); } catch (Exception e) { throw new SamzaException("Failed to generate JobConfig for TaskApplication " + appId, e); } }, streamAppDesc -> { try { return JobPlanner.this.prepareStreamJobs(streamAppDesc); } catch (Exception e) { throw new SamzaException("Failed to generate JobConfig for StreamApplication " + appId, e); } }, appDesc); }

Target:
public List<JobConfig> prepareJobs() { String appId = new ApplicationConfig(appDesc.getConfig()).getGlobalAppId(); if (appDesc instanceof TaskApplicationDescriptorImpl) { return Collections.singletonList(prepareTaskJob((TaskApplicationDescriptorImpl) appDesc)); } else if (appDesc instanceof StreamApplicationDescriptorImpl) { try { return prepareStreamJobs((StreamApplicationDescriptorImpl) appDesc); } catch (Exception e) { throw new SamzaException("Failed to generate JobConfig for StreamApplication " + appId, e); } } throw new IllegalArgumentException(String.format("ApplicationDescriptorImpl has to be either TaskApplicationDescriptorImpl or " + "StreamApplicationDescriptorImpl. class %s is not supported", appDesc.getClass().getName())); }
Source:
private static boolean rewriteURIQueryParameters(Node node, List<String> queryParameters) { boolean processed = false; if (!queryParameters.isEmpty() && node.hasProperty(Constants.PROP_HTTP_QUERY)) { StringTokenizer st = new StringTokenizer(node.getProperties(Constants.PROP_HTTP_QUERY).iterator().next().getValue(), "&"); while (st.hasMoreTokens()) { String token = st.nextToken(); String[] namevalue = token.split("="); if (namevalue.length == 2) { if (queryParameters.contains(namevalue[0])) { try { node.getProperties().add(new Property(namevalue[0], URLDecoder.decode(namevalue[1], "UTF-8"))); processed = true; } catch (UnsupportedEncodingException e) { if (log.isLoggable(Level.FINEST)) { log.finest("Failed to decode value '" + namevalue[1] + "': " + e); } } } else if (log.isLoggable(Level.FINEST)) { log.finest("Ignoring query parameter '" + namevalue[0] + "'"); } } else if (log.isLoggable(Level.FINEST)) { log.finest("Query string part does not include name/value pair: " + token); } } } return processed; }

Target:
private static boolean rewriteURIQueryParameters(Node node, List<String> queryParameters) { boolean processed = false; if (!queryParameters.isEmpty() && node.hasProperty(Constants.PROP_HTTP_QUERY)) { StringTokenizer st = new StringTokenizer(node.getProperties(Constants.PROP_HTTP_QUERY).iterator().next().getValue(), "&"); while (st.hasMoreTokens()) { String token = st.nextToken(); String[] namevalue = token.split("="); if (namevalue.length == 2) { if (queryParameters.contains(namevalue[0])) { try { node.getProperties().add(new Property(URLDecoder.decode(namevalue[0], "UTF-8"), URLDecoder.decode(namevalue[1], "UTF-8"))); processed = true; } catch (UnsupportedEncodingException e) { if (log.isLoggable(Level.FINEST)) { log.finest("Failed to decode value '" + namevalue[1] + "': " + e); } } } else if (log.isLoggable(Level.FINEST)) { log.finest("Ignoring query parameter '" + namevalue[0] + "'"); } } else if (log.isLoggable(Level.FINEST)) { log.finest("Query string part does not include name/value pair: " + token); } } } return processed; }
Source:
private boolean isAuthenticated() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null || authentication instanceof AnonymousAuthenticationToken) { return false; } return authentication.isAuthenticated(); }

Target:
private boolean isAuthenticated() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null || AnonymousAuthenticationToken.class.isAssignableFrom(authentication.getClass())) { return false; } return authentication.isAuthenticated(); }
Source:
private void testResponseForServerErrorUtil(ServerErrorCode serverErrorCode, RouterErrorCode expectedRouterErrorCode) throws Exception { ServerErrorCode[] serverErrorCodes = new ServerErrorCode[9]; Arrays.fill(serverErrorCodes, serverErrorCode); presetServerErrorCode(serverErrorCodes); future = router.deleteBlob(blobIdString, new ClientCallback()); try { future.get(); fail("Deletion should be unsuccessful. Error is expected."); } catch (Exception e) { assertEquals("RouterErrorCode should be BlobDoesNotExist", expectedRouterErrorCode, ((RouterException) e.getCause()).getErrorCode()); } }

Target:
private void testResponseForServerErrorUtil(ServerErrorCode serverErrorCode, RouterErrorCode expectedRouterErrorCode) throws Exception { ServerErrorCode[] serverErrorCodes = new ServerErrorCode[9]; Arrays.fill(serverErrorCodes, serverErrorCode); presetServerErrorCode(serverErrorCodes); future = router.deleteBlob(blobIdString, new ClientCallback()); try { future.get(); fail("Deletion should be unsuccessful. Error is expected."); } catch (Exception e) { assertEquals("RouterErrorCodes mistmatch.", expectedRouterErrorCode, ((RouterException) e.getCause()).getErrorCode()); } }
Source:
protected Collection<P> orphanedItems(Collection<P> orphaned, TaskListener listener) throws IOException, InterruptedException { BranchProjectFactory<P, R> _factory = getProjectFactory(); for (P project : orphaned) { if (!_factory.isProject(project)) { listener.getLogger().println("Detected unsupported subitem " + project + ", skipping"); continue; } Branch b = _factory.getBranch(project); if (!(b instanceof Branch.Dead)) { _factory.decorate( _factory.setBranch(project, new Branch.Dead(b.getHead(), b.getProperties(), b.getActions()))); } } return super.orphanedItems(orphaned, listener); }

Target:
protected Collection<P> orphanedItems(Collection<P> orphaned, TaskListener listener) throws IOException, InterruptedException { BranchProjectFactory<P, R> _factory = getProjectFactory(); for (P project : orphaned) { if (!_factory.isProject(project)) { listener.getLogger().println("Detected unsupported subitem " + project + ", skipping"); continue; } Branch b = _factory.getBranch(project); if (!(b instanceof Branch.Dead)) { _factory.decorate( _factory.setBranch(project, new Branch.Dead(b))); } } return super.orphanedItems(orphaned, listener); }
Source:
void doNotAllowCreationOfQueueWithRandomCapacity() { assertThrows( AssertionError.class, () -> new PrimitiveLongArrayQueue( 7 ) ); }

Target:
void doNotAllowCreationOfQueueWithRandomCapacity() { assertThrows( IllegalArgumentException.class, () -> new PrimitiveLongArrayQueue( 7 ) ); }
Source:
public void invoke(Object receiver, String methodName, String argument) { Util.throwIfNull(receiver, methodName, argument); for (TypedMethodInvoker<?> invoker : invokers) { if (invoker.invoke(receiver, methodName, argument)) { return; } } }

Target:
public void invoke(Object receiver, String methodName, String argument) { Util.throwIfNull(receiver, methodName, argument); int size = invokers.size(); for (int i = 0; i < size; ++i) { final TypedMethodInvoker<?> invoker = invokers.get(i); if (invoker.invoke(receiver, methodName, argument)) { return; } } LogUtil.w("Method with name " + methodName + " not found for any of the MethodInvoker supported argument types."); }
Source:
public void onFailure(Throwable t) { runningProcessors.remove(processor); throwable.compareAndSet(null, t); latch.countDown(); }

Target:
public void onFailure(Throwable t) { processors.remove(processor); processor = null; if (failure.compareAndSet(null, t)) { processors.forEach(StreamProcessor::stop); } if (processors.isEmpty()) { shutdownAndNotify(); } }
Source:
public static Row createRow(final Map<String, Object> sourceMap, final String documentId, final DataSetHeader header) { if (sourceMap == null) { return null; } final Object[] values = new Object[header.size()]; for (int i = 0; i < values.length; i++) { final SelectItem selectItem = header.getSelectItem(i); final Column column = selectItem.getColumn(); assert column != null; assert selectItem.getAggregateFunction() == null; assert selectItem.getScalarFunction() == null; if (column.isPrimaryKey()) { values[i] = documentId; } else { Object value = sourceMap.get(column.getName()); if (column.getType() == ColumnType.DATE) { Date valueToDate = ElasticSearchDateConverter.tryToConvert((String) value); if (valueToDate == null) { values[i] = value; } else { values[i] = valueToDate; } } else { values[i] = value; } } } return new DefaultRow(header, values); }

Target:
public static Row createRow(final Map<String, Object> sourceMap, final String documentId, final DataSetHeader header) { final Object[] values = new Object[header.size()]; for (int i = 0; i < values.length; i++) { final SelectItem selectItem = header.getSelectItem(i); final Column column = selectItem.getColumn(); assert column != null; assert selectItem.getAggregateFunction() == null; assert selectItem.getScalarFunction() == null; if (column.isPrimaryKey()) { values[i] = documentId; } else { if (sourceMap != null) { final Object value = sourceMap.get(column.getName()); if (column.getType() == ColumnType.DATE) { final Date valueToDate = ElasticSearchDateConverter.tryToConvert((String) value); if (valueToDate == null) { values[i] = value; } else { values[i] = valueToDate; } } else { values[i] = value; } } } } return new DefaultRow(header, values); }
Source:
private void createUpdateDeleteTest(String systemScope) { final ManagedCredentials c = new ManagedCredentials(jenkins); c.open(); UserPwdCredential upc = c.add(UserPwdCredential.class); upc.username.set(CRED_USER); upc.password.set(CRED_PWD); upc.description.set("Credential description"); upc.scope.select(systemScope); upc.setId(CRED_ID); c.save(); verifyInputValue(CRED_ID, USERNAME_INPUT, CRED_USER); c.open(); upc = c.get(UserPwdCredential.class, CRED_ID); final String usernameModified = CRED_USER + "-Modified"; upc.username.set(usernameModified); c.save(); verifyInputValue(CRED_ID, USERNAME_INPUT, usernameModified); c.open(); upc = c.get(UserPwdCredential.class, CRED_ID); upc.delete.click(); c.save(); verifyCredentialNotPresent(CRED_ID); }

Target:
private void createUpdateDeleteTest(String systemScope) { final ManagedCredentials c = new ManagedCredentials(jenkins); c.open(); final UserPwdCredential upc = createUserPwdCredential(c.add(UserPwdCredential.class), CRED_USER, CRED_PWD, "Descr", systemScope); c.save(); verifyValueForElement(upc.username, CRED_USER); c.open(); final String usernameModified = CRED_USER + "-Modified"; upc.username.set(usernameModified); c.save(); verifyValueForElement(upc.username, usernameModified); c.open(); upc.delete(); c.save(); verifyElementNotPresent(upc.username); }
Source:
private void updateNextRunConfiguration() { final VmStatic nextRunConfigurationStatic = runInternalQuery( VdcQueryType.GetVmNextRunConfiguration, new IdQueryParameters(getVmId())) .<VM>getReturnValue() .getStaticData(); final int newMemorySize = nextRunConfigurationStatic.getMemSizeMb() - getParameters().getMemorySizeMb(); if (newMemorySize <= 0) { return; } nextRunConfigurationStatic.setMemSizeMb(newMemorySize); if (newMemorySize < nextRunConfigurationStatic.getMinAllocatedMem()) { nextRunConfigurationStatic.setMinAllocatedMem(newMemorySize); } vmHandler.createNextRunSnapshot( getVm(), nextRunConfigurationStatic, null, getCompensationContext()); }

Target:
private void updateNextRunConfiguration() { final VmStatic nextRunConfigurationStatic = runInternalQuery( VdcQueryType.GetVmNextRunConfiguration, new IdQueryParameters(getVmId())) .<VM>getReturnValue() .getStaticData(); final int newMemorySize = nextRunConfigurationStatic.getMemSizeMb() - getParameters().getMemorySizeMb(); if (newMemorySize <= 0) { return; } if (getVm().getMemSizeMb() != nextRunConfigurationStatic.getMemSizeMb()) { return; } nextRunConfigurationStatic.setMemSizeMb(newMemorySize); if (newMemorySize < nextRunConfigurationStatic.getMinAllocatedMem()) { nextRunConfigurationStatic.setMinAllocatedMem(newMemorySize); } vmHandler.createNextRunSnapshot( getVm(), nextRunConfigurationStatic, null, getCompensationContext()); }
Source:
protected void executeCommand() { log.info("Power-Management: of host '{}' initiated.", getAction(), getVdsName()); audit(AuditLogType.FENCE_OPERATION_STARTED); VDSStatus lastStatus = getVds().getStatus(); FenceOperationResult result = null; try { setup(); result = createHostFenceActionExecutor( getVds(), getParameters().getFencingPolicy() ).fence(getAction()); handleResult(result); if (getSucceeded()) { log.info("Power-Management: host '{}' succeeded.", getAction(), getVdsName()); audit(AuditLogType.FENCE_OPERATION_SUCCEEDED); } else { log.info("Power-Management: host '{}' failed.", getAction(), getVdsName()); audit(AuditLogType.FENCE_OPERATION_FAILED); } } finally { if (!getSucceeded()) { setStatus(lastStatus); if (result != null && result.getStatus() != Status.SKIPPED_DUE_TO_POLICY) { alertIfPowerManagementOperationFailed(); } throw new EngineException(EngineError.VDS_FENCE_OPERATION_FAILED); } else { teardown(); runSleepOnReboot(); } } }

Target:
protected void executeCommand() { log.info("Power-Management: of host '{}' initiated.", getAction(), getVdsName()); audit(AuditLogType.FENCE_OPERATION_STARTED); VDSStatus lastStatus = getVds().getStatus(); FenceOperationResult result = null; try { setup(); result = createHostFenceActionExecutor( getVds(), getParameters().getFencingPolicy() ).fence(getAction()); handleResult(result); if (getSucceeded()) { log.info("Power-Management: host '{}' succeeded.", getAction(), getVdsName()); audit(AuditLogType.FENCE_OPERATION_SUCCEEDED); } else { log.info("Power-Management: host '{}' failed.", getAction(), getVdsName()); audit(AuditLogType.FENCE_OPERATION_FAILED); } } finally { if (!getSucceeded()) { setStatus(lastStatus); if (result != null && result.getStatus() != Status.SKIPPED_DUE_TO_POLICY) { alertIfPowerManagementOperationFailed(); } throw new EngineException(EngineError.VDS_FENCE_OPERATION_FAILED); } else { teardown(); } } }
Source:
public Map<String, Object> execute(Map<String, ?> context) { final ServiceReference<RuleRegistry> reference = (ServiceReference<RuleRegistry>) bundleContext .getServiceReference(RuleRegistry.class.getName()); if (reference != null) { RuleRegistry registry = bundleContext.getService(reference); if (registry != null) { for (int i = 0; i < UIDs.length; i++) { registry.setEnabled(UIDs[i], enable); } } else { for (int i = 0; i < UIDs.length; i++) { logger.warn("Action is not applyed to because RuleRegistry is not available", UIDs[i]); } } } else { logger.warn( "Action can not be applyed because a reference to the 'RuleRegistry' service is not available."); } return null; }

Target:
public Map<String, Object> execute(Map<String, ?> context) { for (String uid : UIDs) { if (ruleRegistry != null) { ruleRegistry.setEnabled(uid, enable); } else { logger.warn("Action is not applyed to because RuleRegistry is not available.", uid); } } return null; }
Source:
public void shouldCreateEncounter() throws HttpException, ParseException, InterruptedException { assertTrue(mrsListener.created); assertFalse(mrsListener.deleted); assertEquals(encounter.getUuid(), mrsListener.eventParameters.get(EventKeys.ENCOUNTER_ID)); assertEquals(encounter.getProvider().getUuid(), mrsListener.eventParameters.get(EventKeys.PROVIDER_ID)); assertEquals(encounter.getLocation().getUuid(), mrsListener.eventParameters.get(EventKeys.LOCATION_ID)); assertEquals(encounter.getEncounterDatetime(), mrsListener.eventParameters.get(EventKeys.ENCOUNTER_DATE)); assertEquals(encounter.getEncounterType().getUuid(), mrsListener.eventParameters.get(EventKeys.ENCOUNTER_TYPE)); Encounter fetchedEncounter = encounterAdapter.getEncounterByUuid(DEFAULT_CONFIG_NAME, encounter.getUuid()); Observation fetchedObservation = obsAdapter.getObservationByUuid(DEFAULT_CONFIG_NAME, fetchedEncounter.getObs().get(0).getUuid()); assertEquals(observation.getValue(), fetchedObservation.getValue()); assertEquals(observation.getConcept(), fetchedObservation.getConcept()); assertEquals(observation.getObsDatetime(), fetchedObservation.getObsDatetime()); }

Target:
public void shouldCreateEncounter() throws HttpException, ParseException, InterruptedException { assertTrue(mrsListener.created); assertFalse(mrsListener.deleted); assertEquals(encounter.getUuid(), mrsListener.eventParameters.get(EventKeys.ENCOUNTER_ID)); assertEquals(encounter.getProvider().getUuid(), mrsListener.eventParameters.get(EventKeys.PROVIDER_ID)); assertEquals(encounter.getLocation().getUuid(), mrsListener.eventParameters.get(EventKeys.LOCATION_ID)); assertEquals(encounter.getEncounterDatetime(), mrsListener.eventParameters.get(EventKeys.ENCOUNTER_DATE)); assertEquals(encounter.getEncounterType().getUuid(), mrsListener.eventParameters.get(EventKeys.ENCOUNTER_TYPE)); Observation fetchedObservation = obsAdapter.getObservationByUuid(DEFAULT_CONFIG_NAME, encounter.getObs().get(0).getUuid()); assertEquals(observation.getValue(), fetchedObservation.getValue()); assertEquals(observation.getConcept(), fetchedObservation.getConcept()); assertEquals(observation.getObsDatetime(), fetchedObservation.getObsDatetime()); }