auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testExperimentLinkBackwardCompatibility() { fBot.closeAllEditors(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); final IProject project = root.getProject(TRACE_PROJECT_NAME); assertTrue(project.exists()); TmfProjectElement projectElement = TmfProjectRegistry.getProject(project); TmfExperimentFolder experimentsFolder = projectElement.getExperimentsFolder(); assertNotNull("Experiment folder should exist", experimentsFolder); IFolder experimentsFolderResource = experimentsFolder.getResource(); String experiementName = "exp"; IFolder expFolder = experimentsFolderResource.getFolder(experiementName); assertFalse(expFolder.exists()); try { expFolder.create(true, true, null); IFile file = expFolder.getFile(TRACE_NAME); file.createLink(Path.fromOSString(fTestFile.getAbsolutePath()), IResource.REPLACE, new NullProgressMonitor()); } catch (CoreException e) { fail("Failed to create the experiment"); } fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); experimentsItem.expand(); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable("exp [1]", experimentsItem)); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "exp [1]"); expItem.contextMenu().menu("Open").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, experiementName)); expItem.expand(); expItem.getNode(TRACE_NAME); }

Target:
public void testExperimentLinkBackwardCompatibility() { fBot.closeAllEditors(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); final IProject project = root.getProject(TRACE_PROJECT_NAME); assertTrue(project.exists()); TmfProjectElement projectElement = TmfProjectRegistry.getProject(project); TmfExperimentFolder experimentsFolder = projectElement.getExperimentsFolder(); assertNotNull("Experiment folder should exist", experimentsFolder); IFolder experimentsFolderResource = experimentsFolder.getResource(); String experimentName = "exp"; IFolder expFolder = experimentsFolderResource.getFolder(experimentName); assertFalse(expFolder.exists()); try { expFolder.create(true, true, null); IFile file = expFolder.getFile(TRACE_NAME); file.createLink(Path.fromOSString(fTestFile.getAbsolutePath()), IResource.REPLACE, new NullProgressMonitor()); } catch (CoreException e) { fail("Failed to create the experiment"); } fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "exp"); expItem.expand(); expItem.getNode(TRACE_NAME); expItem.contextMenu().menu("Open").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, experimentName)); }
Source:
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text); ButterKnife.bind(this); measurement = (Measurement) getIntent().getSerializableExtra(TEST); webView.setWebChromeClient(new WebChromeClient()); setProgressBarVisibility(View.VISIBLE); webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); setProgressBarVisibility(View.VISIBLE); } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); setProgressBarVisibility(View.GONE); } @Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { super.onReceivedError(view, request, error); new MessageDialogFragment.Builder() .withTitle(getString(R.string.Modal_Error)) .withMessage(error.toString()) .build().show(getSupportFragmentManager(), null); setProgressBarVisibility(View.GONE); } }); showText(); }

Target:
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text); ButterKnife.bind(this); measurement = (Measurement) getIntent().getSerializableExtra(TEST); showText(); }
Source:
private String getLocalFilePath(ImageRequest imageRequest) { Uri uri = imageRequest.getSourceUri(); if (UriUtil.isLocalFileUri(uri)) { return imageRequest.getSourceFile().getPath(); } else if (UriUtil.isLocalContentUri(uri)) { Cursor cursor = mContentResolver.query(uri, new String[] {MediaStore.Video.Media.DATA}, null, null, null); try { if (cursor.moveToFirst()) { return cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)); } } finally { cursor.close(); } } return ""; }

Target:
@Nullable private String getLocalFilePath(ImageRequest imageRequest) { Uri uri = imageRequest.getSourceUri(); if (UriUtil.isLocalFileUri(uri)) { return imageRequest.getSourceFile().getPath(); } else if (UriUtil.isLocalContentUri(uri)) { Cursor cursor = mContentResolver.query(uri, new String[] {MediaStore.Video.Media.DATA}, null, null, null); try { if (cursor.moveToFirst()) { return cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)); } } finally { cursor.close(); } } return null; }
Source:
public ITmfTimestamp transform(ITmfTimestamp timestamp) { return new TmfNanoTimestamp(fOffset).normalize(timestamp.getValue(), timestamp.getScale()); }

Target:
public ITmfTimestamp transform(ITmfTimestamp timestamp) { return timestamp.normalize(fOffset, ITmfTimestamp.NANOSECOND_SCALE); }
Source:
public boolean isValid() throws CrafterException { try { if (state == State.CREATED) { logger.debug("Waiting for initialization of {}", this); initializationLatch.await(); } return state == State.INITIALIZED && storeService.validate(context); } catch (InterruptedException e) { throw new CrafterException("Error while waiting for initialization of " + this); } }

Target:
public boolean isValid() throws CrafterException { try { if (state == State.CREATED) { logger.debug("Waiting for initialization of {}", this); initializationLatch.await(initTimeout, TimeUnit.MILLISECONDS); } return state == State.INITIALIZED && storeService.validate(context); } catch (InterruptedException e) { throw new CrafterException("Error while waiting for initialization of " + this); } }
Source:
public void onLongPress(@NonNull MotionEvent e) { if (!mDetailsLookup.overItemWithSelectionKey(e)) { if (DEBUG) Log.d(TAG, "Ignoring LongPress on non-model-backed item."); return; } ItemDetails<K> item = mDetailsLookup.getItemDetails(e); if (item == null) { return; } boolean handled = false; if (isRangeExtension(e)) { extendSelectionRange(item); mHapticPerformer.run(); } else { if (mSelectionTracker.isSelected(item.getSelectionKey())) { mOnDragInitiatedListener.onDragInitiated(e); mHapticPerformer.run(); } else if (mSelectionPredicate.canSetStateForKey(item.getSelectionKey(), true) && selectItem(item)) { if (mSelectionPredicate.canSelectMultiple() && mSelectionTracker.isRangeActive()) { mGestureStarter.run(); } mHapticPerformer.run(); } } }

