auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void addToContextMenu(String mergeActionId, Action action, IMenuManager manager) { IContributionItem group = null;; <START> if (mergeActionId!=null) <END> switch (mergeActionId) { case SynchronizationActionProvider.MERGE_ACTION_ID: group = manager.find(MERGE_ACTION_GROUP); break; case SynchronizationActionProvider.OVERWRITE_ACTION_ID: group = manager.find(MERGE_ACTION_GROUP); break; case SynchronizationActionProvider.MARK_AS_MERGE_ACTION_ID: group = manager.find(OTHER_ACTION_GROUP); break; default: break; } if (group != null) { manager.appendToGroup(group.getId(), action); } else { manager.add(action); } }</code><technical_language>Missing whitespace !=, missing { subsequent indentation problems</technical_language>

Target:
protected void addToContextMenu(String mergeActionId, Action action, IMenuManager manager) { IContributionItem group = null; if (mergeActionId != null) { switch (mergeActionId) { case SynchronizationActionProvider.MERGE_ACTION_ID: group = manager.find(MERGE_ACTION_GROUP); break; case SynchronizationActionProvider.OVERWRITE_ACTION_ID: group = manager.find(MERGE_ACTION_GROUP); break; case SynchronizationActionProvider.MARK_AS_MERGE_ACTION_ID: group = manager.find(OTHER_ACTION_GROUP); break; default: break; } if (group != null) { manager.appendToGroup(group.getId(), action); } else { manager.add(action); } } }
Source:
<code>public static Map<String, TestClass> findTestResultsInDirectory(Run<?,?> build, TaskListener listener, @CheckForNull FilePath workspace){ if(workspace==null){ return Collections.emptyMap(); } String[] tests = null; Map<String, TestClass> data = new TreeMap<String, TestClass>(); final String baseDir = workspace.getRemote(); String separator = null; final List<String> testFilesExpression = new ArrayList<String>(); testFilesExpression.add("**/src/test/java Test*.java"); testFilesExpression.add("**/src/test/java *Test.java"); testFilesExpression.add("**/src/test/java *Tests.java"); testFilesExpression.add("**/src/test/java *TestCase.java"); try { <START> separator = workspace.act(new MasterToSlaveCallable<String, Throwable>() { <END> @Override public String call() throws Throwable { return File.separator; } }); tests = workspace.act(new MasterToSlaveCallable<String[], Throwable>() { @Override public String[] call() throws Throwable { return Util.createFileSet(new File(baseDir), StringUtils.join(testFilesExpression,",")).getDirectoryScanner().getIncludedFiles(); } }); } catch (Throwable throwable) { throwable.printStackTrace(listener.getLogger()); return data; } if(separator.equals("\\")){ separator = separator + separator; } for(String test : tests){ String path = StringUtils.join(new String[]{"src", "test", "java"}, separator); test = test.split(path + separator)[1]; test = test.substring(0,test.length()-5); data.put(test, new TestClass(test)); } return data; }</code><technical_language>a regular expression avoid a callable. [\/] (would need correct escaping applied)</technical_language>

Target:
public static Map<String, TestClass> findTestResultsInDirectory(Run<?,?> build, TaskListener listener, @CheckForNull FilePath workspace){ if(workspace==null){ return Collections.emptyMap(); } String[] tests = null; Map<String, TestClass> data = new TreeMap<String, TestClass>(); final String baseDir = workspace.getRemote(); String separator = null; final List<String> testFilesExpression = new ArrayList<String>(); testFilesExpression.add("**/src/test/java Test*.java"); testFilesExpression.add("**/src/test/java *Test.java"); testFilesExpression.add("**/src/test/java *Tests.java"); testFilesExpression.add("**/src/test/java *TestCase.java"); try { separator = workspace.act(new MasterToSlaveCallable<String, Throwable>() { @Override public String call() throws Throwable { return File.separator; } }); tests = workspace.act(new MasterToSlaveCallable<String[], Throwable>() { @Override public String[] call() throws Throwable { return Util.createFileSet(new File(baseDir), StringUtils.join(testFilesExpression,",")).getDirectoryScanner().getIncludedFiles(); } }); } catch (Throwable throwable) { throwable.printStackTrace(listener.getLogger()); return data; } if(separator.equals("\\")){ separator = separator + separator; } for(String test : tests){ String path = StringUtils.join(new String[]{"src", "test", "java"}, separator); test = test.split(path + separator)[1]; test = FilenameUtils.removeExtension(test); data.put(test, new TestClass(test)); } return data; }
Source:
<code>public ExperimentModel getExperimentByProjectIdAndLocation(final Integer projectId, final Integer locationId) throws MiddlewareQueryException { try { final Criteria criteria = this.getSession().createCriteria(this.getPersistentClass()); criteria.add(Restrictions.eq("project.projectId", projectId)); criteria.add(Restrictions.eq("geoLocation.locationId", locationId)); <START> @SuppressWarnings("rawtypes") final List list = criteria.list(); <END> if (list != null && !list.isEmpty()) { return (ExperimentModel) list.get(0); } } catch (final HibernateException e) { this.logAndThrowException("Error at getExperimentByProjectIdAndLocation=" + projectId + "," + locationId + " query at ExperimentDao: " + e.getMessage(), e); } return null; }</code><technical_language>@vmaletta this List<ExperimentModel> remove annotation</technical_language>

Target:
public ExperimentModel getExperimentByProjectIdAndLocation(final Integer projectId, final Integer locationId) throws MiddlewareQueryException { try { final Criteria criteria = this.getSession().createCriteria(this.getPersistentClass()); criteria.add(Restrictions.eq("project.projectId", projectId)); criteria.add(Restrictions.eq("geoLocation.locationId", locationId)); final List<ExperimentModel> list = criteria.list(); if (list != null && !list.isEmpty()) { return (ExperimentModel) list.get(0); } } catch (final HibernateException e) { this.logAndThrowException("Error at getExperimentByProjectIdAndLocation=" + projectId + "," + locationId + " query at ExperimentDao: " + e.getMessage(), e); } return null; }
Source:
<code>private void parseReportsXML() { try { constructRequestBuilder("/" + BaseContextPathData.getInstance().getRelativePath() + "services/reports-xml").sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { <START> if (!reportBaseUrl.trim().isEmpty()) { <END> scheduleCheckStatus(); } setXmlInitialized(); } @Override public void onResponseReceived(Request request, Response response) { try { switch (response.getStatusCode()) { case Response.SC_NOT_FOUND: if (!reportBaseUrl.trim().isEmpty()) { scheduleCheckStatus(); } break; case Response.SC_OK: if (ReportParser.getInstance().parseReport(response.getText())) { resourceMap = ReportParser.getInstance().getResourceMap(); dashboardMap = ReportParser.getInstance().getDashboardMap(); isCommunityEdition = ReportParser.getInstance().isCommunityEdition(); } break; } } catch (DOMParseException e) { } finally { setXmlInitialized(); } } }); } catch (RequestException e) { setXmlInitialized(); } }</code><technical_language>please format</technical_language>

