auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean isAllowed(HttpServletRequest request, Project project) { return checkAll( request, "plugin_framework_project_cache", project, new AuthorizationEntity.PluginDecisionPredicate() { @Override public boolean decision(IAuthorizationPlugin plugin) { return plugin.isAllowed(request, project); } @Override public HttpServletRequest getRequest() { return request; } }, new AuthorizationEntity.PluginSkippingPredicate() { @Override public boolean shouldSkip(AuthorizationEntity authEntity) { if (authEntity.forProjects().isEmpty() && authEntity.forGroups().isEmpty()) { return false; } if (authEntity.forProjects().contains(project.getName())) { return false; } return true; } @Override public HttpServletRequest getRequest() { return request; } }); }

Target:
public boolean isAllowed(HttpServletRequest request, Project project) { return checkAll( request, "plugin_framework_project_cache", project, new AuthorizationEntity.PluginDecisionPredicate() { @Override public boolean decision(IAuthorizationPlugin plugin) { return plugin.isAllowed(request, project); } }, new AuthorizationEntity.PluginSkippingPredicate() { @Override public boolean shouldSkip(AuthorizationEntity authEntity) { if (authEntity.forProjects().isEmpty() && authEntity.forGroups().isEmpty()) { return false; } if (authEntity.forProjects().contains(project.getName())) { return false; } return true; } }); }
Source:
public Observable<Server> resolve() { return refreshServerCache().concatMap(new Func1<List<Server>, Observable<? extends Server>>() { @Override public Observable<? extends Server> call(List<Server> servers) { if (servers.isEmpty()) { return Observable.error(SERVER_CACHE_EMPTY_EXCEPTION); } int currentPos = positionRef.getAndIncrement(); Server toReturn = servers.get(currentPos % servers.size()); return Observable.just(toReturn); } }); }

Target:
public Observable<Server> resolve() { return refreshServerCache().concatMap(new Func1<List<Server>, Observable<? extends Server>>() { @Override public Observable<? extends Server> call(List<Server> servers) { if (servers.isEmpty()) { return Observable.error(SERVER_CACHE_EMPTY_EXCEPTION); } int currentPos = Math.abs(positionRef.getAndIncrement()); Server toReturn = servers.get(currentPos % servers.size()); return Observable.just(toReturn); } }); }
Source:
protected String doInBackground(Void... voids) { String response; HttpURLConnection connection = null; try { URL url = new URL(newPipeApiUrl); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(timeoutPeriod); connection.setReadTimeout(timeoutPeriod); connection.setRequestProperty("Content-length", "0"); connection.setUseCaches(false); connection.setAllowUserInteraction(false); connection.connect(); int responseStatus = connection.getResponseCode(); switch (responseStatus) { case 200: case 201: BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(connection.getInputStream())); StringBuilder stringBuilder = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line); stringBuilder.append("\n"); } bufferedReader.close(); response = stringBuilder.toString(); return response; } } catch (MalformedURLException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } finally { if (connection != null) { try { connection.disconnect(); } catch (Exception ex) { ex.printStackTrace(); } } } return null; }

Target:
protected String doInBackground(Void... voids) { if (client == null) { client = new OkHttpClient .Builder() .readTimeout(timeoutPeriod, TimeUnit.SECONDS) .build(); } Request request = new Request.Builder() .url(newPipeApiUrl) .build(); try { Response response = client.newCall(request).execute(); return response.body().string(); } catch (IOException ex) { ErrorActivity.reportError(app, ex, null, null, ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "app update API fail", R.string.app_ui_crash)); } return null; }
Source:
public void actionPerformed(ActionEvent e) { TopComponent tc = WindowManager.getDefault().findTopComponent("EditorTopComponent"); EditorTopComponent etc = (EditorTopComponent) tc; try { etc.spellCheckAllText(); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } etc.getEditorState().setDirty(true); }

Target:
public void actionPerformed(ActionEvent e) { try { etc.spellCheckAllText(); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } }
Source:
protected File generate(final int studyId, final int datasetId, final Set<Integer> instanceIds, final int collectionOrderId, final DatasetFileGenerator generator, final boolean singleFile, final String fileExtension) throws IOException{ final Study study = this.studyDataManager.getStudy(studyId); final DatasetDTO dataSet = this.datasetService.getDataset(datasetId); final List<MeasurementVariable> columns = this.getColumns(study.getId(), dataSet.getDatasetId()); final Map<Integer, StudyInstance> selectedDatasetInstancesMap = getSelectedDatasetInstancesMap(dataSet.getInstances(), instanceIds); final Map<Integer, List<ObservationUnitRow>> observationUnitRowMap = this.getObservationUnitRowMap(study, dataSet, collectionOrderId, selectedDatasetInstancesMap); final DatasetCollectionOrderServiceImpl.CollectionOrder collectionOrder = DatasetCollectionOrderServiceImpl.CollectionOrder.findById(collectionOrderId); final int trialDatasetId = this.studyDataManager.getDataSetsByType(study.getId(), DataSetType.SUMMARY_DATA).get(0).getId(); this.datasetCollectionOrderService.reorder(collectionOrder, trialDatasetId, selectedDatasetInstancesMap, observationUnitRowMap); if(singleFile) { return this.generateInSingleFile(study, observationUnitRowMap, columns, fileExtension); } else { return this.generateFiles(study, dataSet, selectedDatasetInstancesMap, observationUnitRowMap, columns, generator, fileExtension); } }