Target:
public void onLongPress(@NonNull MotionEvent e) { if (!mDetailsLookup.overItemWithSelectionKey(e)) { if (DEBUG) Log.d(TAG, "Ignoring LongPress on non-model-backed item."); return; } ItemDetails<K> item = mDetailsLookup.getItemDetails(e); if (item == null) { return; } boolean handled = false; if (shouldExtendRange(e)) { extendSelectionRange(item); mHapticPerformer.run(); } else { if (mSelectionTracker.isSelected(item.getSelectionKey())) { mOnDragInitiatedListener.onDragInitiated(e); mHapticPerformer.run(); } else if (mSelectionPredicate.canSetStateForKey(item.getSelectionKey(), true) && selectItem(item)) { if (mSelectionPredicate.canSelectMultiple() && mSelectionTracker.isRangeActive()) { mGestureStarter.run(); } mHapticPerformer.run(); } } }
Source:
public boolean onUploadItemClick(OCUpload file) { File f = new File(file.getLocalUri().getLastPathSegment()); if(!f.exists()) { Toast.makeText(this, "Cannot open. Local file does not exist.", Toast.LENGTH_SHORT).show(); } else { openFileWithDefault(f.getAbsolutePath()); } return true; }

Target:
public boolean onUploadItemClick(OCUpload file) { File f = new File(file.getLocalPath()); if(!f.exists()) { Toast.makeText(this, "Cannot open. Local file does not exist.", Toast.LENGTH_SHORT).show(); } else { openFileWithDefault(file.getLocalPath()); } return true; }
Source:
public void testCreateNewNotification() { Notification notification = testNotification(); Notification result = curationApiAdmin.createNotification(notification); assertNotNull(result); Assert.assertTrue(result.getId() > 0); boolean userCanCreate = true; try { curationApiUser.createNotification(notification); } catch (ApiException e) { userCanCreate = false; } assertFalse(userCanCreate); }

Target:
public void testCreateNewNotification() { Notification notification = testNotification(); Notification result = curationApiAdmin.createNotification(notification); assertNotNull(result); Assert.assertTrue(result.getId() > 0); boolean userCanCreate = true; try { curationApiUser.createNotification(notification); } catch (ApiException e) { userCanCreate = false; assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), e.getCode()); } assertFalse(userCanCreate); }
Source:
private boolean calcAreaAspectRatioScaleMeasure() { if (this.drawingWidth > 0 && this.drawingHeight > 0) { this.area = this.drawingWidth * this.drawingHeight; this.aspectRatio = this.drawingWidth / this.drawingHeight; this.scaleMeasure = DrawingUtil.computeScaleMeasure(this.drawingWidth, this.drawingHeight, this.dar); return true; } else { return false; } }

Target:
private void calcAreaAspectRatioScaleMeasure() { if (this.drawingWidth > 0 && this.drawingHeight > 0) { this.area = this.drawingWidth * this.drawingHeight; this.aspectRatio = this.drawingWidth / this.drawingHeight; this.scaleMeasure = DrawingUtil.computeScaleMeasure(this.drawingWidth, this.drawingHeight, this.dar); } }
Source:
public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, ApiRootResponse.class)); } catch (OpenStackResponseException e) { StringBuilder builder = new StringBuilder(); builder.append(e.getMessage()).append("(").append(e.getStatus()).append(")"); log.error(builder.toString(), e); throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); }catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }

Target:
public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, ApiRootResponse.class)); } catch (OpenStackResponseException e) { log.error("{} (OpenStack response error code: {})", e.getMessage(), e.getStatus()); log.debug("Exception", e); throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); }catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }
Source:
public String getPreview() { StringBuilder bld= new StringBuilder(); if (isEnabled(CleanUpConstants.USE_OBJECTS_EQUALS)) { bld.append("if (!Objects.equals(aText, other.aText)) {\n"); bld.append(" return false;\n"); bld.append("}\n"); } else { bld.append("if (aText == null) {\n"); bld.append(" if (other.aText != null)\n"); bld.append(" return false;\n"); bld.append("} else if (!aText.equals(other.aText))\n"); bld.append(" return false;\n"); } return bld.toString(); }

Target:
public String getPreview() { if (isEnabled(CleanUpConstants.USE_OBJECTS_EQUALS)) { return "" + "if (!Objects.equals(aText, other.aText)) {\n" + " return false;\n" + "}\n"; } else { return "" + "if (aText == null)\n" + " if (other.aText != null)\n" + " return false;\n" + "else if (!aText.equals(other.aText))\n" + " return false;\n"; } }
Source:
default int readInt() throws IOException { final byte[] buf = new byte[4]; final int read = read(buf, 0, 4); if (read < 4) throw new EOFException(); return Bytes.toInt(buf, isLittleEndian()); }

Target:
default int readInt() throws IOException { final byte[] buf = conversionBuffer(); final int read = read(buf, 0, 4); if (read < 4) throw new EOFException(); return Bytes.toInt(buf, isLittleEndian()); }
Source:
protected IResource getResource(IPath path) { if (path != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if (path.getDevice() == null) { IResource member = root.findMember(path); if (member != null) { return member; } } IFile file = root.getFileForLocation(path); if (file != null) { return file; } if (getType() != ARCHIVE) { IContainer container = root.getContainerForLocation(path); if (container != null) { return container; } } @SuppressWarnings("deprecation") IFile[] files = root.findFilesForLocation(path); if (files.length > 0) { return files[0]; } if (getType() != ARCHIVE) { @SuppressWarnings("deprecation") IContainer[] containers = root.findContainersForLocation(path); if (containers.length > 0) { return containers[0]; } } } return null; }