Target:
private void parseReportsXML() { try { constructServiceRequestBuilder(ReportXmlService).sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { if (!reportBaseUrl.trim().isEmpty() && !scheduledStatusCheckInProgress && !reportsWebappDeployed) { scheduleCheckStatus(); } setXmlInitialized(); } @Override public void onResponseReceived(Request request, Response response) { switch (response.getStatusCode()) { case Response.SC_NOT_FOUND: if (!reportBaseUrl.trim().isEmpty() && !scheduledStatusCheckInProgress && !reportsWebappDeployed) { scheduleCheckStatus(); } setXmlInitialized(); break; case Response.SC_OK: try { if (ReportParser.getInstance().parseReport(response.getText())) { resourceMap = ReportParser.getInstance().getResourceMap(); dashboardMap = ReportParser.getInstance().getDashboardMap(); isCommunityEdition = ReportParser.getInstance().isCommunityEdition(); } } catch (DOMParseException e) { } finally { setXmlInitialized(); } break; } } }); } catch (RequestException e) { setXmlInitialized(); } }
Source:
<code>private void createProject(final DeploymentMode mode) { view.showBusyIndicator(view.getSavingMessage()); final String name = view.getName(); final String description = view.getDescription(); final String groupId = view.getGroupId(); final String artifactId = view.getArtifactId(); final String version = view.getVersion(); validateFields(name, groupId, artifactId, version, () -> { final ParameterizedCommand<WorkspaceProject> successCallback = getSuccessCallback(); final ErrorCallback<?> errorCallback = getErrorCallback(); final POM pom = setDefaultPOM(groupId, artifactId, version, name, description); <START> libraryService.call(successCallback, <END> errorCallback).createProject(projectContext.getActiveOrganizationalUnit() .orElseThrow(() -> new IllegalStateException("Cannot create new project without an active organizational unit.")), pom, mode); }); }</code><technical_language>@mcivantos-tribalyte _successCallback_ changed in another commit, need update this to: _(WorkspaceProject project) -> successCallback.execute(project)_</technical_language>

Target:
private void createProject(final DeploymentMode mode) { view.showBusyIndicator(view.getSavingMessage()); final String name = view.getName(); final String description = view.getDescription(); final String groupId = view.getGroupId(); final String artifactId = view.getArtifactId(); final String version = view.getVersion(); validateFields(name, groupId, artifactId, version, () -> { final ParameterizedCommand<WorkspaceProject> successCallback = getSuccessCallback(); final ErrorCallback<?> errorCallback = getErrorCallback(); final POM pom = setDefaultPOM(groupId, artifactId, version, name, description); libraryService.call((WorkspaceProject project) -> successCallback.execute(project), errorCallback).createProject(projectContext.getActiveOrganizationalUnit() .orElseThrow(() -> new IllegalStateException("Cannot create new project without an active organizational unit.")), pom, mode); }); }
Source:
<code>public void close() throws ProcessorStateException { RuntimeException firstException = null; if (!stores.isEmpty()) { log.debug("Closing its state manager and all the registered state stores: {}", stores); for (final Map.Entry<String, StateStoreMetadata> entry : stores.entrySet()) { final StateStore store = entry.getValue().stateStore; log.trace("Closing store {}", store.name()); try { store.close(); } catch (final RuntimeException exception) { if (firstException == null) { if (exception instanceof StreamsException) firstException = exception; else firstException = new ProcessorStateException( format("%sFailed to close state store %s", logPrefix, store.name()), exception); } log.error("Failed to close state store {}: ", store.name(), exception); } } <START> stores.clear(); <END> } if (firstException != null) { throw firstException; } }</code><technical_language>do need clear store before</technical_language>

Target:
public void close() throws ProcessorStateException { RuntimeException firstException = null; if (!stores.isEmpty()) { log.debug("Closing its state manager and all the registered state stores: {}", stores); for (final Map.Entry<String, StateStoreMetadata> entry : stores.entrySet()) { final StateStore store = entry.getValue().stateStore; log.trace("Closing store {}", store.name()); try { store.close(); } catch (final RuntimeException exception) { if (firstException == null) { if (exception instanceof StreamsException) firstException = exception; else firstException = new ProcessorStateException( format("%sFailed to close state store %s", logPrefix, store.name()), exception); } log.error("Failed to close state store {}: ", store.name(), exception); } } } if (firstException != null) { throw firstException; } }
Source:
<code><START> protected Object getGranularitiesToTest() { <END> return new Object[] { Granularity.FULL, Granularity.MIN_5, Granularity.MIN_20, Granularity.MIN_60, Granularity.MIN_240, Granularity.MIN_1440 }; }</code><technical_language>Granularity.granularities() method</technical_language>