Target:
protected File generate(final int studyId, final int datasetId, final Set<Integer> instanceIds, final int collectionOrderId, final DatasetFileGenerator generator, final boolean singleFile, final String fileExtension) throws IOException{ final Study study = this.studyDataManager.getStudy(studyId); final DatasetDTO dataSet = this.datasetService.getDataset(datasetId); final List<MeasurementVariable> columns = this.getColumns(study.getId(), dataSet.getDatasetId()); final Map<Integer, StudyInstance> selectedDatasetInstancesMap = getSelectedDatasetInstancesMap(dataSet.getInstances(), instanceIds); final Map<Integer, List<ObservationUnitRow>> observationUnitRowMap = this.getObservationUnitRowMap(study, dataSet, collectionOrderId, selectedDatasetInstancesMap); final DatasetCollectionOrderServiceImpl.CollectionOrder collectionOrder = DatasetCollectionOrderServiceImpl.CollectionOrder.findById(collectionOrderId); final int trialDatasetId = this.studyDataManager.getDataSetsByType(study.getId(), DataSetType.SUMMARY_DATA).get(0).getId(); this.datasetCollectionOrderService.reorder(collectionOrder, trialDatasetId, selectedDatasetInstancesMap, observationUnitRowMap); if(singleFile) { return this.generateInSingleFile(study, observationUnitRowMap, columns, generator, fileExtension); } else { return this.generateFiles(study, dataSet, selectedDatasetInstancesMap, observationUnitRowMap, columns, generator, fileExtension); } }
Source:
public Entity<TreeReference> getEntity(TreeReference data) throws SessionUnavailableException { EvaluationContext nodeContext = new EvaluationContext(ec, data); Hashtable<String, XPathExpression> variables = getDetail().getVariableDeclarations(); for(Enumeration<String> en = variables.keys(); en.hasMoreElements();) { String key = en.nextElement(); nodeContext.setVariable(key, XPathFuncExpr.unpack(variables.get(key).eval(nodeContext))); } int length = detail.getHeaderForms().length; String[] details = new String[length]; String[] sortDetails = new String[length]; boolean[] relevancyDetails = new boolean[length]; int count = 0; for(DetailField f : this.getDetail().getFields()) { try { details[count] = f.getTemplate().evaluate(nodeContext); Text sortText = f.getSort(); if(sortText == null) { sortDetails[count] = details[count]; } else { sortDetails[count] = sortText.evaluate(nodeContext); } String relevancy = f.getRelevancy(); boolean isRelevant = true; if (relevancy != null) { try { XPathExpression parsed = XPathParseTool.parseXPath(relevancy); isRelevant = XPathFuncExpr.toBoolean(parsed.eval(nodeContext)).booleanValue(); } catch (XPathSyntaxException e) { e.printStackTrace(); } } relevancyDetails[count] = isRelevant; } catch(XPathException xpe) { xpe.printStackTrace(); details[count] = "<invalid xpath: " + xpe.getMessage() + ">"; } count++; } return new Entity<TreeReference>(details, sortDetails, relevancyDetails, data); }

Target:
public Entity<TreeReference> getEntity(TreeReference data) throws SessionUnavailableException { EvaluationContext nodeContext = new EvaluationContext(ec, data); Hashtable<String, XPathExpression> variables = getDetail().getVariableDeclarations(); for(Enumeration<String> en = variables.keys(); en.hasMoreElements();) { String key = en.nextElement(); nodeContext.setVariable(key, XPathFuncExpr.unpack(variables.get(key).eval(nodeContext))); } int length = detail.getHeaderForms().length; String[] details = new String[length]; String[] sortDetails = new String[length]; boolean[] relevancyDetails = new boolean[length]; int count = 0; for(DetailField f : this.getDetail().getFields()) { try { details[count] = f.getTemplate().evaluate(nodeContext); Text sortText = f.getSort(); if(sortText == null) { sortDetails[count] = details[count]; } else { sortDetails[count] = sortText.evaluate(nodeContext); } relevancyDetails[count] = f.isRelevant(nodeContext); } catch(XPathException xpe) { xpe.printStackTrace(); details[count] = "<invalid xpath: " + xpe.getMessage() + ">"; } catch (XPathSyntaxException e) { e.printStackTrace(); } count++; } return new Entity<TreeReference>(details, sortDetails, relevancyDetails, data); }
Source:
public Property[] getProperties() { return m_properties.toArray(new Property[m_properties.size()]); }

Target:
public List<Property> getProperties() { return m_properties; }
Source:
private void createPropertiesEditorCategory() { category = new PropertyEditorCategory("Properties"); category.setIdEvent(id); for (Map.Entry<String, PropertyFormType> property : preference.getPropertiesTypes().entrySet()) { final String propertyName = property.getKey(); final PropertyEditorType propertyType = getPropertyEditorType(property.getValue()); final Object propertyValue = preference.get(propertyName); final PropertyEditorFieldInfo fieldInfo = createFieldInfo(propertyName, propertyType, propertyValue); if(property.getValue() == PropertyFormType.COMBO) { fillEnumValues(propertyValue, fieldInfo); } category.withField(fieldInfo); } }

Target:
private void createPropertiesEditorCategory() { category = new PropertyEditorCategory("Properties"); category.setIdEvent(id); for (Map.Entry<String, PropertyFormType> property : preference.getPropertiesTypes().entrySet()) { final String propertyName = property.getKey(); final PropertyEditorType propertyType = getPropertyEditorType(property.getValue()); final Object propertyValue = preference.get(propertyName); final PropertyEditorFieldInfo fieldInfo = createFieldInfo(propertyName, propertyType, propertyValue); category.withField(fieldInfo); } }
Source:
private void writeOldEntityToNBT(NBTTagCompound nbt) { if (!nil()) { try { NBTTagCompound entity = new NBTTagCompound(); entityCreature.dead = false; entityCreature.writeUnlessPassenger(entity); entityCreature.dead = true; nbt.put("entity_old", entity); } catch (Exception e) { LOGGER.error(String.format("Failed to write old entity (%s) to NBT. If this happens more often please report this to the mod author.", entityCreature), e); this.setEntityCreature(null); } } }

Target:
private void writeOldEntityToNBT(NBTTagCompound nbt) { if (!nil()) { try { NBTTagCompound entity = new NBTTagCompound(); entityCreature.removed = false; entityCreature.writeUnlessPassenger(entity); entityCreature.removed = true; nbt.put("entity_old", entity); } catch (Exception e) { LOGGER.error(String.format("Failed to write old entity (%s) to NBT. If this happens more often please report this to the mod author.", entityCreature), e); this.setEntityCreature(null); } } }
Source:
public String getDir() { String methodName = desc.getMethodName(); String className = desc.getClassName(); return "target/tests/" + className + "/" + methodName; }

Target:
public String getDir() { String methodName = desc.getMethodName(); String className = desc.getClassName(); return "target/" + className + "/" + methodName; }
Source:
public AbstractTransformerAdapter(Map<String, Object> properties) { this.properties = Collections.unmodifiableMap(properties); this.id = properties.getOrDefault(Constants.SERVICE_ID, NOT_AVAILABLE).toString(); this.mimeTypes = getTransformerMimeTypes(properties); }