Target:
protected IResource getResource(IPath path) { if (path != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if (getType() == PROJECT) { return root.findMember(path); } IFile file = root.getFileForLocation(path); if (file != null) { return file; } if (getType() != ARCHIVE) { IContainer container = root.getContainerForLocation(path); if (container != null) { return container; } } @SuppressWarnings("deprecation") IFile[] files = root.findFilesForLocation(path); if (files.length > 0) { return files[0]; } if (getType() != ARCHIVE) { @SuppressWarnings("deprecation") IContainer[] containers = root.findContainersForLocation(path); if (containers.length > 0) { return containers[0]; } } return root.findMember(path); } return null; }
Source:
public ProjectImportWizard(IDialogSettings dialogSettings, PublishedGradleVersionsWrapper publishedGradleVersions) { super(); setDialogSettings(dialogSettings); this.controller = new ProjectImportWizardController(this); final ProjectImportConfiguration configuration = this.controller.getConfiguration(); WelcomePageConfigurator welcomePageConfiguratorImpl = WelcomePageConfiguratorFactory .createImportWizardWelcomePageConfigurator(PREF_SHOW_WELCOME_PAGE); this.welcomeWizardPage = new GradleWelcomeWizardPage(configuration, welcomePageConfiguratorImpl); this.gradleProjectPage = new GradleProjectWizardPage(configuration); this.gradleOptionsPage = new GradleOptionsWizardPage(configuration, publishedGradleVersions); this.projectPreviewPage = new ProjectPreviewWizardPage(this.controller.getConfiguration(), new ProjectPreviewWizardPage.ProjectPreviewLoader() { @Override public Job loadPreview( FutureCallback<Pair<OmniBuildEnvironment, OmniGradleBuildStructure>> resultHandler, List<ProgressListener> listeners) { ProjectPreviewJob projectPreviewJob = new ProjectPreviewJob(configuration, listeners, AsyncHandler.NO_OP, resultHandler); projectPreviewJob.schedule(); return projectPreviewJob; } }); }

Target:
public ProjectImportWizard(IDialogSettings dialogSettings, PublishedGradleVersionsWrapper publishedGradleVersions) { super(PREF_SHOW_WELCOME_PAGE); setDialogSettings(dialogSettings); this.controller = new ProjectImportWizardController(this); final ProjectImportConfiguration configuration = this.controller.getConfiguration(); WelcomePageContent welcomePageConfiguratorImpl = WelcomePageContentFactory .createImportWizardWelcomePageConfigurator(); this.welcomeWizardPage = new GradleWelcomeWizardPage(configuration, welcomePageConfiguratorImpl); this.gradleProjectPage = new GradleProjectWizardPage(configuration); this.gradleOptionsPage = new GradleOptionsWizardPage(configuration, publishedGradleVersions); this.projectPreviewPage = new ProjectPreviewWizardPage(this.controller.getConfiguration(), new ProjectPreviewWizardPage.ProjectPreviewLoader() { @Override public Job loadPreview( FutureCallback<Pair<OmniBuildEnvironment, OmniGradleBuildStructure>> resultHandler, List<ProgressListener> listeners) { ProjectPreviewJob projectPreviewJob = new ProjectPreviewJob(configuration, listeners, AsyncHandler.NO_OP, resultHandler); projectPreviewJob.schedule(); return projectPreviewJob; } }); }
Source:
public void onlyApprovedCode() { onlyApprovedCode(true); }

Target:
public void onlyApprovedCode() { onlyApprovedCode(false); }
Source:
public String getMetadata(String key) { return metadata.get(key).toString(); }

Target:
public String getMetadata(String key) { return (String)metadata.get(key); }
Source:
private static int calculatePageCount( MemoryAllocator memoryAllocator, int cachePageSize ) { long memoryPerPage = cachePageSize + PageList.META_DATA_BYTES_PER_PAGE; long maxPages = memoryAllocator.availableMemory() / memoryPerPage; int minimumPageCount = 2; if ( maxPages < minimumPageCount ) { throw new IllegalArgumentException( String.format( "Page cache must have at least %s pages (%s bytes of memory), but was given %s pages.", minimumPageCount, minimumPageCount * memoryPerPage, maxPages ) ); } if ( maxPages > Integer.MAX_VALUE ) { return Integer.MAX_VALUE; } return Math.toIntExact( maxPages ); }

Target:
private static int calculatePageCount( MemoryAllocator memoryAllocator, int cachePageSize ) { long memoryPerPage = cachePageSize + PageList.META_DATA_BYTES_PER_PAGE; long maxPages = memoryAllocator.availableMemory() / memoryPerPage; int minimumPageCount = 2; if ( maxPages < minimumPageCount ) { throw new IllegalArgumentException( String.format( "Page cache must have at least %s pages (%s bytes of memory), but was given %s pages.", minimumPageCount, minimumPageCount * memoryPerPage, maxPages ) ); } maxPages = Math.min( maxPages, PageList.MAX_PAGES ); return Math.toIntExact( maxPages ); }
Source:
public Map<String, String> getPathParametersEncoded(String uri) { Map<String, String> map = Maps.newHashMap(); Matcher m = regex.matcher(uri); if (m.matches()) { if (this.parameters != null) { Iterator<String> it = this.parameters.keySet().iterator(); for (int i = 1; i < m.groupCount() + 1; i++) { String parameterName = it.next(); map.put(parameterName, m.group(i)); } } } return map; }

Target:
public Map<String, String> getPathParametersEncoded(String uri) { Map<String, String> map = Maps.newHashMap(); Matcher m = regex.matcher(uri); if (m.matches()) { Iterator<String> it = this.parameters.keySet().iterator(); for (int i = 1; i < m.groupCount() + 1; i++) { String parameterName = it.next(); map.put(parameterName, m.group(i)); } } return map; }
Source:
public void testHorizontalScrollbar() { SWTBotView viewBot = openView(); List<? extends @NonNull Slider> scrollers = viewBot.bot().widgets(WidgetOfType.widgetOfType(Slider.class)); assertTrue("The view has " + scrollers.size() + " sliders", scrollers.size() >= 2); SWTBotScroller hScroller = new SWTBotScroller(scrollers.get(HORIZONTAL_SCROLLBAR_INDEX)); Rectangle scrollerRect = hScroller.getBounds(); SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class))); Rectangle timegraphRect = tgBot.getBounds(); assertEquals("Incorrect horizontal scroller start position", timegraphRect.width - scrollerRect.width, scrollerRect.x); }