Target:
protected Object getGranularitiesToTest() { return Granularity.granularities(); }
Source:
<code>public ADBInfo(HashMap<String,String> env) { this.env = env; try { String dockerHost = env.get("DOCKER_HOST"); URI url = new URI(dockerHost); String h = url.getHost(); openshiftHost = "https://" + h; <START> } catch(URISyntaxException murle) { <END> murle.printStackTrace(); } }</code><technical_language>this catched? this caller react accordingly</technical_language>

Target:
public ADBInfo(HashMap<String,String> env) throws URISyntaxException { this.env = env; String dockerHost = env.get("DOCKER_HOST"); URI url = new URI(dockerHost); String h = url.getHost(); openshiftHost = "https://" + h; }
Source:
<code>public PatientData<T> load(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { throw new NullPointerException(ERROR_MESSAGE_NO_PATIENT_CLASS); } Map<String, T> result = new LinkedHashMap<String, T>(); for (String propertyName : getProperties()) { <START> BaseProperty<EntityReference> field = (BaseProperty<EntityReference>) data.getField(propertyName); <END> if (field != null) { Object propertyValue = field.getValue(); if (getCodeFields().contains(propertyName) && isCodeFieldsOnly()) { List<VocabularyProperty> propertyValuesList = new LinkedList<>(); List<String> terms = (List<String>) propertyValue; for (String termId : terms) { propertyValuesList.add(new QuickOntologyProperty(termId)); } propertyValue = propertyValuesList; } result.put(propertyName, (T) propertyValue); } } return new DictionaryPatientData<>(getName(), result); } catch (Exception e) { this.logger.error( "Could not find requested document or some unforeseen error has occurred during controller loading"); } return null; }</code><technical_language>This ObjectPropertyReference instead of EntityReference</technical_language>

Target:
public PatientData<T> load(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { throw new NullPointerException(ERROR_MESSAGE_NO_PATIENT_CLASS); } Map<String, T> result = new LinkedHashMap<String, T>(); for (String propertyName : getProperties()) { BaseProperty<ObjectPropertyReference> field = (BaseProperty<ObjectPropertyReference>) data.getField(propertyName); if (field != null) { Object propertyValue = field.getValue(); if (getCodeFields().contains(propertyName) && isCodeFieldsOnly()) { List<VocabularyProperty> propertyValuesList = new LinkedList<>(); List<String> terms = (List<String>) propertyValue; for (String termId : terms) { propertyValuesList.add(new QuickOntologyProperty(termId)); } propertyValue = propertyValuesList; } result.put(propertyName, (T) propertyValue); } } return new DictionaryPatientData<>(getName(), result); } catch (Exception e) { this.logger.error( "Could not find requested document or some unforeseen error has occurred during controller loading"); } return null; }
Source:
<code>public void testMetaCharsetUpdateUtf8() { final Document doc = createHtmlDocument("changeThis"); doc.updateMetaCharset(true); doc.charset(Charset.forName(charsetUtf8)); final String htmlCharsetUTF8 = "<html>\n" + " <head>\n" + " <meta charset=\"" + charsetUtf8 + "\">\n" + " </head>\n" + " <body></body>\n" + "</html>"; assertEquals(htmlCharsetUTF8, doc.toString()); Element selectedElement = doc.select("meta[charset]").first(); <START> assertEquals(charsetUtf8, doc.charset().displayName()); <END> assertEquals(charsetUtf8, selectedElement.attr("charset")); assertEquals(doc.charset(), doc.outputSettings().charset()); }</code><technical_language>I instance of displayName() name(). is canonical, / vary depending Locale. <LINK_0></technical_language>

Target:
public void testMetaCharsetUpdateUtf8() { final Document doc = createHtmlDocument("changeThis"); doc.updateMetaCharsetElement(true); doc.charset(Charset.forName(charsetUtf8)); final String htmlCharsetUTF8 = "<html>\n" + " <head>\n" + " <meta charset=\"" + charsetUtf8 + "\">\n" + " </head>\n" + " <body></body>\n" + "</html>"; assertEquals(htmlCharsetUTF8, doc.toString()); Element selectedElement = doc.select("meta[charset]").first(); assertEquals(charsetUtf8, doc.charset().name()); assertEquals(charsetUtf8, selectedElement.attr("charset")); assertEquals(doc.charset(), doc.outputSettings().charset()); }
Source:
<code>public NetworkExternalSubnetListModel() { <START> setTitle(ConstantsManager.getInstance().getConstants().externalSubnetsTitle()); <END> setHashName("external_subnets"); }</code><technical_language>this is for anything, I need verify</technical_language>

Target:
public NetworkExternalSubnetListModel() { setHashName("external_subnets"); setComparator(new NameableComparator()); }
Source:
<code>public void nodeFinished(JupiterEngineExecutionContext context, TestDescriptor descriptor, TestExecutionResult result) { <START> invokeTestWatchers(context, t -> { <END> ExtensionContext extensionContext = context.getExtensionContext(); Status status = result.getStatus(); String identifier = createTestIdentifier(); switch (status) { case SUCCESSFUL: t.testSuccessful(identifier, extensionContext); break; case FAILED: t.testFailed(identifier, result.getThrowable().get(), extensionContext); break; case ABORTED: t.testAborted(identifier, result.getThrowable().get(), extensionContext); break; } }); }</code><technical_language>Please rename t watcher</technical_language>