Target:
public AbstractTransformerAdapter(Map<String, Object> properties) { this.properties = new HashMap<>(properties); this.id = properties.getOrDefault(Constants.SERVICE_ID, NOT_AVAILABLE).toString(); this.mimeTypes = getTransformerMimeTypes(properties); }
Source:
public static boolean isK8SFileSystemProviderAsDefault(FileSystemProvider provider) { return isOpenShiftSupported() && K8S_FS_SCHEME.equals(provider.getScheme()); }

Target:
public static boolean isK8SFileSystemProviderAsDefault(FileSystemProvider provider) { return K8S_FS_SCHEME.equals(provider.getScheme()) && isOpenShiftSupported() && isSimplifiedMonitoringEnabled(); }
Source:
public static ThriftService getThriftServiceAnnotation(Class<?> serviceClass) { Set<ThriftService> serviceAnnotations = getAllClassAnnotations(serviceClass, ThriftService.class); Preconditions.checkArgument(!serviceAnnotations.isEmpty(), "Service class %s is not annotated with @ThriftService", serviceClass.getName()); Preconditions.checkArgument(serviceAnnotations.size() == 1, "Service class %s is has multiple conflicting @ThriftService annotations: %s", serviceClass.getName(), serviceAnnotations ); return Iterables.getOnlyElement(serviceAnnotations); }

Target:
public static ThriftService getThriftServiceAnnotation(Class<?> serviceClass) { Set<ThriftService> serviceAnnotations = getAllClassAnnotations(serviceClass, ThriftService.class); Preconditions.checkArgument(!serviceAnnotations.isEmpty(), "Service class %s is not annotated with @ThriftService", serviceClass.getName()); Preconditions.checkArgument(serviceAnnotations.size() == 1, "Service class %s has multiple conflicting @ThriftService annotations: %s", serviceClass.getName(), serviceAnnotations ); return Iterables.getOnlyElement(serviceAnnotations); }
Source:
private OutputStreamWriter recreateWriter(Socket socket) throws IOException { if (writer != null) { try { writer.close(); } catch (IOException e) { log.warn(String.format("Error while closing tcp stream %s:%s", serverName, port), e); } writer = null; } BufferedOutputStream stream = new BufferedOutputStream(socket.getOutputStream(), BUFFER_SIZE); return new OutputStreamWriter(stream, "UTF8"); }

Target:
private OutputStreamWriter recreateWriter(Socket socket) throws IOException { closeWriter(); BufferedOutputStream stream = new BufferedOutputStream(socket.getOutputStream(), BUFFER_SIZE); return new OutputStreamWriter(stream, "UTF8"); }
Source:
public void checkAndNotify() { synchronized (listenerLock) { if (listener == null) { return; } final File root = rootFile.getFile(); if (root.exists()) { checkAndNotify(rootFile, rootFile.getChildren(), listFiles(rootFile.getFile())); } else { LOGGER.debug( "The monitored file does not exist. No file processing will be done through the CDM", rootFile.getName()); } } }

Target:
public boolean checkAndNotify() { synchronized (processingLock) { if (processing.get() != 0) { LOGGER.debug( "{} files are still processing. Waiting until the list is empty", processing.get()); return false; } else if (isProcessing) { LOGGER.debug("Another thread is currently running, returning until next poll"); return false; } isProcessing = true; } AsyncFileAlterationListener listenerCopy; synchronized (listenerLock) { if (listener == null) { isProcessing = false; return false; } listenerCopy = listener; } if (rootFile.checkNetwork()) { checkAndNotify(rootFile, rootFile.getChildren(), listFiles(rootFile.getFile()), listenerCopy); } else { LOGGER.debug( "The monitored file does not exist. No file fileLocks will be done through the CDM", rootFile.getName()); } isProcessing = false; return true; }
Source:
public List<Block> listBlocks(byte[] fromHash, byte[] toHash) { Block from = blocks.get(fromHash); Block to = blocks.get(toHash); if (from == null || to == null || to.getNumber() < from.getNumber()) return Collections.emptyList(); long qty = to.getNumber() - from.getNumber() + 1; List<Block> ret = new ArrayList<>(); Block block = to; for (long i = 0; i < qty && block != null && !from.isEqual(block); ++i) { ret.add(block); block = blocks.get(block.getParentHash()); } if (ret.size() > 0 && !ret.get(ret.size() - 1).isEqual(from)) return Collections.emptyList(); return ret; }

Target:
public List<Block> listBlocks(byte[] fromHash, byte[] toHash) { Block from = blocks.get(fromHash); Block to = blocks.get(toHash); if (from == null || to == null || to.getNumber() < from.getNumber()) return Collections.emptyList(); long qty = to.getNumber() - from.getNumber() + 1; List<Block> ret = new ArrayList<>(); Block block = to; for (long i = 0; i < qty && block != null; ++i) { ret.add(0, block); if (from.isEqual(block)) break; block = blocks.get(block.getParentHash()); } if (ret.isEmpty() || !ret.get(0).isEqual(from)) return Collections.emptyList(); return ret; }
Source:
private static void validateRanges(ITimeDataProvider timeprovider, TmfTimeRange selectionBegin, TmfTimeRange selectionEnd, TmfTimeRange time0, TmfTimeRange time1) { TmfTimeRange begin = time0; TmfTimeRange end = time1; if (time0.getStartTime().compareTo(time1.getStartTime()) > 0) { begin = time1; end = time0; } assertTrue("Selection Low" + selectionBegin + " " + timeprovider.getSelectionBegin(), selectionBegin.contains(TmfTimestamp.fromNanos(timeprovider.getSelectionBegin()))); assertTrue("Selection High " + selectionEnd + " " + timeprovider.getSelectionEnd(), selectionEnd.contains(TmfTimestamp.fromNanos(timeprovider.getSelectionEnd()))); assertTrue("Window Low " + begin + " " + timeprovider.getTime0(), begin.contains(TmfTimestamp.fromNanos(timeprovider.getTime0()))); assertTrue("Window High " + end + " " + timeprovider.getTime1(), end.contains(TmfTimestamp.fromNanos(timeprovider.getTime1()))); }