Target:
public void testHorizontalScrollbar() { SWTBotView viewBot = openView(); List<? extends @NonNull Slider> sliders = viewBot.bot().widgets(WidgetOfType.widgetOfType(Slider.class)); assertTrue("The view has " + sliders.size() + " sliders", sliders.size() >= 2); SWTBotScroller hSlider = new SWTBotScroller(sliders.get(HORIZONTAL_SCROLLBAR_INDEX)); Rectangle scrollerRect = hSlider.getBounds(); SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class))); Rectangle timegraphRect = tgBot.getBounds(); assertEquals("Incorrect horizontal scroller start position", timegraphRect.x + tgBot.getNameSpace(), scrollerRect.x); }
Source:
public Matcher<Document> hasNodes(final String xPath, final Matcher<? extends Iterable<Node>> matcher) { return new BaseMatcher<Document>() { @Override public boolean matches(Object item) { XpathEngine engine = XMLUnit.newXpathEngine(); engine.setNamespaceContext(namespaceContext); try { List<Node> nodes = nodeCollection(engine.getMatchingNodes(xPath, (Document) item)); return matcher.matches(nodes); } catch (XpathException e) { return false; } } @Override public void describeTo(Description description) { description.appendText("Document where the list of nodes matching ") .appendValue(xPath).appendText(" is ").appendDescriptionOf(matcher); } @Override public void describeMismatch(Object item, Description description) { XpathEngine engine = XMLUnit.newXpathEngine(); engine.setNamespaceContext(namespaceContext); try { List<Node> nodes = nodeCollection(engine.getMatchingNodes(xPath, (Document) item)); matcher.describeMismatch(nodes, description); if(showXML != null) { printDom((Document) item, System.out); } } catch (XpathException e) { description.appendText("exception occured: ").appendText(e.getMessage()); } } }; }

Target:
public Matcher<Document> hasNodes(final String xPath, final Matcher<? extends Iterable<Node>> matcher) { return new BaseMatcher<Document>() { @Override public boolean matches(Object item) { XpathEngine engine = XMLUnit.newXpathEngine(); engine.setNamespaceContext(namespaceContext); try { List<Node> nodes = nodeCollection(engine.getMatchingNodes(xPath, (Document) item)); return matcher.matches(nodes); } catch (XpathException e) { return false; } } @Override public void describeTo(Description description) { description.appendText("Document where the list of nodes matching ") .appendValue(xPath).appendText(" is ").appendDescriptionOf(matcher); } @Override public void describeMismatch(Object item, Description description) { XpathEngine engine = XMLUnit.newXpathEngine(); engine.setNamespaceContext(namespaceContext); try { List<Node> nodes = nodeCollection(engine.getMatchingNodes(xPath, (Document) item)); matcher.describeMismatch(nodes, description); if(showXML != null) { printDom((Document) item, showXML); } } catch (XpathException e) { description.appendText("exception occured: ").appendText(e.getMessage()); } } }; }
Source:
private static List<Page> pullAvailablePages(Operator operator) throws InterruptedException { long endTime = System.nanoTime() + TimeUnit.SECONDS.toNanos(10); List<Page> outputPages = new ArrayList<>(); assertOperatorIsUnblocked(operator); while (!operator.isFinished() && System.nanoTime() - endTime < 0) { assertEquals(operator.needsInput(), false); Page outputPage = operator.getOutput(); if (outputPage != null) { outputPages.add(outputPage); } else { Thread.sleep(10); } } assertEquals(operator.needsInput(), false, "Operator still wants input"); assertTrue(operator.isFinished(), "Expected operator to be finished"); return outputPages; }

Target:
private static List<Page> pullAvailablePages(Operator operator) throws InterruptedException { long endTime = System.nanoTime() + TimeUnit.SECONDS.toNanos(10); List<Page> outputPages = new ArrayList<>(); assertOperatorIsUnblocked(operator); while (!operator.isFinished() && System.nanoTime() - endTime < 0) { assertFalse(operator.needsInput()); Page outputPage = operator.getOutput(); if (outputPage != null) { outputPages.add(outputPage); } else { Thread.sleep(10); } } assertFalse(operator.needsInput(), "Operator still wants input"); assertTrue(operator.isFinished(), "Expected operator to be finished"); return outputPages; }
Source:
public void elasticsearchVersion() throws IOException { container = new ElasticsearchContainer(); Properties props = new Properties(); props.load(ElasticsearchContainerTest.class.getResourceAsStream("elasticsearch-version.properties")); String version = props.getProperty("version"); container.withVersion(version); container.start(); Response response = getClient(container).performRequest("GET", "/"); assertThat(response.getStatusLine().getStatusCode(), is(200)); String responseAsString = EntityUtils.toString(response.getEntity()); assertThat(responseAsString, containsString(version)); }