Target:
public void nodeFinished(JupiterEngineExecutionContext context, TestDescriptor descriptor, TestExecutionResult result) { if (context != null) { invokeTestWatchers(context, watcher -> { ExtensionContext extensionContext = context.getExtensionContext(); TestExecutionResult.Status status = result.getStatus(); switch (status) { case SUCCESSFUL: watcher.testSuccessful(extensionContext); break; case FAILED: watcher.testFailed(extensionContext, result.getThrowable().get()); break; case ABORTED: watcher.testAborted(extensionContext, result.getThrowable().get()); break; } }, true); } }
Source:
<code>protected DriverConfiguration create(String elementId, IConfigurationElement element) { if (element.getName().equals("driver")) { DriverConfiguration driverConfiguration = new DriverConfiguration(elementId, element); <START> if (!driverConfiguration.isFileBased()) <END> return driverConfiguration; } return null; }</code><technical_language>DriverConfiguration fullfills more purposes Driver listing in UI. more sense hide file based drivers in UI</technical_language>

Target:
protected DriverConfiguration create(String elementId, IConfigurationElement element) { if (element.getName().equals("driver")) { return new DriverConfiguration(elementId, element); } return null; }
Source:
<code>public static Collection<CommunicationSummaryStatistics> buildCommunicationSummaryTree( Collection<CommunicationSummaryStatistics> nodes, Set<String> endpoints) { Map<String, CommunicationSummaryStatistics> nodeMap = new HashMap<String, CommunicationSummaryStatistics>(); for (CommunicationSummaryStatistics css : nodes) { nodeMap.put(css.getId(), css); } List<CommunicationSummaryStatistics> ret = new ArrayList<>(); for (String endpoint : endpoints) { if (nodeMap.containsKey(endpoint)) { CommunicationSummaryStatistics n = nodeMap.get(nodeMap.containsKey(EndpointUtil.encodeClientURI(endpoint)) ? EndpointUtil.encodeClientURI(endpoint) : endpoint); <START> CommunicationSummaryStatistics rootNode = new CommunicationSummaryStatistics(n); <END> initCommunicationSummaryTreeNode(rootNode, nodeMap, new HashSet<>(Collections.singleton(rootNode.getId()))); ret.add(rootNode); } } return ret; }</code><technical_language>If statement (lines 61-70) minimally 3 accesses collection. This rewritten min. 1 access worst 2 accesses. If is entry for a key EndpointUtil.encodeClientURI(endpoint) endpoint a key</technical_language>

Target:
public static Collection<CommunicationSummaryStatistics> buildCommunicationSummaryTree( Collection<CommunicationSummaryStatistics> nodes, Set<String> endpoints) { Map<String, CommunicationSummaryStatistics> nodeMap = new HashMap<String, CommunicationSummaryStatistics>(); for (CommunicationSummaryStatistics css : nodes) { nodeMap.put(css.getId(), css); } List<CommunicationSummaryStatistics> ret = new ArrayList<>(); for (String endpoint : endpoints) { CommunicationSummaryStatistics n = nodeMap.get(EndpointUtil.encodeClientURI(endpoint)); if (n == null) { n = nodeMap.get(endpoint); } if (n != null) { CommunicationSummaryStatistics rootNode = new CommunicationSummaryStatistics(n); initCommunicationSummaryTreeNode(rootNode, nodeMap, new HashSet<>(Collections.singleton(rootNode.getId()))); ret.add(rootNode); } } return ret; }
Source:
<code>public void buyFromBank(Market market, String symbol, int volume) throws StockMarketExpection { <START> totalPrice=market.getStockForSymbol(symbol).getPrice()*volume; <END> if(market.getStockForSymbol(symbol).getPrice()*volume>this.cashInHand){ throw new StockMarketExpection("Cannot place order for "+symbol+" since there is not enough money. Trader: "+this.name); } this.cashInHand -= market.getStockForSymbol(symbol).getPrice()*volume; BuyOrder newOrder = new BuyOrder(symbol, volume, m.getStockForSymbol(symbol).getPrice()*volume, this); this.position.add(newOrder); }</code><technical_language>This is times in this method, assigned a variable reduce clutter</technical_language>

Target:
public void buyFromBank(Market market, String symbol, int volume) throws StockMarketExpection { totalPrice=market.getStockForSymbol(symbol).getPrice()*volume; if(totalPrice>this.cashInHand){ throw new StockMarketExpection("Cannot place order for "+symbol+" since there is not enough money. Trader: "+this.name); } this.cashInHand -= totalPrice; BuyOrder newOrder = new BuyOrder(symbol, volume, totalPrice, this); this.position.add(newOrder); }
Source:
<code>public void testCompressedFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel(new PerFrameDeflateEncoder(9, 15, false, NEVER_SKIP)); EmbeddedChannel decoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame frame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV3, Unpooled.wrappedBuffer(payload)); encoderChannel.writeOutbound(frame); BinaryWebSocketFrame compressedFrame = encoderChannel.readOutbound(); <START> assertNotNull(compressedFrame); <END> assertNotNull(compressedFrame.content()); assertEquals(WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedFrame.rsv()); decoderChannel.writeInbound(compressedFrame.content()); decoderChannel.writeInbound(DeflateDecoder.FRAME_TAIL); ByteBuf uncompressedPayload = decoderChannel.readInbound(); assertEquals(300, uncompressedPayload.readableBytes()); byte[] finalPayload = new byte[300]; uncompressedPayload.readBytes(finalPayload); assertArrayEquals(finalPayload, payload); uncompressedPayload.release(); }</code><technical_language>remove this</technical_language>