Target:
private static void validateRanges(ITimeDataProvider timeprovider, TmfTimeRange selectionBegin, TmfTimeRange selectionEnd, TmfTimeRange time0, TmfTimeRange time1) { TmfTimeRange end = time1; assertTrue("Selection Low" + selectionBegin + " " + timeprovider.getSelectionBegin(), selectionBegin.contains(TmfTimestamp.fromNanos(timeprovider.getSelectionBegin()))); assertTrue("Selection High " + selectionEnd + " " + timeprovider.getSelectionEnd(), selectionEnd.contains(TmfTimestamp.fromNanos(timeprovider.getSelectionEnd()))); assertTrue("Window Low " + time0 + " " + timeprovider.getTime0(), time0.contains(TmfTimestamp.fromNanos(timeprovider.getTime0()))); assertTrue("Window High " + end + " " + timeprovider.getTime1(), end.contains(TmfTimestamp.fromNanos(timeprovider.getTime1()))); }
Source:
public void excludesFileFilter() throws Exception { final File tmp = File.createTempFile("findbugs-filter", ".xml"); final Document document = DocumentHelper.createDocument(); final Element match = document .addElement("FindBugsFilter") .addElement("Match"); match.addElement("Bug").addAttribute( "pattern", "NM_SAME_SIMPLE_NAME_AS_INTERFACE" ); match.addElement("Class").addAttribute( "name", "Remote" ); new XMLWriter( new FileOutputStream(tmp) ).write(document); final byte[] bytecode = new BytecodeMocker() .withSource("class Remote implements java.rmi.Remote { }") .mock(); final Environment env = new Environment.Mock() .withFile("target/classes/Remote.class", bytecode) .withDefaultClasspath() .withExcludes( "findbugs-filter", tmp.getAbsolutePath() ); new FindBugsValidator().validate(env); }

Target:
public void excludesFileFilter() throws Exception { final File tmp = File.createTempFile( FindBugsValidator.EXCLUDE_FILTER, ".xml" ); final Document document = DocumentHelper.createDocument(); final Element match = document .addElement("FindBugsFilter") .addElement("Match"); match.addElement("Bug").addAttribute( "pattern", "NM_SAME_SIMPLE_NAME_AS_INTERFACE" ); match.addElement("Class").addAttribute( "name", "Remote" ); new XMLWriter( new FileOutputStream(tmp) ).write(document); final Environment env = new Environment.Mock() .withFile( FindBugsValidatorTest.REMOTE_FILE, new BytecodeMocker() .withSource(FindBugsValidatorTest.REMOTE_SOURCE) .mock() ) .withDefaultClasspath() .withExcludes( FindBugsValidator.EXCLUDE_FILTER, tmp.getAbsolutePath() ); new FindBugsValidator().validate(env); }
Source:
protected Constraint mixedDurations(ConstraintFactory constraintFactory) { return constraintFactory.from(Exam.class) .ifExists(Exam.class, equal(Exam::getPeriod, Exam::getPeriod)) .ifNotExistsOther(Exam.class, equal(Exam::getPeriod, Exam::getPeriod), equal(Exam::getRoom, Exam::getRoom), lessThan(Exam::getId, Exam::getId)) .join(Exam.class, equal(Exam::getPeriod), equal(Exam::getRoom), greaterThan(Exam::getId), filtering((leftExam, rightExam) -> rightExam.getTopicDuration() != leftExam.getTopicDuration())) .ifNotExists(Exam.class, equal((leftExam, rightExam) -> rightExam.getPeriod(), Exam::getPeriod), equal((leftExam, rightExam) -> rightExam.getRoom(), Exam::getRoom), equal((leftExam, rightExam) -> rightExam.getTopicDuration(), Exam::getTopicDuration), greaterThan((leftExam, rightExam) -> rightExam.getId(), Exam::getId)) .join(ExaminationConstraintConfiguration.class) .penalize("Mixed durations", HardSoftScore.ONE_SOFT, (leftExam, rightExam, config) -> config.getMixedDurationPenalty()); }

Target:
protected Constraint mixedDurations(ConstraintFactory constraintFactory) { return constraintFactory.fromUniquePair(Exam.class, equal(Exam::getPeriod), equal(Exam::getRoom)) .filter((leftExam, rightExam) -> leftExam.getTopicDuration() != rightExam.getTopicDuration()) .ifNotExists(Exam.class, equal((leftExam, rightExam) -> leftExam.getPeriod(), Exam::getPeriod), equal((leftExam, rightExam) -> leftExam.getRoom(), Exam::getRoom), greaterThan((leftExam, rightExam) -> leftExam.getId(), Exam::getId)) .ifNotExists(Exam.class, equal((leftExam, rightExam) -> leftExam.getPeriod(), Exam::getPeriod), equal((leftExam, rightExam) -> leftExam.getRoom(), Exam::getRoom), equal((leftExam, rightExam) -> rightExam.getTopicDuration(), Exam::getTopicDuration), greaterThan((leftExam, rightExam) -> rightExam.getId(), Exam::getId)) .penalizeConfigurable("mixedDurations"); }
Source:
public void shouldGetCreateTaskSensor() { final String operation = "task-created"; final String totalDescription = "The total number of newly created tasks"; final String rateDescription = "The average per-second number of newly created tasks"; expect(streamsMetrics.threadLevelSensor(operation, RecordingLevel.INFO)).andReturn(dummySensor); expect(streamsMetrics.threadLevelTagMap()).andReturn(dummyTagMap); StreamsMetricsImpl.addInvocationRateAndCountToSensor( dummySensor, THREAD_LEVEL_GROUP, dummyTagMap, operation, totalDescription, rateDescription); replayAll(); replay(StreamsMetricsImpl.class); final Sensor sensor = ThreadMetrics.createTaskSensor(streamsMetrics); verifyAll(); verify(StreamsMetricsImpl.class); assertThat(sensor, is(dummySensor)); }

Target:
public void shouldGetCreateTaskSensor() { final String operation = "task-created"; final String totalDescription = "The total number of newly created tasks"; final String rateDescription = "The average per-second number of newly created tasks"; mockStatic(StreamsMetricsImpl.class); expect(streamsMetrics.threadLevelSensor(operation, RecordingLevel.INFO)).andReturn(dummySensor); expect(streamsMetrics.threadLevelTagMap()).andReturn(dummyTagMap); StreamsMetricsImpl.addInvocationRateAndCountToSensor( dummySensor, THREAD_LEVEL_GROUP, dummyTagMap, operation, totalDescription, rateDescription); replayAll(); replay(StreamsMetricsImpl.class); final Sensor sensor = ThreadMetrics.createTaskSensor(streamsMetrics); verifyAll(); verify(StreamsMetricsImpl.class); assertThat(sensor, is(dummySensor)); }
Source:
private boolean matchEObjectAndItsContainers(Comparison comparison, EObject eObject) { boolean completed = true; if (comparison.getMatch(eObject) == null) { EObject container = eObject.eContainer(); if (container != null && isInScope(container) && comparison.getMatch(container) == null) { completed = matchEObjectAndItsContainers(comparison, container); } if (completed) { completed = tryToMatch(comparison, eObject); } } return completed; }