Target:
public void elasticsearchVersion() throws IOException { try (ElasticsearchContainer container = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:5.6.12")) { container.start(); Response response = getClient(container).performRequest(new Request("GET", "/")); assertThat(response.getStatusLine().getStatusCode(), is(200)); String responseAsString = EntityUtils.toString(response.getEntity()); assertThat(responseAsString, containsString("5.6.12")); } }
Source:
public void addConfigurations(PluginInfo pluginInfo, List<ConfigurationProperty> configurationProperties) { settingsMap.clear(); if (pluginInfo != null) { ConfigurationPropertyBuilder builder = new ConfigurationPropertyBuilder(); for (ConfigurationProperty property : configurationProperties) { final PluginConfiguration configuration = configPropertyFor(property.getConfigKeyName(), pluginInfo); if (configuration != null) { settingsMap.add(builder.create(property.getConfigKeyName(), property.getConfigValue(), property.getEncryptedValue(), configuration.isSecure())); } } } }

Target:
public void addConfigurations(PluginInfo pluginInfo, List<ConfigurationProperty> configurationProperties) { settingsMap.clear(); if (pluginInfo != null) { ConfigurationPropertyBuilder builder = new ConfigurationPropertyBuilder(); for (ConfigurationProperty property : configurationProperties) { final PluginConfiguration configuration = configPropertyFor(property.getConfigKeyName(), pluginInfo); if (configuration != null) { settingsMap.add(builder.create(property.getConfigKeyName(), property.getConfigValue(), property.getEncryptedValue(), configuration.isSecure())); } else { settingsMap.add(property); } } } }
Source:
public void run() { InitializerWizard wizard = new InitializerWizard(this.editingDomain.getResourceSet(), selection); WizardDialog dialog = new WizardDialog(null, wizard); dialog.create(); if (dialog.open() == Window.OK) { this.result = wizard.getCommand(); editingDomain.getCommandStack().execute(result); } }

Target:
public void run() { InitializerWizard wizard = new InitializerWizard(); WizardDialog dialog = new WizardDialog(null, wizard); dialog.create(); if (dialog.open() == Window.OK) { editingDomain.getCommandStack().execute(wizard.getCommand(this.editingDomain.getResourceSet(), this.viewpoint)); } }
Source:
public void testWbFromDMNWhenDMNIsNotNull() { final String id = "id"; final Id expectedId = new Id(id); final String qNameNamespaceURI = "qName namespaceURI"; final String qNameLocalPart = "qName local part"; final String qNamePrefix = "qName local part"; final QName expectedTypeRef = new QName(qNameNamespaceURI, qNameLocalPart, qNamePrefix); final javax.xml.namespace.QName qName = mock(javax.xml.namespace.QName.class); final org.kie.dmn.model.api.InformationItem dmn = mock(org.kie.dmn.model.api.InformationItem.class); when(dmn.getId()).thenReturn(id); when(dmn.getTypeRef()).thenReturn(qName); when(qName.getNamespaceURI()).thenReturn(qNameNamespaceURI); when(qName.getLocalPart()).thenReturn(qNameLocalPart); when(qName.getPrefix()).thenReturn(qNamePrefix); final InformationItemPrimary informationItemPrimary = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn); final Id actualId = informationItemPrimary.getId(); final QName actualTypeRef = informationItemPrimary.getTypeRef(); assertEquals(expectedId, actualId); assertEquals(expectedTypeRef, actualTypeRef); }

Target:
public void testWbFromDMNWhenDMNIsNotNull() { final String id = "id"; final Id expectedId = new Id(id); final String qNameNamespaceURI = "qName namespaceURI"; final String qNameLocalPart = "qName local part"; final String qNamePrefix = "qName prefix"; final QName expectedTypeRef = new QName(qNameNamespaceURI, qNameLocalPart, qNamePrefix); final javax.xml.namespace.QName qName = mock(javax.xml.namespace.QName.class); final org.kie.dmn.model.api.InformationItem dmn = mock(org.kie.dmn.model.api.InformationItem.class); when(dmn.getId()).thenReturn(id); when(dmn.getTypeRef()).thenReturn(qName); when(qName.getNamespaceURI()).thenReturn(qNameNamespaceURI); when(qName.getLocalPart()).thenReturn(qNameLocalPart); when(qName.getPrefix()).thenReturn(qNamePrefix); final InformationItemPrimary informationItemPrimary = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn, dmn); final Id actualId = informationItemPrimary.getId(); final QName actualTypeRef = informationItemPrimary.getTypeRef(); assertEquals(expectedId, actualId); assertEquals(expectedTypeRef, actualTypeRef); }
Source:
public Map<String, Object> asMap() throws JWTDecodeException { ObjectMapper mapper = new ObjectMapper(); try { TypeReference<Map<String, Object>> mapType = new TypeReference<Map<String, Object>>() { }; return mapper.treeAsTokens(data).readValueAs(mapType); } catch (IOException e) { throw new JWTDecodeException("Couldn't map the Claim value to Map", e); } }

Target:
public Map<String, Object> asMap() throws JWTDecodeException { if (!data.isObject()) { return null; } ObjectMapper mapper = new ObjectMapper(); try { TypeReference<Map<String, Object>> mapType = new TypeReference<Map<String, Object>>() { }; return mapper.treeAsTokens(data).readValueAs(mapType); } catch (IOException e) { throw new JWTDecodeException("Couldn't map the Claim value to Map", e); } }
Source:
public void close() { log.debug("Closing queue"); tailers.stream().filter(Objects::nonNull).forEach(tailer -> { try { tailer.close(); } catch (Exception e) { log.error("Failed to close tailer: " + tailer); } }); tailers.clear(); queues.stream().filter(Objects::nonNull).forEach(ChronicleQueue::close); queues.clear(); closed = true; }

Target:
public void close() { log.debug("Closing queue"); tailers.stream().filter(Objects::nonNull).forEach(ChronicleLogTailer::close); tailers.clear(); queues.stream().filter(Objects::nonNull).forEach(ChronicleQueue::close); queues.clear(); closed = true; }
Source:
public void testExtensionHandlerNotRemovedByFailureWritePromise() { when(mainHandshakerMock.handshakeExtension(webSocketExtensionDataMatcher("main"))) .thenReturn(mainExtensionMock); WebSocketServerExtensionHandler extensionHandler = new WebSocketServerExtensionHandler(mainHandshakerMock); EmbeddedChannel ch = new EmbeddedChannel(extensionHandler); HttpRequest req = newUpgradeRequest("unknown, unknown2"); ch.writeInbound(req); HttpResponse res = newUpgradeResponse(null); ChannelPromise failurePromise = ch.newPromise(); ch.writeOneOutbound(res, failurePromise); failurePromise.setFailure(new IOException("Cannot write response")); assertNull(ch.readOutbound()); assertNotNull(ch.pipeline().context(extensionHandler)); }

Target:
public void testExtensionHandlerNotRemovedByFailureWritePromise() { when(mainHandshakerMock.handshakeExtension(webSocketExtensionDataMatcher("main"))) .thenReturn(mainExtensionMock); when(mainExtensionMock.newReponseData()).thenReturn( new WebSocketExtensionData("main", Collections.<String, String>emptyMap())); WebSocketServerExtensionHandler extensionHandler = new WebSocketServerExtensionHandler(mainHandshakerMock); EmbeddedChannel ch = new EmbeddedChannel(extensionHandler); HttpRequest req = newUpgradeRequest("main"); ch.writeInbound(req); HttpResponse res = newUpgradeResponse(null); ChannelPromise failurePromise = ch.newPromise(); ch.writeOneOutbound(res, failurePromise); failurePromise.setFailure(new IOException("Cannot write response")); assertNull(ch.readOutbound()); assertNotNull(ch.pipeline().context(extensionHandler)); assertTrue(ch.finish()); }
Source:
public Verification withIssuer(String... issuer) { requireClaim(PublicClaims.ISSUER, Arrays.asList(issuer)); return this; }