Target:
public void testCompressedFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel(new PerFrameDeflateEncoder(9, 15, false)); EmbeddedChannel decoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame frame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV3, Unpooled.wrappedBuffer(payload)); assertTrue(encoderChannel.writeOutbound(frame)); BinaryWebSocketFrame compressedFrame = encoderChannel.readOutbound(); assertNotNull(compressedFrame); assertNotNull(compressedFrame.content()); assertEquals(WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedFrame.rsv()); assertTrue(decoderChannel.writeInbound(compressedFrame.content())); assertTrue(decoderChannel.writeInbound(Unpooled.wrappedBuffer(DeflateDecoder.FRAME_TAIL))); ByteBuf uncompressedPayload = decoderChannel.readInbound(); assertEquals(300, uncompressedPayload.readableBytes()); byte[] finalPayload = new byte[300]; uncompressedPayload.readBytes(finalPayload); assertArrayEquals(finalPayload, payload); uncompressedPayload.release(); }
Source:
<code>public void start(Collection<? extends Location> locations) { super.start(locations); policy = new AbstractMembershipTrackingPolicy(MutableMap.of("name", "Cassandra Cluster Tracker")) { @Override protected void onEntityChange(Entity member) { } @Override protected void onEntityAdded(Entity member) { <START> log.debug("Node added to Cluster {}", getClusterName()); <END> update(); } @Override protected void onEntityRemoved(Entity member) { log.debug("Node removed from Cluster {}", getClusterName()); update(); } }; addPolicy(policy); policy.setGroup(this); setAttribute(Startable.SERVICE_UP, true); }</code><technical_language>do: if (log.isDebugEnabled()) log.debug("Node added Cluster {}", member, getClusterName()); similar for onEntityRemoved</technical_language>

Target:
public void start(Collection<? extends Location> locations) { super.start(locations); policy = new AbstractMembershipTrackingPolicy(MutableMap.of("name", "Cassandra Cluster Tracker")) { @Override protected void onEntityChange(Entity member) { } @Override protected void onEntityAdded(Entity member) { if (log.isDebugEnabled()) log.debug("Node added to Cluster {}", member, getClusterName()); update(); } @Override protected void onEntityRemoved(Entity member) { if (log.isDebugEnabled()) log.debug("Node removed from Cluster {}", member, getClusterName()); update(); } }; addPolicy(policy); policy.setGroup(this); setAttribute(Startable.SERVICE_UP, true); }
Source:
<code>public static void persistRealtimeToOfflineSegmentsTaskMetadata(HelixPropertyStore<ZNRecord> propertyStore, <START> String taskType, RealtimeToOfflineSegmentsTaskMetadata realtimeToOfflineSegmentsTaskMetadata, <END> int expectedVersion) { String path = ZKMetadataProvider.constructPropertyStorePathForMinionTaskMetadata(taskType, realtimeToOfflineSegmentsTaskMetadata.getTableNameWithType()); if (!propertyStore .set(path, realtimeToOfflineSegmentsTaskMetadata.toZNRecord(), expectedVersion, AccessOption.PERSISTENT)) { throw new ZkException( "Failed to persist minion realtimeToOfflineSegmentsTask metadata: " + realtimeToOfflineSegmentsTaskMetadata); } }</code><technical_language>Do need provide taskType here? is realtimeToOfflineSegmentsTask right</technical_language>

Target:
public static void persistRealtimeToOfflineSegmentsTaskMetadata(HelixPropertyStore<ZNRecord> propertyStore, String taskType, RealtimeToOfflineSegmentsTaskMetadata realtimeToOfflineSegmentsTaskMetadata, int expectedVersion) { String path = ZKMetadataProvider.constructPropertyStorePathForMinionTaskMetadata(taskType, realtimeToOfflineSegmentsTaskMetadata.getTableNameWithType()); if (!propertyStore .set(path, realtimeToOfflineSegmentsTaskMetadata.toZNRecord(), expectedVersion, AccessOption.PERSISTENT)) { throw new ZkException( "Failed to persist minion RealtimeToOfflineSegmentsTask metadata: " + realtimeToOfflineSegmentsTaskMetadata); } }
Source:
<code>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { <START> if (viewType == VIEW_TYPE_HEADER) { <END> View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.site_creation_domain_header, parent, false); return new HeaderViewHolder(itemView); } else if (viewType == VIEW_TYPE_INPUT) { View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.site_creation_domain_input, parent, false); return new InputViewHolder(itemView); } else { View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.site_creation_domain_item, parent, false); return new DomainViewHolder(itemView); } }</code><technical_language>a switch statement if-else if-else, show viewType cases similar if-else if-else if. necessary current implementation works expected. I wanted point out alternative</technical_language>

Target:
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case VIEW_TYPE_HEADER: return new HeaderViewHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.site_creation_domain_header, parent, false)); case VIEW_TYPE_INPUT: return new InputViewHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.site_creation_domain_input, parent, false)); case VIEW_TYPE_ITEM: return new DomainViewHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.site_creation_domain_item, parent, false)); default: throw new RuntimeException("Unknown view type " + viewType); } }
Source:
<code>protected void processBatchOfDocuments(List<String> batch) { if (batch == null || batch.isEmpty()) { return; } TransactionHelper.runInTransaction(() -> { try { String username = command.getUsername(); String repository = command.getRepository(); try (NuxeoLoginContext loginContext = loginSystemOrUser(username)) { <START> CoreSession session = null; if (repository != null) { session = CoreInstance.getCoreSession(repository); } <END> compute(session, batch, command.getParams()); } } catch (LoginException e) { throw new NuxeoException(e); } }); }</code><technical_language>CoreSession session = repository == null ? null : CoreInstance.getCoreSession(repository)</technical_language>