Target:
private boolean matchEObjectAndItsContainers(Comparison comparison, EObject eObject) { boolean completed = true; if (comparison.getMatch(eObject) == null) { EObject container = eObject.eContainer(); if (container != null && isInScope(container)) { completed = matchEObjectAndItsContainers(comparison, container); } if (completed) { completed = tryToMatch(comparison, eObject); } } return completed; }
Source:
public LocalDateTime getEndDate() { int lastLine = -1; String message = ""; if (null == endDate) { try { loadContents(); lastLine = getContentLineCount() - 1; endDate = getDate(lastLine); } catch (DataFileException e) { message = e.getMessage(); } catch (IndexOutOfBoundsException arrex) { message = "Date column don't exist."; } } if (!"".equals(message)) { if (lastLine > -1) { addMessage(lastLine, message); } else { addMessage(message); } } return endDate; }

Target:
public LocalDateTime getEndDate() { int lastLine = -1; String message = null; if (null == endDate) { try { loadContents(); lastLine = getContentLineCount() - 1; endDate = getDate(lastLine); } catch (DataFileException e) { message = e.getMessage(); } catch (IndexOutOfBoundsException arrex) { message = "Date column don't exist."; } } if (null != message) { if (lastLine > -1) { addMessage(lastLine, message); } else { addMessage(message); } } return endDate; }
Source:
private Optional<OperatingSystem> tryExtractOperatingSystemFrom(final String imageId) { Set<OperatingSystem> operatingSystemsAvailable = createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems(); return tryFind(FluentIterable.from(operatingSystemsAvailable) .filter(new Predicate<OperatingSystem>() { @Override public boolean apply(OperatingSystem input) { return input.getId().contains(imageId); } }), Predicates.notNull()); }

Target:
private Optional<OperatingSystem> tryExtractOperatingSystemFrom(final String imageId) { Set<OperatingSystem> operatingSystemsAvailable = createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems(); return FluentIterable.from(operatingSystemsAvailable) .filter(new Predicate<OperatingSystem>() { @Override public boolean apply(OperatingSystem input) { if (input == null) return false; return input.getId().contains(imageId); } }) .first(); }
Source:
public Builder(ResourceAddress address, String name) { this.address = address; this.name = name; this.parameter = new ModelNode(); this.header = new ModelNode(); this.roles = new HashSet<>(); if (name.equals(READ_RESOURCE_OPERATION)) { parameter.get(RESOLVE_EXPRESSION).set(true); } }

Target:
public Builder(ResourceAddress address, String name) { this.address = address; this.name = name; this.parameter = new ModelNode(); this.header = new ModelNode(); this.roles = new HashSet<>(); }
Source:
protected void executeCommand() { if (networkExists()) { getNetworkClusterDAO().update(getNetworkCluster()); } else { getNetworkClusterDAO().save(new NetworkCluster(getVdsGroupId(), getNetwork().getId(), NetworkStatus.OPERATIONAL, false, getNetworkCluster().isRequired(), getNetworkCluster().isMigration())); } if (getNetwork().getCluster().isDisplay()) { getNetworkClusterDAO().setNetworkExclusivelyAsDisplay(getVdsGroupId(), getNetwork().getId()); } if (getNetwork().getCluster().isMigration()) { getNetworkClusterDAO().setNetworkExclusivelyAsMigration(getVdsGroupId(), getNetwork().getId()); } NetworkClusterHelper.setStatus(getVdsGroupId(), getNetwork()); setSucceeded(true); setActionReturnValue(getNetwork().getId()); }

Target:
protected void executeCommand() { if (networkExists()) { getNetworkClusterDAO().update(getNetworkCluster()); } else { getNetworkClusterDAO().save(new NetworkCluster(getVdsGroupId(), getNetwork().getId(), NetworkStatus.OPERATIONAL, false, getNetworkCluster().isRequired(), getNetworkCluster().isMigration())); } if (getNetwork().getCluster().isDisplay()) { getNetworkClusterDAO().setNetworkExclusivelyAsDisplay(getVdsGroupId(), getNetwork().getId()); } if (getNetwork().getCluster().isMigration()) { getNetworkClusterDAO().setNetworkExclusivelyAsMigration(getVdsGroupId(), getNetwork().getId()); } NetworkClusterHelper.setStatus(getVdsGroupId(), getNetwork()); setSucceeded(true); }
Source:
public void createTelephoneChargeForFailedStatusP0010() { postBody.replace("payment_outcome", Map.of( "status", "failed", "code", "P0010", "supplemental", Map.of( "error_code", "ECKOH01234", "error_message", "textual message describing error code" ) ) ); postBody.put("card_expiry", null); connectorRestApiClient .postCreateTelephoneCharge(toJson(postBody)) .statusCode(201) .contentType(JSON) .body("amount", isNumber(12000)) .body("reference", is("MRPC12345")) .body("description", is("New passport application")) .body("processor_id", is("183f2j8923j8")) .body("provider_id", is("17498-8412u9-1273891239")) .body("payment_outcome.status", is("failed")) .body("payment_outcome.code", is("P0010")) .body("payment_outcome.supplemental.error_code", is("ECKOH01234")) .body("payment_outcome.supplemental.error_message", is("textual message describing error code")) .body("card_details.card_brand", is("master-card")) .body("card_details.expiry_date", is(nullValue())) .body("card_details.last_digits_card_number", is("1234")) .body("card_details.first_digits_card_number", is("123456")) .body("charge_id.length()", is(26)) .body("state.status", is("failed")) .body("state.code", is("P0010")) .body("state.finished", is(true)) .body("state.message", is("Payment method rejected")); }