Target:
public Verification withIssuer(String... issuer) { requireClaim(PublicClaims.ISSUER, issuer == null ? null : Arrays.asList(issuer)); return this; }
Source:
private void writeLine(String line, TestingOutput.LineType lineType) { try { consumer.consume(DtoFactory.cloneDto(new TestingOutputImpl(line, lineType))); } catch (IOException e) { e.printStackTrace(); } }

Target:
private void writeLine(String line, TestingOutput.LineType lineType) { try { consumer.consume(DtoFactory.cloneDto(new TestingOutputImpl(line, lineType))); } catch (IOException e) { LOG.error(consumeErrorMessage, e); } }
Source:
public void testChangeTypePrivate() throws InterruptedException { getActivity(); onView(withText(R.string.changeGroupType)).perform(click()); onView(withText(" Private")).perform(click()); onView(withText("Ok")).perform(click()); onView(withText("Group type changed to : private")).inRoot(withDecorView(not(is(getActivity(). getWindow().getDecorView())))).check(matches(isDisplayed())); assertEquals(Group.GroupVisibility.PRIVATE, YieldsApplication.getGroup().getVisibility()); Thread.sleep(2000); }

Target:
public void testChangeTypePrivate() throws InterruptedException { getActivity(); onView(withText(R.string.changeGroupType)).perform(click()); onView(withText(" Private")).perform(click()); onView(withText("Ok")).perform(click()); onView(withText("Group type changed to : private")).inRoot(withDecorView(not(is(getActivity(). getWindow().getDecorView())))).check(matches(isDisplayed())); assertEquals(Group.GroupVisibility.PRIVATE, YieldsApplication.getGroup().getVisibility()); }
Source:
protected void updateValue() { if ("".equals(property.getValue())) { dropDownButton.setCaption("All"); dropDownButton.setWidth(""); } else { dropDownButton.setCaption("Toolkit Defined"); } }

Target:
protected void updateValue() { if (StringUtils.isNullOrEmpty(property.getValue())) { dropDownButton.setCaption("All"); dropDownButton.setWidth(""); } else { dropDownButton.setCaption("Toolkit Defined"); } }
Source:
public void shouldLogErrorOn_9_2_24() { Logger log = Mockito.mock(Logger.class); thrown.expect(AssertionError.class); thrown.expectMessage("The minimum supported version is "); PostgresVersionCheck.checkDatabaseVersion("9.2.24", log); Mockito.verify(log).error(contains("The minimum supported version is {}"), Mockito.anyObject(), Mockito.eq(PostgresVersionCheck.MIN_POSTGRES_VERSION)); Mockito.verifyNoMoreInteractions(log); }

Target:
public void shouldLogErrorOn_9_2_24() { Logger log = Mockito.mock(Logger.class); String expectedMessage = "The minimum supported version is " + PostgresVersionCheck.MIN_POSTGRES_VERSION; try { PostgresVersionCheck.checkDatabaseVersion("9.2.24", log); Assert.fail("Expected an AssertionError"); } catch (AssertionError error) { Assert.assertTrue("Error did not contain expected message. Actual error: " + error, error.getMessage().contains(expectedMessage)); } Mockito.verify(log).error( eq("Assertion with exception "), contains(expectedMessage), Mockito.any(Exception.class)); Mockito.verifyNoMoreInteractions(log); }
Source:
public void before() { IndexInitializer.init(elasticsearchTemplate, Product.class); repository.saveAll(Arrays.asList( Product.builder().id("1").name("Sugar").text("Cane sugar").price(1.0f).available(false).sortName("sort5") .build(), Product.builder().id("2").name("Sugar").text("Cane sugar").price(1.2f).available(true).sortName("sort4") .build(), Product.builder().id("3").name("Sugar").text("Beet sugar").price(1.1f).available(true).sortName("sort3") .build(), Product.builder().id("4").name("Salt").text("Rock salt").price(1.9f).available(true).sortName("sort2").build(), Product.builder().id("5").name("Salt").text("Sea salt").price(2.1f).available(false).sortName("sort1") .build())); elasticsearchTemplate.refresh(Product.class); }

Target:
public void before() { IndexInitializer.init(elasticsearchTemplate, Product.class); Product product1 = Product.builder().id("1").name("Sugar").text("Cane sugar").price(1.0f).available(false) .sortName("sort5").build(); Product product2 = Product.builder().id("2").name("Sugar").text("Cane sugar").price(1.2f).available(true) .sortName("sort4").build(); Product product3 = Product.builder().id("3").name("Sugar").text("Beet sugar").price(1.1f).available(true) .sortName("sort3").build(); Product product4 = Product.builder().id("4").name("Salt").text("Rock salt").price(1.9f).available(true) .sortName("sort2").build(); Product product5 = Product.builder().id("5").name("Salt").text("Sea salt").price(2.1f).available(false) .sortName("sort1").build(); repository.saveAll(Arrays.asList(product1, product2, product3, product4, product5)); elasticsearchTemplate.refresh(Product.class); }
Source:
int determineRealLabelWidth(FormItem item, Integer labelWidth) { List<Integer> sizesList = formSizeMap.get(item); int valueWidth; if (labelWidth != null) { sizesList.set(1, labelWidth); valueWidth = labelWidth; } else { valueWidth = sizesList.get(1); } return valueWidth; }

Target:
int determineRealLabelWidth(FormItem item, Integer labelWidth) { List<Integer> sizesList = formSizeMap.get(item); if (labelWidth != null) { sizesList.set(1, labelWidth); } return sizesList.get(1); }
Source:
private static <C extends Content> C mergeContents(C current, C extracted) { current.setActivelyPublished(true); current.setAliasUrls(extracted.getAliasUrls()); current.setTitle(extracted.getTitle()); current.setDescription(extracted.getDescription()); current.setImage(extracted.getImage()); current.setYear(extracted.getYear()); current.setGenres(extracted.getGenres()); current.setPeople(extracted.people()); current.setLanguages(extracted.getLanguages()); current.setCertificates(extracted.getCertificates()); current.setMediaType(extracted.getMediaType()); current.setSpecialization(extracted.getSpecialization()); current.setLastUpdated(extracted.getLastUpdated()); return current; }