Target:
protected void processBatchOfDocuments(List<String> batch) { if (batch == null || batch.isEmpty()) { return; } TransactionHelper.runInTransaction(() -> { try { String username = command.getUsername(); String repository = command.getRepository(); try (NuxeoLoginContext ignored = loginSystemOrUser(username)) { CoreSession session = repository == null ? null : CoreInstance.getCoreSession(repository); compute(session, batch, command.getParams()); } } catch (LoginException e) { throw new NuxeoException(e); } }); }
Source:
<code>public void testNotEnoughSpaceToMergeSnapshotsWithMultipleDisk() { ArrayList<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, 4); <START> System.out.println(imagesDisks); <END> doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(15, STORAGE_DOMAIN_ID); assertFalse("Validation should fail. Free space minus threshold should be smaller then summarize all disks size", cmd.isEnoughSpaceToMergeSnapshots()); }</code><technical_language>No</technical_language>

Target:
public void testNotEnoughSpaceToMergeSnapshotsWithMultipleDisk() { List<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, IMAGE_ACTUAL_SIZE_GB); doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(15, STORAGE_DOMAIN_ID); assertFalse("Validation should fail. Free space minus threshold should be smaller then summarize all disks size", cmd.isEnoughSpaceToMergeSnapshots()); }
Source:
<code>public void testDatabaseCanGetAllUsers() { try { List<User> users = MockFactory.generateMockUsers(6); for (User user : users) { mDatabaseHelper.addUser(user); } List<User> usersFromDatabase = mDatabaseHelper.getAllUsers(); assertEquals(users.size(), usersFromDatabase.size()); for (int i = 0; i < users.size(); i++) { assertEquals(users.get(i).getName(), usersFromDatabase.get(i).getName()); assertEquals(users.get(i).getEmail(), usersFromDatabase.get(i).getEmail()); assertEquals(users.get(i).getId().getId(), usersFromDatabase.get(i).getId().getId()); } } catch (CacheDatabaseException exception) { <START> fail(); <END> } finally { mDatabaseHelper.clearDatabase(); } }</code><technical_language>I suggest replacing fail() fail(exception.getMessage()) get direct issue</technical_language>

Target:
public void testDatabaseCanGetAllUsers() { try { List<User> users = MockFactory.generateMockUsers(6); for (User user : users) { mDatabaseHelper.addUser(user); } List<User> usersFromDatabase = mDatabaseHelper.getAllUsers(); assertEquals(users.size(), usersFromDatabase.size()); for (int i = 0; i < users.size(); i++) { assertEquals(users.get(i).getName(), usersFromDatabase.get(i).getName()); assertEquals(users.get(i).getEmail(), usersFromDatabase.get(i).getEmail()); assertEquals(users.get(i).getId().getId(), usersFromDatabase.get(i).getId().getId()); } } catch (CacheDatabaseException exception) { fail(exception.getMessage()); } finally { mDatabaseHelper.clearDatabase(); } }
Source:
<code>public TravelTimeReducer (AnalysisTask task) { this.maxTripDurationMinutes = task.maxTripDurationMinutes; if (task.inRoutingFareCalculator != null) { this.timesPerDestination = task.monteCarloDraws; } else { if (task.monteCarloDraws == 0) { this.timesPerDestination = task.getTimeWindowLengthMinutes(); } else { this.timesPerDestination = task.getTimeWindowLengthMinutes() * task.getMonteCarloDrawsPerMinute(); } } this.nPercentiles = task.percentiles.length; this.percentileIndexes = new int[nPercentiles]; for (int p = 0; p < nPercentiles; p++) { percentileIndexes[p] = findPercentileIndex(timesPerDestination, task.percentiles[p]); } calculateTravelTimes = task instanceof TravelTimeSurfaceTask || task.makeTauiSite; if (calculateTravelTimes) { travelTimes = new TimeGrid(task); } calculateAccessibility = false; if (task instanceof RegionalTask) { RegionalTask regionalTask = (RegionalTask) task; if (regionalTask.recordAccessibility) { calculateAccessibility = true; accessibilityAccumulator = new AccessibilityAccumulator(task); } if (regionalTask.recordTimes) { travelTimes = new TravelTimeResult(regionalTask); <START> calculateTravelTimes = true; <END> } } }</code><technical_language>calculateTravelTimes is set true some initialization action is based of calculateTravelTimes (above new line 82)</technical_language>