Target:
public void createTelephoneChargeForFailedStatusP0010() { postBody.replace("payment_outcome", Map.of( "status", "failed", "code", "P0010", "supplemental", Map.of( "error_code", "ECKOH01234", "error_message", "textual message describing error code" ) ) ); connectorRestApiClient .postCreateTelephoneCharge(toJson(postBody)) .statusCode(201) .contentType(JSON) .body("amount", isNumber(12000)) .body("reference", is("MRPC12345")) .body("description", is("New passport application")) .body("processor_id", is("183f2j8923j8")) .body("provider_id", is("17498-8412u9-1273891239")) .body("payment_outcome.status", is("failed")) .body("payment_outcome.code", is("P0010")) .body("payment_outcome.supplemental.error_code", is("ECKOH01234")) .body("payment_outcome.supplemental.error_message", is("textual message describing error code")) .body("card_details.card_brand", is("master-card")) .body("card_details.expiry_date", is(nullValue())) .body("card_details.last_digits_card_number", is("1234")) .body("card_details.first_digits_card_number", is("123456")) .body("charge_id.length()", is(26)) .body("state.status", is("failed")) .body("state.code", is("P0010")) .body("state.finished", is(true)) .body("state.message", is("Payment method rejected")); }
Source:
public static void enableHaReservationCheck() { if (Config.<Boolean> getValue(ConfigValues.EnableVdsLoadBalancing)) { log.info("Start HA Reservation check"); SchedulerUtilQuartzImpl.getInstance().scheduleAFixedDelayJob(instance, "performHaResevationCheck", new Class[] {}, new Object[] {}, Config.<Integer> getValue(ConfigValues.VdsHaReservationIntervalInMinutes), Config.<Integer> getValue(ConfigValues.VdsHaReservationIntervalInMinutes), TimeUnit.MINUTES); log.info("Finished HA Reservation check"); } }

Target:
public static void enableHaReservationCheck() { if (Config.<Boolean> getValue(ConfigValues.EnableVdsLoadBalancing)) { log.info("Start HA Reservation check"); Integer interval = Config.<Integer> getValue(ConfigValues.VdsHaReservationIntervalInMinutes); SchedulerUtilQuartzImpl.getInstance().scheduleAFixedDelayJob(instance, "performHaResevationCheck", new Class[] {}, new Object[] {}, interval, interval, TimeUnit.MINUTES); log.info("Finished HA Reservation check"); } }
Source:
public void addRemoteRepo(MavenRemoteRepository repository) { Builder builder = new Builder(repository.getId(), repository.getType(), repository.getUrl()); builder.setPolicy(new RepositoryPolicy(true, repository.getUpdatePolicy() == null ? null : repository .getUpdatePolicy().apiValue(), repository.getChecksumPolicy() == null ? null : repository .getChecksumPolicy().apiValue())); for (RemoteRepository r : this.additionalRemoteRepositories) { if (r.getId().equals(repository.getId())) { return; } } this.additionalRemoteRepositories.add(builder.build()); }

Target:
public void addRemoteRepo(MavenRemoteRepository repository) { Builder builder = new Builder(repository.getId(), repository.getType(), repository.getUrl()); builder.setPolicy(new RepositoryPolicy(true, repository.getUpdatePolicy() == null ? null : repository .getUpdatePolicy().apiValue(), repository.getChecksumPolicy() == null ? null : repository .getChecksumPolicy().apiValue())); for (RemoteRepository r : this.additionalRemoteRepositories) { if (r.getId().equals(repository.getId())) { this.additionalRemoteRepositories.remove(r); } } this.additionalRemoteRepositories.add(builder.build()); }
Source:
private void handleAuditLog(HttpServletRequest request, HttpServletResponse response) { try { String clientSecret = request.getParameter("clientSecret"); String engineClientSecret = EngineLocalConfig.getInstance().getProperty("ENGINE_SSO_CLIENT_SECRET"); if (EnvelopePBE.check(clientSecret, engineClientSecret)) { String loginErrMsg = request.getParameter("loginErrMsg"); String userName = request.getParameter("userName"); AuditLogable event = new AuditLogableImpl(); event.addCustomValue("LoginErrMsg", loginErrMsg); event.setUserName(userName); auditLogDirector.log(event, AuditLogType.USER_LOGIN_FAILED_WITH_MSG); } } catch (Exception ex) { response.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { response.setStatus(HttpURLConnection.HTTP_OK); } }

Target:
private void handleAuditLog(HttpServletRequest request, HttpServletResponse response) { try { String clientSecret = request.getParameter("clientSecret"); String engineClientSecret = EngineLocalConfig.getInstance().getProperty("ENGINE_SSO_CLIENT_SECRET"); if (EnvelopePBE.check(clientSecret, engineClientSecret)) { String loginErrMsg = request.getParameter("loginErrMsg"); String userName = request.getParameter("userName"); String sourceIp = request.getParameter("sourceIp"); AuditLogable event = new AuditLogableImpl(); event.addCustomValue("LoginErrMsg", String.format(" : '%s'", loginErrMsg)); event.addCustomValue("SourceIP", sourceIp); event.setUserName(userName); auditLogDirector.log(event, AuditLogType.USER_VDC_LOGIN_FAILED); } } catch (Exception ex) { response.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { response.setStatus(HttpURLConnection.HTTP_OK); } }
Source:
protected ESClient createLocalRestClient(ElasticSearchEmbeddedServerConfig serverConfig) { if (!serverConfig.httpEnabled()) { throw new IllegalArgumentException( "Embedded configuration has no HTTP port enable, use TransportClient instead of Rest"); } RestClientBuilder lowLevelRestClient = RestClient.builder( new HttpHost("localhost", Integer.parseInt(serverConfig.getHttpPort()))); RestHighLevelClient client = new RestHighLevelClient(lowLevelRestClient); return new ESRestClient(client.getLowLevelClient(), client); }

Target:
protected ESClient createLocalRestClient(ElasticSearchEmbeddedServerConfig serverConfig) { if (!serverConfig.httpEnabled()) { throw new IllegalArgumentException( "Embedded configuration has no HTTP port enable, use TransportClient instead of Rest"); } RestClientBuilder lowLevelRestClientBuilder = RestClient.builder( new HttpHost("localhost", Integer.parseInt(serverConfig.getHttpPort()))); RestHighLevelClient client = new RestHighLevelClient(lowLevelRestClientBuilder); return new ESRestClient(client.getLowLevelClient(), client); }
Source:
private Iterable<AbstractPolicy> getPoliciesWithFilter(String groupId, Predicate<AbstractPolicy> predicate) { return Iterables.filter(getTopology().getGroups().get(groupId).getPolicies(), predicate); }

Target:
private Iterable<AbstractPolicy> getPoliciesWithFilter(String groupId, Predicate<AbstractPolicy> predicate) { Map<String, NodeGroup> groups = getTopology().getGroups(); if (groups == null || groups.get(groupId) == null || groups.get(groupId).getPolicies() == null) { return Collections.emptyList(); } return Iterables.filter(groups.get(groupId).getPolicies(), predicate); }
Source:
protected void enforceTimeLimits() { checkState(Thread.holdsLock(root), "Must hold lock to enforce time limits"); synchronized (root) { for (InternalResourceGroup group : subGroups.values()) { group.enforceTimeLimits(); } long runningTimeoutMillis = runningTimeout.toMillis(); long queuedTimeoutMillis = queuedTimeout.toMillis(); for (QueryExecution query : ImmutableList.copyOf(activeQueries)) { if (runningQueries.contains(query)) { if (Optional.ofNullable(query.getQueryInfo().getQueryStats().getExecutionTime()) .orElse(new Duration(0, NANOSECONDS)).toMillis() > runningTimeoutMillis) { cachedMemoryUsageBytes -= query.getTotalMemoryReservation(); query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "query exceeded resource group runtime limit")); } } else if (Optional.ofNullable(query.getQueryInfo().getQueryStats().getElapsedTime()) .orElse(new Duration(0, NANOSECONDS)).toMillis() - Optional.ofNullable(query.getQueryInfo().getQueryStats().getExecutionTime()) .orElse(new Duration(0, NANOSECONDS)).toMillis() > queuedTimeoutMillis) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "query exceeded resource group queued time limit")); } } } }