Target:
private static <C extends Content> C mergeContents(C current, C extracted) { current.setActivelyPublished(extracted.isActivelyPublished()); current.setAliasUrls(extracted.getAliasUrls()); current.setTitle(extracted.getTitle()); current.setDescription(extracted.getDescription()); current.setImage(extracted.getImage()); current.setYear(extracted.getYear()); current.setGenres(extracted.getGenres()); current.setPeople(extracted.people()); current.setLanguages(extracted.getLanguages()); current.setCertificates(extracted.getCertificates()); current.setMediaType(extracted.getMediaType()); current.setSpecialization(extracted.getSpecialization()); current.setLastUpdated(extracted.getLastUpdated()); return current; }
Source:
public RequiredRolesListItemPresenter setup(final String role, final DeploymentsRequiredRolesPresenter parentPresenter) { singleValueModal.setup(LibraryConstants.AddRequiredRole, LibraryConstants.Role); this.role = role; this.parentPresenter = parentPresenter; view.init(this); view.setRole(role); return this; }

Target:
public RequiredRolesListItemPresenter setup(final String role, final DeploymentsRequiredRolesPresenter parentPresenter) { singleValueModal.setup(LibraryConstants.EditRequiredRole, LibraryConstants.Role); this.role = role; this.parentPresenter = parentPresenter; view.init(this); view.setRole(role); return this; }
Source:
public boolean userHasRoles(String userId, List<String> roleIds) { if (!UtilMethods.isSet(userId) || roleIds == null || roleIds.size() == 0) { return false; } User user; try { user = APILocator.getUserAPI().loadUserById(userId, APILocator.getUserAPI().getSystemUser(), false); } catch (Exception e) { Logger.error(this, "An error occurred when retrieving information of user ID [" + userId + "]", e); return false; } String currentRoleId = null; for (String roleId : roleIds) { if (UtilMethods.isSet(roleId.trim())) { currentRoleId = roleId; try { if (APILocator.getRoleAPI().doesUserHaveRole(user, roleId)) { return true; } } catch (DotDataException e) { Logger.error(UserAjax.class, "An error occurred when checking role [" + currentRoleId + "] on user ID [" + userId + "]", e); return false; } } } return false; }

Target:
public boolean userHasRoles(String userId, List<String> roleIds) { if (!UtilMethods.isSet(userId) || roleIds == null || roleIds.size() == 0) { return false; } User user; try { user = this.userAPI.loadUserById(userId, this.userAPI.getSystemUser(), false); } catch (Exception e) { Logger.error(this, "An error occurred when retrieving information of user ID [" + userId + "]", e); return false; } String currentRoleId = null; for (String roleId : roleIds) { if (UtilMethods.isSet(roleId.trim())) { currentRoleId = roleId; try { if (this.roleAPI.doesUserHaveRole(user, roleId)) { return true; } } catch (DotDataException e) { Logger.error(UserAjax.class, "An error occurred when checking role [" + currentRoleId + "] on user ID [" + userId + "]", e); return false; } } } return false; }
Source:
public Set<ArtifactStore> getAllArtifactStores() throws IndyDataException { Set<ArtifactStore> ret = new HashSet<>(); stores.getCache().forEach( ( k, v ) -> { ArtifactStore store = readValueByJson( v, StoreKey.fromString( k ) ); if ( store != null ) { ret.add( store ); } } ); return ret; }

Target:
public Set<ArtifactStore> getAllArtifactStores() throws IndyDataException { return stores.executeCache( c -> { Set<ArtifactStore> ret = new HashSet<>(); c.forEach( ( k, v ) -> { ArtifactStore store = readValueByJson( v, k ); if ( store != null ) { ret.add( store ); } } ); return ret; } ); }
Source:
public void test2faToken() throws IOException { List<String> asList = Arrays.asList("repo", "gist", "write:packages", "read:packages", "delete:packages", "user", "delete_repo"); String nameOfToken = "Test2faTokenCreate"; GHAuthorization token=gitHub.createToken( asList, nameOfToken, "this is a test token created by a unit test", () -> { String data = "111878"; return data; }); assert token!=null; String p = token.getToken(); assert p!=null; }

Target:
public void test2faToken() throws IOException { assertFalse("Test only valid when not proxying", mockGitHub.isUseProxy()); List<String> asList = Arrays.asList("repo", "gist", "write:packages", "read:packages", "delete:packages", "user", "delete_repo"); String nameOfToken = "Test2faTokenCreate"; GHAuthorization token=gitHub.createToken( asList, nameOfToken, "this is a test token created by a unit test", () -> { String data = "111878"; return data; }); assert token!=null; for(int i=0;i<asList.size();i++) { assertTrue(token.getScopes().get(i).contentEquals(asList.get(i))); } String p = token.getToken(); assert p!=null; }
Source:
public static UiStringText getCustomStringForAutosaveRevisionDialog(PostModel post) { Context context = WordPress.getContext(); String firstPart = context.getString(R.string.dialog_confirm_autosave_body); String lastModified = TextUtils.isEmpty(post.getDateLocallyChanged()) ? post.getLastModified() : post.getDateLocallyChanged(); String secondPart = String.format(context.getString(R.string.dialog_confirm_autosave_body_2), getFormattedDateForLastModified( context, DateTimeUtils.timestampFromIso8601Millis(lastModified)), getFormattedDateForLastModified( context, DateTimeUtils.timestampFromIso8601Millis(post.getAutoSaveModified()))); return new UiStringText(firstPart + secondPart); }

Target:
public static UiStringText getCustomStringForAutosaveRevisionDialog(PostModel post) { Context context = WordPress.getContext(); String firstPart = context.getString(R.string.dialog_confirm_autosave_body_first_part); String lastModified = TextUtils.isEmpty(post.getDateLocallyChanged()) ? post.getLastModified() : post.getDateLocallyChanged(); String secondPart = String.format(context.getString(R.string.dialog_confirm_autosave_body_second_part), getFormattedDateForLastModified( context, DateTimeUtils.timestampFromIso8601Millis(lastModified)), getFormattedDateForLastModified( context, DateTimeUtils.timestampFromIso8601Millis(post.getAutoSaveModified()))); return new UiStringText(firstPart + secondPart); }
Source:
public Map<String, Optional<DatastreamPartitionsMetadata>> getDatastreamPartitions() { Map<String, Optional<DatastreamPartitionsMetadata>> datastreams = new HashMap<>(); _partitionDiscoveryThreadMap.forEach((s, partitionDiscoveryThread) -> { if (partitionDiscoveryThread._initialized) { datastreams.put(s, Optional.of(new DatastreamPartitionsMetadata(s, partitionDiscoveryThread._subscribedPartitions))); } else { datastreams.put(s, Optional.empty()); } }); return datastreams; }