Target:
public TravelTimeReducer (AnalysisTask task) { this.maxTripDurationMinutes = task.maxTripDurationMinutes; if (task.inRoutingFareCalculator != null) { this.timesPerDestination = task.monteCarloDraws; } else { if (task.monteCarloDraws == 0) { this.timesPerDestination = task.getTimeWindowLengthMinutes(); } else { this.timesPerDestination = task.getTimeWindowLengthMinutes() * task.getMonteCarloDrawsPerMinute(); } } this.nPercentiles = task.percentiles.length; this.percentileIndexes = new int[nPercentiles]; for (int p = 0; p < nPercentiles; p++) { percentileIndexes[p] = findPercentileIndex(timesPerDestination, task.percentiles[p]); } calculateAccessibility = calculateTravelTimes = false; if (task instanceof TravelTimeSurfaceTask) { calculateTravelTimes = true; } else { RegionalTask regionalTask = (RegionalTask) task; if (regionalTask.recordAccessibility) { calculateAccessibility = true; } if (regionalTask.recordTimes || regionalTask.makeTauiSite) { calculateTravelTimes = true; } } if (calculateAccessibility) { accessibilityResult = new AccessibilityResult(task); } if (calculateTravelTimes) { travelTimeResult = new TravelTimeResult(task); } }
Source:
<code>private OAuth2CredentialSource(String grantType, URL tokenEndpointUri, String scopes, Supplier<SSLContext> sslContextSupplier, Supplier<HostnameVerifier> hostnameVerifierSupplier) { <START> this(grantType, tokenEndpointUri, (Consumer<Map<String, String>>) stringStringMap -> {}, scopes, sslContextSupplier, hostnameVerifierSupplier); <END> }</code><technical_language>written this: this(grantType, tokenEndpointUri, (Map<String, String> map) -> {}, scopes, sslContextSupplier, hostnameVerifierSupplier); Adding a type lambda argument is more readable casting lambda (that's do for lambdas do accept parameters accepted arguments overloaded methods)</technical_language>

Target:
private OAuth2CredentialSource(String grantType, URL tokenEndpointUri, String scopes, Supplier<SSLContext> sslContextSupplier, Supplier<HostnameVerifier> hostnameVerifierSupplier) { this(grantType, tokenEndpointUri, stringStringMap -> {}, scopes, sslContextSupplier, hostnameVerifierSupplier); }
Source:
<code>protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); <START> URIish uriish = remoteConfig.getURIs().get(0); <END> String uriRoot = PubSubConfig.getUriRoot(uriish); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null) { p = new Publisher(uriRoot); pubsubConfig.addPublisher(p); } Subscriber s = p.getSubscriber(remote, dir); if (s == null) p.addSubscriber(new Subscriber(p, remote, dir)); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { out.println(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); return; } }</code><technical_language>if is remote defined this fails: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 java.util.ArrayList.RangeCheck(ArrayList.java:547) java.util.ArrayList.get(ArrayList.java:322) java.util.Collections$UnmodifiableList.get(Collections.java:1154) org.eclipse.jgit.pgm.Subscribe.run(Subscribe.java:74) org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:148) org.eclipse.jgit.pgm.Main.execute(Main.java:191) org.eclipse.jgit.pgm.Main.run(Main.java:120) org.eclipse.jgit.pgm.Main.main(Main.java:94) instead command explain handle this situation user do instead</technical_language>

Target:
protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) { out.println(MessageFormat.format( CLIText.get().noRemoteUriSubscribe, remote)); return; } String uriRoot = PubSubConfig.getUriRoot(uris.get(0)); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null) { p = new Publisher(uriRoot); pubsubConfig.addPublisher(p); } Subscriber s = p.getSubscriber(remote, dir); if (s == null) p.addSubscriber(new Subscriber(p, remote, dir)); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { out.println(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); return; } out.println(MessageFormat.format( CLIText.get().didSubscribe, remote, uriRoot)); }
Source:
<code>public void updateWorkerTransaction(boolean success, long transactionId, long nodeId) <START> { <END> ShardWriterDao dao = shardDbi.get(getNodeShard(nodeId)).onDemand(ShardWriterDao.class); dao.updateWorkerTransaction(success, transactionId, nodeId, System.currentTimeMillis()); }</code><technical_language>Add @Override</technical_language>

Target:
public void updateWorkerTransaction(boolean success, long transactionId, long nodeId) { ShardWriterDao dao = shardDbi.get(getTableShard(nodeId)).onDemand(ShardWriterDao.class); dao.updateWorkerTransaction(success, transactionId, nodeId, System.currentTimeMillis()); }
Source:
<code>public IStaticContentProvider getContentProvider(String propertyPath) { IStaticContentProvider provider = null; <START> ResourceSet resourceSet= getRoot(getEditedTable().getContext()).eResource().getResourceSet(); <END> if (MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath)) { provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "rowSources"); } else if (MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath)) { provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "columnSources"); } else if (MatrixPropertyConstants.MATRIX_CELL_TYPE.equals(propertyPath)) { provider = new GenericRelationshipMatrixElementTypeContentProvider(getRoot(getEditedTable().getContext())); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_DIRECTION.equals(propertyPath)) { provider = new MatrixDirectionContentProvider(); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_OWNER_STRATEGY.equals(propertyPath)) { provider = new MatrixRelationshipOwnerStrategyContentProvider(); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_OWNER.equals(propertyPath)) { provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "relationshipOwner"); } else { provider = super.getContentProvider(propertyPath); } return provider; }</code><technical_language>Please delete this copy in conditions for performance</technical_language>

Target:
public IStaticContentProvider getContentProvider(String propertyPath) { IStaticContentProvider provider = null; if (MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath)) { ResourceSet resourceSet= getRoot(getEditedTable().getContext()).eResource().getResourceSet(); provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "rowSources"); } else if (MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath)) { ResourceSet resourceSet= getRoot(getEditedTable().getContext()).eResource().getResourceSet(); provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "columnSources"); } else if (MatrixPropertyConstants.MATRIX_CELL_TYPE.equals(propertyPath)) { provider = new GenericRelationshipMatrixElementTypeContentProvider(getRoot(getEditedTable().getContext())); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_DIRECTION.equals(propertyPath)) { provider = new MatrixDirectionContentProvider(); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_OWNER_STRATEGY.equals(propertyPath)) { provider = new MatrixRelationshipOwnerStrategyContentProvider(); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_OWNER.equals(propertyPath)) { ResourceSet resourceSet= getRoot(getEditedTable().getContext()).eResource().getResourceSet(); provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "relationshipOwner"); } else { provider = super.getContentProvider(propertyPath); } return provider; }
Source:
<code>public Version get() { if( this.rawModVersion.equals( "@version@" ) || this.rawModVersion.contains( "pr" ) ) { return new DoNotCheckVersion(); } try { final Version version = this.parser.parse( this.rawModVersion ); return version; } <START> catch( final Exception e ) <END> { AELog.error( e ); return EXCEPTIONAL_VERSION; } }</code><technical_language>more specified, kind of exception thrown here. I add, AssertionError</technical_language>