Target:
protected void enforceTimeLimits() { checkState(Thread.holdsLock(root), "Must hold lock to enforce time limits"); synchronized (root) { for (InternalResourceGroup group : subGroups.values()) { group.enforceTimeLimits(); } for (QueryExecution query : runningQueries) { Duration runningTime = query.getQueryInfo().getQueryStats().getExecutionTime(); if (runningQueries.contains(query) && runningTime != null && runningTime.compareTo(runningTimeLimit) > 0) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "query exceeded resource group runtime limit")); } } for (QueryExecution query : queuedQueries) { Duration elapsedTime = query.getQueryInfo().getQueryStats().getElapsedTime(); if (queuedQueries.contains(query) && elapsedTime != null && elapsedTime.compareTo(queuedTimeLimit) > 0) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "query exceeded resource group queued time limit")); } } } }
Source:
public static MortarScope getScope(Context context) { MortarScope scope = (MortarScope) context.getSystemService(MORTAR_SCOPE_SERVICE); if (scope == null) { throw new IllegalArgumentException( format("Cannot find scope in %s.", context.getClass().getName())); } return scope; }

Target:
public static MortarScope getScope(Context context) { MortarScope scope = (MortarScope) context.getSystemService(MORTAR_SCOPE_SERVICE); if (scope == null) { throw new IllegalArgumentException( format("Cannot find scope in %s. Make sure your Activity's content view is set using " + " an inflater from MortarScope.createContext()", context.getClass().getName())); } return scope; }
Source:
public static EnterpriseArchive createDeployment() { final EnterpriseArchive enterpriseArchive = Maven.resolver().resolve("org.superbiz:moviefun-ear:ear:8.0.0-SNAPSHOT") .withoutTransitivity().asSingle(EnterpriseArchive.class); System.out.println(enterpriseArchive.toString(true)); return enterpriseArchive; }

Target:
public static EnterpriseArchive createDeployment() { ResourceBundle mavenVersion = ResourceBundle.getBundle("version"); final EnterpriseArchive enterpriseArchive = Maven.resolver().resolve("org.superbiz:moviefun-ear:ear:" + mavenVersion.getString("version")) .withoutTransitivity().asSingle(EnterpriseArchive.class); System.out.println(enterpriseArchive.toString(true)); return enterpriseArchive; }
Source:
public void createExternalIdEnforcesStudyId() { when(substudyService.getSubstudy(TestConstants.TEST_STUDY, SUBSTUDY_ID, false)) .thenReturn(Substudy.create()); EXT_ID.setSubstudyId(SUBSTUDY_ID); EXT_ID.setStudyId("some-dumb-id"); externalIdService.createExternalId(EXT_ID, false); verify(externalIdDao).createExternalId(EXT_ID); }

Target:
public void createExternalIdEnforcesStudyId() { when(substudyService.getSubstudy(TestConstants.TEST_STUDY, SUBSTUDY_ID, false)) .thenReturn(Substudy.create()); ExternalIdentifier newExtId = ExternalIdentifier.create(new StudyIdentifierImpl("some-dumb-id"), ID); newExtId.setSubstudyId(SUBSTUDY_ID); externalIdService.createExternalId(newExtId, false); verify(externalIdDao).createExternalId(extId); }
Source:
Object doConvert(BoxedValue input) throws CoreException { if (input instanceof EclString) { String value = ((EclString) input).getValue(); if (value.equals("inf") || value.equals("+inf")) { return Double.POSITIVE_INFINITY; } if (value.equals("-inf")) { return Double.NEGATIVE_INFINITY; } } return BoxedValues.toDouble(input); }

Target:
Object doConvert(BoxedValue input) throws CoreException { if (input instanceof EclString) { final String value = ((EclString) input).getValue(); return Double.valueOf(value); } return BoxedValues.toDouble(input); }
Source:
public String getHeader(){ return selectedPageHeader.getText(); }

Target:
private String getHeader(){ return selectedPageHeader.getText(); }
Source:
public void stop() { synchronized (this.directReplyToContainers) { if (this.directReplyToContainers.size() > 0) { Iterator<Entry<ConnectionFactory, DirectReplyToMessageListenerContainer>> iterator = this.directReplyToContainers.entrySet().iterator(); while (iterator.hasNext()) { Entry<ConnectionFactory, DirectReplyToMessageListenerContainer> entry = iterator.next(); if (entry.getValue().isRunning()) { entry.getValue().stop(); } iterator.remove(); } } } }