Target:
public Map<String, Optional<DatastreamGroupPartitionsMetadata>> getDatastreamPartitions() { Map<String, Optional<DatastreamGroupPartitionsMetadata>> datastreams = new HashMap<>(); _partitionDiscoveryThreadMap.forEach((s, partitionDiscoveryThread) -> { if (partitionDiscoveryThread.isInitialized()) { datastreams.put(s, Optional.of(new DatastreamGroupPartitionsMetadata(partitionDiscoveryThread.getDatastreamGroup(), partitionDiscoveryThread.getSubscribedPartitions()))); } else { datastreams.put(s, Optional.empty()); } }); return datastreams; }
Source:
private ModelNode readAttributeValue(PathAddress address, String attributeName) { final ModelNode readAttributeOp = new ModelNode(); readAttributeOp.get(OP).set(READ_ATTRIBUTE_OPERATION); readAttributeOp.get(OP_ADDR).set(address.toModelNode()); readAttributeOp.get(ModelDescriptionConstants.INCLUDE_UNDEFINED_METRIC_VALUES).set(false); readAttributeOp.get(NAME).set(attributeName); ModelNode response = modelControllerClient.execute(readAttributeOp); String error = getFailureDescription(response); if (error != null) { LOGGER.unableToReadAttribute(attributeName, address, error); } return response.get(RESULT); }

Target:
private ModelNode readAttributeValue(PathAddress address, String attributeName) { final ModelNode readAttributeOp = new ModelNode(); readAttributeOp.get(OP).set(READ_ATTRIBUTE_OPERATION); readAttributeOp.get(OP_ADDR).set(address.toModelNode()); readAttributeOp.get(ModelDescriptionConstants.INCLUDE_UNDEFINED_METRIC_VALUES).set(false); readAttributeOp.get(NAME).set(attributeName); ModelNode response = modelControllerClient.execute(readAttributeOp); String error = getFailureDescription(response); if (error != null) { if (error.contains("WFLYCTL0216")) { LOGGER.debugf("Unable to read attribute %s: %s.", attributeName, error); } else{ LOGGER.unableToReadAttribute(attributeName, address, error); } return new ModelNode(ModelType.UNDEFINED); } return response.get(RESULT); }
Source:
public void saveOrder_shouldSetOrderTypeOfDrugOrderToDrugOrderIfNotSetAndConceptNotMapped() throws Exception { Drug drug = conceptService.getDrug(2); drug.setConcept(conceptService.getConcept(113)); DrugOrder drugOrder = new DrugOrder(); Encounter encounter = encounterService.getEncounter(3); drugOrder.setEncounter(encounter); drugOrder.setPatient(patientService.getPatient(7)); drugOrder.setCareSetting(orderService.getCareSetting(1)); drugOrder.setOrderer(Context.getProviderService().getProvider(1)); drugOrder.setStartDate(encounter.getEncounterDatetime()); drugOrder.setDrug(drug); drugOrder.setDosingType(DrugOrder.DosingType.SIMPLE); drugOrder.setDose(300.0); drugOrder.setDoseUnits(conceptService.getConcept(50)); drugOrder.setQuantity(20.0); drugOrder.setQuantityUnits(conceptService.getConcept(51)); drugOrder.setDuration(20.0); drugOrder.setDurationUnits(conceptService.getConcept(28)); drugOrder.setFrequency(orderService.getOrderFrequency(3)); drugOrder.setRoute(conceptService.getConcept(22)); drugOrder.setNumRefills(10); drugOrder.setOrderType(null); orderService.saveOrder(drugOrder, null); Assert.assertNotNull(drugOrder.getOrderType()); Assert.assertEquals(orderService.getOrderTypeByUuid(OrderType.DRUG_ORDER_TYPE_UUID), drugOrder.getOrderType()); }

Target:
public void saveOrder_shouldSetOrderTypeOfDrugOrderToDrugOrderIfNotSetAndConceptNotMapped() throws Exception { Drug drug = conceptService.getDrug(2); Concept unmappedConcept = conceptService.getConcept(113); Assert.assertNull(orderService.getOrderTypeByConcept(unmappedConcept)); drug.setConcept(unmappedConcept); DrugOrder drugOrder = new DrugOrder(); Encounter encounter = encounterService.getEncounter(3); drugOrder.setEncounter(encounter); drugOrder.setPatient(patientService.getPatient(7)); drugOrder.setCareSetting(orderService.getCareSetting(1)); drugOrder.setOrderer(Context.getProviderService().getProvider(1)); drugOrder.setStartDate(encounter.getEncounterDatetime()); drugOrder.setDrug(drug); drugOrder.setDosingType(DrugOrder.DosingType.SIMPLE); drugOrder.setDose(300.0); drugOrder.setDoseUnits(conceptService.getConcept(50)); drugOrder.setQuantity(20.0); drugOrder.setQuantityUnits(conceptService.getConcept(51)); drugOrder.setDuration(20.0); drugOrder.setDurationUnits(conceptService.getConcept(28)); drugOrder.setFrequency(orderService.getOrderFrequency(3)); drugOrder.setRoute(conceptService.getConcept(22)); drugOrder.setNumRefills(10); drugOrder.setOrderType(null); orderService.saveOrder(drugOrder, null); Assert.assertNotNull(drugOrder.getOrderType()); Assert.assertEquals(orderService.getOrderTypeByUuid(OrderType.DRUG_ORDER_TYPE_UUID), drugOrder.getOrderType()); }
Source:
public void close() throws IOException { super.close(); for (Class cl : classCache.values()) { InvokerHelper.removeClass(cl); } }

Target:
public void close() throws IOException { super.close(); clearCache(); }