Target:
public Version get() { if( this.rawModVersion.equals( "@version@" ) || this.rawModVersion.contains( "pr" ) ) { return new DoNotCheckVersion(); } try { final Version version = this.parser.parse( this.rawModVersion ); return version; } catch( final VersionCheckerException e ) { AELog.error( e ); return EXCEPTIONAL_VERSION; } }
Source:
<code>private void createSchedulingGroup(Composite container) { Group group = new Group(container, SWT.SHADOW_ETCHED_IN); group.setText(Messages.TasksUiPreferencePage_Scheduling); group.setLayout(new GridLayout(2, false)); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label weekStartLabel = new Label(group, SWT.NONE); weekStartLabel.setText(Messages.TasksUiPreferencePage_Week_Start); weekStartCombo = new Combo(group, SWT.READ_ONLY); weekStartCombo.add(""); weekStartCombo.add(""); <START> weekStartCombo.add(""); <END> weekStartCombo.add(""); weekStartCombo.add(""); weekStartCombo.add(""); weekStartCombo.add(""); weekStartCombo.select(getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1); Label scheduleNewTasksLabel = new Label(group, SWT.NONE); scheduleNewTasksLabel.setText(Messages.TasksUiPreferencePage_ScheduleNewTasks); scheduleNewTasksCombo = new Combo(group, SWT.READ_ONLY); scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_ThisWeek); scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_Tomorrow); scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_Today); scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_Unscheduled); String scheduleFor = getPreferenceStore().getString(ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR); scheduleNewTasksCombo.select(SCHEDULE_TIME_MAP.getOrDefault(scheduleFor, 0)); }</code><technical_language>whoops</technical_language>

Target:
private void createSchedulingGroup(Composite container) { Group group = new Group(container, SWT.SHADOW_ETCHED_IN); group.setText(Messages.TasksUiPreferencePage_Scheduling); group.setLayout(new GridLayout(2, false)); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label weekStartLabel = new Label(group, SWT.NONE); weekStartLabel.setText(Messages.TasksUiPreferencePage_Week_Start); weekStartCombo = new Combo(group, SWT.READ_ONLY); weekStartCombo.add(CommonMessages.Sunday); weekStartCombo.add(CommonMessages.Monday); weekStartCombo.add(CommonMessages.Tuesday); weekStartCombo.add(CommonMessages.Wednesday); weekStartCombo.add(CommonMessages.Thursday); weekStartCombo.add(CommonMessages.Friday); weekStartCombo.add(CommonMessages.Saturday); weekStartCombo.select(getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1); Label scheduleNewTasksLabel = new Label(group, SWT.NONE); scheduleNewTasksLabel.setText(Messages.TasksUiPreferencePage_ScheduleNewTasks); scheduleNewTasksCombo = new Combo(group, SWT.READ_ONLY); scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_ThisWeek); scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_Tomorrow); scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_Today); scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_Unscheduled); String scheduleFor = getPreferenceStore().getString(ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR); scheduleNewTasksCombo.select(SCHEDULE_TIME_MAP.getOrDefault(scheduleFor, 0)); }
Source:
<code>protected void testDestructiveChanges() { FeedbackQuestionAttributes question = BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1); FeedbackResponseAttributes fra = new FeedbackResponseAttributes( feedbackSessionName, courseId, question.getId(), question.getQuestionType(), "alice.b.tmms@gmail.tmt", null, "alice.b.tmms@gmail.tmt", null, null); BackDoor.createFeedbackResponse(fra); feedbackEditPage.reloadPage(); feedbackEditPage.isAlertClassEnabledForVisibilityOptions(1); ______TS("contrib: saving just after edit"); feedbackEditPage.clickEditQuestionButton(1); feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_EDITED); <START> feedbackEditPage.isAlertClassEnabledForVisibilityOptions(1); <END> feedbackEditPage.clickEditQuestionButton(1); feedbackEditPage.toggleNotSureCheck(1); feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.waitForConfirmationModalAndClickCancel(); feedbackEditPage.toggleNotSureCheck(1); feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_EDITED); feedbackEditPage.isAlertClassEnabledForVisibilityOptions(1); BackDoor.deleteFeedbackResponse(question.getId(), fra.giver, fra.recipient); feedbackEditPage.reloadPage(); }</code><technical_language>Is this necessary</technical_language>

Target:
protected void testDestructiveChanges() { FeedbackQuestionAttributes question = BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1); FeedbackResponseAttributes fra = new FeedbackResponseAttributes( feedbackSessionName, courseId, question.getId(), question.getQuestionType(), "alice.b.tmms@gmail.tmt", null, "alice.b.tmms@gmail.tmt", null, null); BackDoor.createFeedbackResponse(fra); feedbackEditPage.reloadPage(); assertTrue(feedbackEditPage.isAlertClassEnabledForVisibilityOptions(1)); ______TS("Contrib destructive changes: saving just after edit"); feedbackEditPage.clickEditQuestionButton(1); feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_EDITED); assertTrue(feedbackEditPage.isAlertClassEnabledForVisibilityOptions(1)); ______TS("Contrib destructive changes: testing \"not sure\" answer option"); feedbackEditPage.clickEditQuestionButton(1); feedbackEditPage.toggleNotSureCheck(1); feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.waitForConfirmationModalAndClickCancel(); feedbackEditPage.toggleNotSureCheck(1); feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_EDITED); assertTrue(feedbackEditPage.isAlertClassEnabledForVisibilityOptions(1)); BackDoor.deleteFeedbackResponse(question.getId(), fra.giver, fra.recipient); feedbackEditPage.reloadPage(); }