Target:
public final void stop() { synchronized (this.directReplyToContainers) { this.directReplyToContainers.values() .stream() .filter(AbstractMessageListenerContainer::isRunning) .forEach(AbstractMessageListenerContainer::stop); this.directReplyToContainers.clear(); } doStop(); }
Source:
private Error parseRestcommErrorCode(String errCode) { Error error = null; if (SUCCESS_CODE.equals(errCode)) { error = null; } else if (errorMap.containsKey(errCode)) { error = errorMap.get(errCode); } else { error = Error.UNKNOWN_ERROR; } if (logger.isDebugEnabled()) { logger.debug("Mapped to: " + error); } return error; }

Target:
private MessageError parseRestcommErrorCode(String errCode) { MessageError error = null; if (SUCCESS_CODE.equals(errCode)) { error = null; } else if (errorMap.containsKey(errCode)) { error = errorMap.get(errCode); } else { error = MessageError.UNKNOWN_ERROR; } if (logger.isDebugEnabled()) { logger.debug("Mapped to: " + error); } return error; }
Source:
public int[] getRequiredTokens() { return new int[] { TokenTypes.PARAMETER_DEF, TokenTypes.LAMBDA, }; }

Target:
public int[] getRequiredTokens() { return CommonUtils.EMPTY_INT_ARRAY; }
Source:
private Decoder<?> getKeyDecoder() throws ClassNotFoundException, IllegalAccessException, InstantiationException { String keyDecoder = properties.getKeyDecoder(); if (keyDecoder == null) { return new DefaultDecoder(new VerifiableProperties()); } Class keyDecoderClass = Class.forName(keyDecoder); return (Decoder) keyDecoderClass.newInstance(); }

Target:
private Decoder<?> getKeyDecoder() throws IllegalAccessException, InstantiationException { Class keyDecoder = properties.getKeyDecoder(); return getDecoder(keyDecoder); }
Source:
public boolean isPolling() { return false; }

Target:
public boolean isPolling() { return true; }
Source:
public ImagesListReturn(Map<String, Object> innerMap) { super(innerMap); Object[] tempObj = (Object[]) innerMap.get(IMAGES_LIST); if (tempObj != null) { imageList = Arrays.stream(tempObj) .map(id -> (String)id) .filter(id -> !id.startsWith(StorageConstants.REMOVED_IMAGE_PREFIX)) .toArray(String[]::new); } }

Target:
public ImagesListReturn(Map<String, Object> innerMap) { super(innerMap); Object[] tempObj = (Object[]) innerMap.get(IMAGES_LIST); if (tempObj != null) { imageList = Arrays.stream(tempObj) .map(id -> (String)id) .filter(id -> isValidUUID(id)) .toArray(String[]::new); } }
Source:
public List<TablePartitionKeysProto> getAllPartitionKeys() throws CatalogException { Connection conn = null; Statement stmt = null; ResultSet resultSet = null; List<TablePartitionKeysProto> partitions = new ArrayList<TablePartitionKeysProto>(); try { String sql = " SELECT C." + COL_PARTITIONS_PK + ", C.COLUMN_NAME, C.PARTITION_VALUE " + " FROM " + TB_TABLES + " A " + " JOIN " + TB_PARTTIONS + " B ON A." + COL_TABLES_PK + " = B." + COL_TABLES_PK + " AND B." + COL_PARTITIONS_PK + " > 0 " + " JOIN " + TB_PARTTION_KEYS + " C ON B." + COL_PARTITIONS_PK + " = C." + COL_PARTITIONS_PK; conn = getConnection(); stmt = conn.createStatement(); resultSet = stmt.executeQuery(sql); while (resultSet.next()) { TablePartitionKeysProto.Builder builder = TablePartitionKeysProto.newBuilder(); builder.setPartitionId(resultSet.getInt(COL_PARTITIONS_PK)); builder.setColumnName(resultSet.getString("COLUMN_NAME")); builder.setPartitionValue(resultSet.getString("PARTITION_VALUE")); partitions.add(builder.build()); } } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(stmt, resultSet); } return partitions; }

Target:
public List<TablePartitionKeyProto> getAllPartitionKeys() { Connection conn = null; Statement stmt = null; ResultSet resultSet = null; List<TablePartitionKeyProto> partitions = new ArrayList<TablePartitionKeyProto>(); try { String sql = " SELECT A." + COL_PARTITIONS_PK + ", A.COLUMN_NAME, A.PARTITION_VALUE " + " FROM " + TB_PARTTION_KEYS + " A "; conn = getConnection(); stmt = conn.createStatement(); resultSet = stmt.executeQuery(sql); while (resultSet.next()) { TablePartitionKeyProto.Builder builder = TablePartitionKeyProto.newBuilder(); builder.setPartitionId(resultSet.getInt(COL_PARTITIONS_PK)); builder.setColumnName(resultSet.getString("COLUMN_NAME")); builder.setPartitionValue(resultSet.getString("PARTITION_VALUE")); partitions.add(builder.build()); } } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(stmt, resultSet); } return partitions; }
Source:
public void testWarnWithLocationSuccess() throws IOException { printer.warn(WARNING_MSG, new Location(LINE_NUMBER, COLUMN_NUMBER + 1)); assertEquals(expectedOutput("warning", WARNING_MSG, LINE_NUMBER, COLUMN_NUMBER + 1), outContent.toString()); }

Target:
public void testWarnWithLocationSuccess() throws IOException { printer.warn(WARNING_MSG, new Location(LINE_NUMBER, COLUMN_NUMBER)); assertEquals(expectedOutput("warning", WARNING_MSG, LINE_NUMBER, COLUMN_NUMBER), outContent.toString()); }
Source:
public void testGetInvalidityInfoForTimeForSessionStartAndEnd_valid_returnEmptyString() { Date date = new Date(); Date sessionStart = new Date(date.getTime() - 1000); Date sessionEnd = new Date(date.getTime() + 1000); assertEquals("", validator.getInvalidityInfoForTimeForSessionStartAndEnd(sessionStart, sessionEnd)); }

Target:
public void testGetInvalidityInfoForTimeForSessionStartAndEnd_valid_returnEmptyString() { Date sessionStart = TimeHelper.getHoursOffsetToCurrentTime(-1); Date sessionEnd = TimeHelper.getHoursOffsetToCurrentTime(1); assertEquals("", validator.getInvalidityInfoForTimeForSessionStartAndEnd(sessionStart, sessionEnd)); }
Source:
public void start() { log.info("Starting DerbyConnector...."); storage.start(); }

Target:
public void start() { log.info("Starting DerbyConnector..."); storage.start(); }