auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private String addKubernetesToTrustStore() throws IOException, FileNotFoundException, CertificateException, KeyStoreException, NoSuchAlgorithmException{ <END> String javaHome = System.getenv("JAVA_HOME"); String defaultTrustStorePath = javaHome + "/jre/lib/security/cacerts"; String destinationTrustStorePath = "/service/var/cacerts"; String certfile = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"; String alias = "kubernetes-root-ca-cert"; char[] password = "changeit".toCharArray(); File f = new File(certfile); if(f.exists() && !f.isDirectory()) { System.out.println("Detected Kubernetes Cert."); File source = new File(defaultTrustStorePath); File dest = new File(destinationTrustStorePath); Files.copy(source.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING); FileInputStream is = new FileInputStream(destinationTrustStorePath); KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(is, password); is.close(); CertificateFactory cf = CertificateFactory.getInstance("X.509"); InputStream certstream = getCertStream (certfile); Certificate certs = cf.generateCertificate(certstream); certstream.close(); keystore.setCertificateEntry(alias, certs); FileOutputStream out = new FileOutputStream(destinationTrustStorePath); keystore.store(out, password); out.close(); System.out.println("Created new TrustStore with Kubernetes Certificate"); return destinationTrustStorePath; } else{ System.out.println("Kubernetes CA cert not found. Skipping."); return defaultTrustStorePath; } }</code><technical_language>reasonable expect caller handle (or any) of these. wrap in RuntimeException handle method logging calling System.exit()</technical_language>

Target:
private String addKubernetesToTrustStore() { File certFile = new File("/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"); if (certFile.exists() && certFile.isFile()) { String javaHome = System.getProperty("java.home"); if (javaHome == null) { System.out.println("System Property java.home not set."); System.exit(STATUS_GENERIC_ERROR); } File sourceTS = new File(javaHome + "/lib/security/cacerts"); File destinationTS = new File(dataDir + "/var/cacerts"); String alias = "kubernetes-root-ca-cert"; char[] password = "changeit".toCharArray(); try (FileInputStream sourceIs = new FileInputStream(sourceTS); FileOutputStream destinationOs = new FileOutputStream(destinationTS); FileInputStream certIs = new FileInputStream(certFile)) { KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); keystore.load(sourceIs, password); BufferedInputStream bis = new BufferedInputStream(certIs); CertificateFactory cf = CertificateFactory.getInstance("X.509"); Certificate cert = cf.generateCertificate(bis); keystore.setCertificateEntry(alias, cert); keystore.store(destinationOs, password); } catch (KeyStoreException | IOException | CertificateException | NoSuchAlgorithmException e) { throw new RuntimeException("Configuring TLS TrustStore", e); } if (verbose) { System.out.println("Created new TrustStore with Kubernetes Certificate"); } return destinationTS.getAbsolutePath(); } else { return null; } }
Source:
<code>public MonotonicityAwareMailbox(MonotonicityAwareReceiver receiver, ReteContainer container) { this.receiver = receiver; this.container = container; this.tracker = container.getTracker(); this.monotoneQueue = new DefaultMailbox(null, null); <START> this.nonMonotoneQueue = <END> new DefaultMailbox(null, null); this.monotoneBuffer = new DefaultMailbox(null, null); this.antiMonotoneBuffer = new DefaultMailbox(null, null); this.deliveringMonotone = false; this.deliveringNonMonotone = false; }</code><technical_language>anti</technical_language>

Target:
public MonotonicityAwareMailbox(MonotonicityAwareReceiver receiver, ReteContainer container) { this.receiver = receiver; this.container = container; this.tracker = container.getTracker(); this.monotoneQueue = new DefaultMailbox(null, null); this.antiMonotoneQueue = new DefaultMailbox(null, null); this.monotoneBuffer = new DefaultMailbox(null, null); this.antiMonotoneBuffer = new DefaultMailbox(null, null); this.deliveringMonotone = false; this.deliveringAntiMonotone = false; }
Source:
<code>public void onClick(View arg0) { SharedPreferences.Editor edit = prefs.edit(); if (prefs.getInt("logimages", 1) == 0) { edit.putInt("logimages", 1); <START> settings.storeLogImg = 1; <END> } else { edit.putInt("logimages", 0); settings.storeLogImg = 0; } edit.commit(); CheckBox saveLogImgButton = (CheckBox) findViewById(R.id.save_log_img); if (prefs.getInt("logimages", 1) == 0) { saveLogImgButton.setChecked(false); } else { saveLogImgButton.setChecked(true); } return; }</code><technical_language>rename this storelogimages</technical_language>

Target:
public void onClick(View arg0) { SharedPreferences.Editor edit = prefs.edit(); if (prefs.getBoolean("logimages", true) == false) { edit.putBoolean("logimages", true); settings.storelogimages = true; } else { edit.putBoolean("logimages", false); settings.storelogimages = false; } edit.commit(); CheckBox saveLogImgButton = (CheckBox) findViewById(R.id.save_log_img); if (prefs.getBoolean("logimages", true) == false) { saveLogImgButton.setChecked(false); } else { saveLogImgButton.setChecked(true); } return; }
Source:
<code>public static boolean isFileOversizeWarningDisabled() { <START> if (CommCareApplication.instance().isConsumerApp()) { <END> return false; } SharedPreferences properties = CommCareApplication.instance().getCurrentApp().getAppPreferences(); return PrefValues.YES.equals(properties.getString(FILE_OVERSIZE_WARNING, PrefValues.NO)); }</code><technical_language>overiding for consumer apps</technical_language>

Target:
public static boolean isFileOversizeWarningDisabled() { SharedPreferences properties = CommCareApplication.instance().getCurrentApp().getAppPreferences(); return PrefValues.YES.equals(properties.getString(FILE_OVERSIZE_WARNING, PrefValues.NO)); }
Source:
<code>public void initialize(){ ScheduleExpression scheduleExpression = new ScheduleExpression(); <START> scheduleExpression.hour("*"); <END> scheduleExpression.minute("*"); scheduleExpression.second("*/5"); TimerConfig timerConfig = new TimerConfig(); timerConfig.setInfo("Every 5 second timer"); timerService.createCalendarTimer(scheduleExpression, timerConfig); }</code><technical_language>a cleaner builder pattern</technical_language>

Target:
public void initialize() { ScheduleExpression scheduleExpression = new ScheduleExpression() .hour("*") .minute("*") .second("*/5"); TimerConfig timerConfig = new TimerConfig(); timerConfig.setInfo("Every 5 second timer"); timerService.createCalendarTimer(scheduleExpression, timerConfig); }
Source:
<code><START> public Object getDimSelector() <END> { return selectorPlus.getSelector(); }</code><technical_language>This is cast DimensionSelector call sites, cast change return type DimensionSelector. Generifying buying if call sites cast anyway</technical_language>

Target:
public DimensionSelector getDimSelector() { return (DimensionSelector) selectorPlus.getSelector(); }
Source:
<code>protected void setFrameFocus(final IFrameDMContext newFrame, ImmediateRequestMonitor rm) { if (isThreadSuspended(getThreadFromFrame(newFrame))) { ICommand<MIInfo> command = fCommandFactory.createMIStackSelectFrame(newFrame, newFrame.getLevel()); fCommandControl.queueCommand(command, new ImmediateDataRequestMonitor<MIInfo>(rm) {}); } <START> fCurrentStackFrameCtx = newFrame; <END> }</code><technical_language>aslo set fCurrentThreadCtx</technical_language>

Target:
private void setFrameFocus(final IFrameDMContext newFrame, ImmediateRequestMonitor rm) { if (newFrame == null) { GdbPlugin.logErrorMessage("GdbSynchronizer unable to resolve frame context for the selected element"); return; } IExecutionDMContext newThread = getThreadFromFrame(newFrame); if (isThreadSuspended(newThread)) { ICommand<MIInfo> command = fCommandFactory.createMIStackSelectFrame(newFrame, newFrame.getLevel()); fCommandControl.queueCommand(command, new ImmediateDataRequestMonitor<MIInfo>(rm) {}); } fCurrentThreadCtx = newThread; fCurrentStackFrameCtx = newFrame; }
Source:
<code>public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fKernelAnalysisModule.getAnalysisRequirements(); assertNotNull(requirements); <START> assertTrue(requirements.iterator().hasNext()); <END> TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, domain); } Set<String> expectedEvents = ImmutableSet.of( LttngStrings.EXIT_SYSCALL, LttngStrings.IRQ_HANDLER_ENTRY, LttngStrings.IRQ_HANDLER_EXIT, LttngStrings.SOFTIRQ_ENTRY, LttngStrings.SOFTIRQ_EXIT, LttngStrings.SOFTIRQ_RAISE, LttngStrings.SCHED_SWITCH, LttngStrings.SCHED_PROCESS_FORK, LttngStrings.SCHED_PROCESS_EXIT, LttngStrings.SCHED_PROCESS_FREE, LttngStrings.STATEDUMP_PROCESS_STATE, LttngStrings.SCHED_WAKEUP, LttngStrings.SCHED_WAKEUP_NEW, LttngStrings.SYSCALL_PREFIX ); assertEquals(14, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } }</code><technical_language>Assert necessary elements counted</technical_language>

Target:
public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fKernelAnalysisModule.getAnalysisRequirements(); assertNotNull(requirements); TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, domain); } Set<String> expectedEvents = ImmutableSet.of( LttngStrings.EXIT_SYSCALL, LttngStrings.IRQ_HANDLER_ENTRY, LttngStrings.IRQ_HANDLER_EXIT, LttngStrings.SOFTIRQ_ENTRY, LttngStrings.SOFTIRQ_EXIT, LttngStrings.SOFTIRQ_RAISE, LttngStrings.SCHED_SWITCH, LttngStrings.SCHED_PROCESS_FORK, LttngStrings.SCHED_PROCESS_EXIT, LttngStrings.SCHED_PROCESS_FREE, LttngStrings.STATEDUMP_PROCESS_STATE, LttngStrings.SCHED_WAKEUP, LttngStrings.SCHED_WAKEUP_NEW, LttngStrings.SYSCALL_PREFIX ); assertEquals(14, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } }
Source:
<code>public <START> Iterator<IRefactorParticipant> <END> getRefactorParticipants() { return refactorParticipantsList.iterator(); }</code><technical_language>Iterable a more useful type</technical_language>

Target:
public List<IRefactorParticipant> getRefactorParticipants() { return Collections.unmodifiableList(refactorParticipantsList); }
Source:
<code>private String[] makeAccessibleHorizontalLabels(String[] horizontalLabels) { String[] accessibleLabels = new String[horizontalLabels.length]; for (int i = 0; i < horizontalLabels.length; i++) { if (getTimeframe() == StatsTimeframe.MONTH) { accessibleLabels[i] = StatsUtils.parseDate(horizontalLabels[i], "MMM", "MMMM"); } else if (getTimeframe() == StatsTimeframe.WEEK) { <START> accessibleLabels[i] = getString(R.string.stats_bar_week_desc, horizontalLabels[i]); <END> } else { accessibleLabels[i] = horizontalLabels[i]; } } return accessibleLabels; }</code><technical_language>suggest parsing week "MMM" "MMMM" in this case. TalkBack is smart in English reads automatically full month name, works some languages (doesn't work Czech)</technical_language>

Target:
private String[] makeAccessibleHorizontalLabels(String[] horizontalLabels) { String[] accessibleLabels = new String[horizontalLabels.length]; for (int i = 0; i < horizontalLabels.length; i++) { if (getTimeframe() == StatsTimeframe.MONTH) { accessibleLabels[i] = StatsUtils.parseDate( horizontalLabels[i], StatsConstants.STATS_OUTPUT_DATE_MONTH_SHORT_FORMAT, StatsConstants.STATS_OUTPUT_DATE_MONTH_LONG_FORMAT); } else if (getTimeframe() == StatsTimeframe.WEEK) { accessibleLabels[i] = getString(R.string.stats_bar_week_desc, StatsUtils.parseDate( horizontalLabels[i], StatsConstants.STATS_OUTPUT_DATE_MONTH_SHORT_DAY_SHORT_FORMAT, StatsConstants.STATS_OUTPUT_DATE_MONTH_LONG_DAY_SHORT_FORMAT)); } else { accessibleLabels[i] = horizontalLabels[i]; } } return accessibleLabels; }
Source:
<code>public static File urlToFile(URL url) { if (!"file".equals(url.getProtocol())) { return null; } String string = url.toString(); if (url.getQuery() != null) { string = string.substring(0, string.indexOf("?")); } if (string.contains("+")) { string = string.replace("+", "%2B"); } try { string = URLDecoder.decode(string, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Could not decode the URL to UTF-8 format", e); } String path3; String simplePrefix = "file:/"; String standardPrefix = "file://"; if (IS_WINDOWS_OS && string.startsWith(standardPrefix)) { path3 = string.substring(standardPrefix.length() - 2); File f = new File(path3); if (!f.exists()) { path3 = path3.substring(2, path3.length()); } } else if (string.startsWith(standardPrefix)) { path3 = string.substring(standardPrefix.length()); } else if (string.startsWith(simplePrefix)) { path3 = string.substring(simplePrefix.length() - 1); } else { String auth = url.getAuthority(); String path2 = url.getPath(); try { path2 = URLDecoder.decode(path2, "UTF-8"); } catch (UnsupportedEncodingException e) { <START> throw new RuntimeException("Could not decode the URL to UTF-8 format", e); <END> } if (auth != null && !auth.equals("")) { path3 = " } else { path3 = path2; } } return new File(path3); }</code><technical_language>Throwing a runtime exception a bit severe. However, I is method is for a similar failure earlier, WC3 spec URL encoding is assumed UTF-8. I a bit concerned this problems, OK</technical_language>

Target:
public static File urlToFile(URL url) { if (!"file".equals(url.getProtocol())) { return null; } String string = url.toString(); if (url.getQuery() != null) { string = string.substring(0, string.indexOf("?")); } if (string.contains("+")) { string = string.replace("+", "%2B"); } try { string = URLDecoder.decode(string, java.nio.charset.StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("UTF-8 encoding not supported", e); } String path3; String simplePrefix = "file:/"; String standardPrefix = "file://"; if (IS_WINDOWS_OS && string.startsWith(standardPrefix)) { path3 = string.substring(standardPrefix.length() - 2); File f = new File(path3); if (!f.exists()) { path3 = path3.substring(2, path3.length()); } } else if (string.startsWith(standardPrefix)) { path3 = string.substring(standardPrefix.length()); } else if (string.startsWith(simplePrefix)) { path3 = string.substring(simplePrefix.length() - 1); } else { String auth = url.getAuthority(); String path2 = url.getPath(); try { path2 = URLDecoder.decode(path2, java.nio.charset.StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("UTF-8 encoding not supported", e); } if (auth != null && !auth.equals("")) { path3 = " } else { path3 = path2; } } return new File(path3); }
Source:
<code><START> public static InternalCompletableFuture newCompletedFuture(Object result) { <END> InternalCompletableFuture future = new InternalCompletableFuture(); future.complete(result); return future; }</code><technical_language>WDYT adding a type parameter methods this (public static <V> InternalCompletableFuture<V> ...), amount of "Unchecked assignment" warnings in code base</technical_language>

Target:
public static <V> InternalCompletableFuture<V> newCompletedFuture(Object result) { InternalCompletableFuture future = new InternalCompletableFuture(); future.complete(result); return future; }
Source:
<code>public void validateSectionsAndTeams(List<StudentAttributes> studentList, String courseId) throws EntityDoesNotExistException, EnrollException { List<StudentAttributes> mergedList = getMergedList(studentList, courseId); if (mergedList.size() < 2) { return; } String errorMessage = new StringBuilder() .append(getSectionInvalidityInfo(mergedList)) .append(getTeamInvalidityInfo(mergedList)) <START> .toString(); <END> if (!errorMessage.isEmpty()) { throw new EnrollException(errorMessage); } }</code><technical_language>This is simply String errorMessage = ... + ... right</technical_language>

Target:
public void validateSectionsAndTeams(List<StudentAttributes> studentList, String courseId) throws EntityDoesNotExistException, EnrollException { List<StudentAttributes> mergedList = getMergedList(studentList, courseId); if (mergedList.size() < 2) { return; } String errorMessage = getSectionInvalidityInfo(mergedList) + getTeamInvalidityInfo(mergedList); if (!errorMessage.isEmpty()) { throw new EnrollException(errorMessage); } }
Source:
<code>public void validateField(String name, Object o) { if (o == null) { throw new IllegalArgumentException("Field " + name + " must be set."); } HashMap<String, Exception> validatorExceptions = new HashMap<>(); Set<String> selectedValidators = new HashSet<>(); for (Class<?> vv : subValidators) { Object valueValidator; try { valueValidator = vv.getConstructor().newInstance(); } catch (Exception ex) { throw new IllegalArgumentException(vv.getName() + " instantiation failure", ex); } if (valueValidator instanceof Validator) { try { ((Validator) valueValidator).validateField(name + " " + vv.getSimpleName() + " value", o); selectedValidators.add(vv.getName()); } catch (Exception ex) { validatorExceptions.put(vv.getName(), ex); } } else { String err = String.format("validator: %s cannot be used in CustomExactlyOneOfValidators to validate values. " <START> + "Individual entry validators must a instance of Validator class", vv.getName()); <END> LOG.warn(err); } } if (selectedValidators.isEmpty()) { String parseErrs = String.join(";\n\t", validatorExceptions.entrySet().stream() .map(e -> String.format("%s:%s", e.getKey(), e.getValue())).collect(Collectors.toList())); String err = String.format("Field %s must be one of %s; parse errors are \n\t%s", name, String.join(", ", validatorClassNames), parseErrs); throw new IllegalArgumentException(err); } if (selectedValidators.size() > 1) { throw new IllegalArgumentException("Field " + name + " must match exactly one of " + String.join(", ", selectedValidators)); } }</code><technical_language>typo: missing 'be" in "must a instance"</technical_language>

Target:
public void validateField(String name, Object o) { if (o == null) { return; } HashMap<String, Exception> validatorExceptions = new HashMap<>(); Set<String> selectedValidators = new HashSet<>(); for (Class<?> vv : subValidators) { Object valueValidator; try { valueValidator = vv.getConstructor().newInstance(); } catch (Exception ex) { throw new IllegalArgumentException(vv.getName() + " instantiation failure", ex); } if (valueValidator instanceof Validator) { try { ((Validator) valueValidator).validateField(name + " " + vv.getSimpleName() + " value", o); selectedValidators.add(vv.getName()); } catch (Exception ex) { validatorExceptions.put(vv.getName(), ex); } } else { String err = String.format("validator: %s cannot be used in CustomExactlyOneOfValidators to validate values. " + "Individual entry validators must a instance of Validator class", vv.getName()); LOG.warn(err); } } if (selectedValidators.isEmpty()) { String parseErrs = String.join(";\n\t", validatorExceptions.entrySet().stream() .map(e -> String.format("%s:%s", e.getKey(), e.getValue())).collect(Collectors.toList())); String err = String.format("Field %s must be one of %s; parse errors are \n\t%s", name, String.join(", ", validatorClassNames), parseErrs); throw new IllegalArgumentException(err); } if (selectedValidators.size() > 1) { throw new IllegalArgumentException("Field " + name + " must match exactly one of " + String.join(", ", selectedValidators)); } }
Source:
<code>public static void check( final PsiElement erroredElement, final HaxeTypeTag tag, final HaxeVarInit initExpression, boolean requireConstant, final AnnotationHolder holder ) { final ResultHolder type1 = HaxeTypeResolver.getTypeFromTypeTag(tag, erroredElement); ResultHolder t2 = HaxeTypeResolver.getPsiElementType(initExpression); ResultHolder aeExpr = HaxeAbstractEnumUtil.getStaticMemberExpression(initExpression.getExpression()); if(aeExpr != null) { t2 = aeExpr; } <START> final ResultHolder type2 = t2; <END> final HaxeDocumentModel document = HaxeDocumentModel.fromElement(tag); if (!type1.canAssign(type2)) { Annotation annotation = holder.createErrorAnnotation(erroredElement, "Incompatible type " + type1 + " can't be assigned from " + type2); annotation.registerFix(new HaxeFixer("Change type") { @Override public void run() { document.replaceElementText(tag, ":" + type2.toStringWithoutConstant()); } }); annotation.registerFix(new HaxeFixer("Remove init") { @Override public void run() { document.replaceElementText(initExpression, "", StripSpaces.BEFORE); } }); } else if (requireConstant && type2.getType().getConstant() == null) { holder.createErrorAnnotation(erroredElement, "Parameter default type should be constant but was " + type2); } }</code><technical_language>asking change this. IMO, worth creating another variable get 'final' designation. once</technical_language>

Target:
public static void check( final PsiElement erroredElement, final HaxeTypeTag tag, final HaxeVarInit initExpression, boolean requireConstant, final AnnotationHolder holder ) { final ResultHolder type1 = HaxeTypeResolver.getTypeFromTypeTag(tag, erroredElement); final ResultHolder type2 = getTypeFromVarInit(initExpression); final HaxeDocumentModel document = HaxeDocumentModel.fromElement(tag); if (!type1.canAssign(type2)) { Annotation annotation = holder.createErrorAnnotation(erroredElement, "Incompatible type " + type1 + " can't be assigned from " + type2); annotation.registerFix(new HaxeFixer("Change type") { @Override public void run() { document.replaceElementText(tag, ":" + type2.toStringWithoutConstant()); } }); annotation.registerFix(new HaxeFixer("Remove init") { @Override public void run() { document.replaceElementText(initExpression, "", StripSpaces.BEFORE); } }); } else if (requireConstant && type2.getType().getConstant() == null) { holder.createErrorAnnotation(erroredElement, "Parameter default type should be constant but was " + type2); } }
Source:
<code>public List<SeriesInfoDto> findByMichelNumber(String michelNumberCode, String lang) { Validate.isTrue(michelNumberCode != null, "Michel number code must be non null"); Validate.isTrue(!michelNumberCode.trim().isEmpty(), "Michel number code must be non empty"); List<Integer> seriesIds = seriesDao.findSeriesIdsByMichelNumberCode(michelNumberCode); return seriesIds.isEmpty() ? Collections.emptyList() <START> : seriesDao.findByIdsAsSeriesInfo(seriesIds, lang); <END> }</code><technical_language>Ah, CheckStyle allows it? Rewrite long more readable form: java if (result.IsEmpty) { return emptyList; } return callDao();</technical_language>

Target:
public List<SeriesInfoDto> findByMichelNumber(String michelNumberCode, String lang) { Validate.isTrue(michelNumberCode != null, "Michel number code must be non null"); Validate.isTrue(!michelNumberCode.trim().isEmpty(), "Michel number code must be non empty"); List<Integer> seriesIds = seriesDao.findSeriesIdsByMichelNumberCode(michelNumberCode); if (seriesIds.isEmpty()) { return Collections.emptyList(); } return seriesDao.findByIdsAsSeriesInfo(seriesIds, lang); }
Source:
<code>protected void writeApplicabilityScope(IRequirement[][] capabilities) { start(APPLICABILITY_SCOPE); for (IRequirement[] <START> capabilitie : <END> capabilities) { start(APPLY_ON); writeRequirements(Arrays.asList(capabilitie)); end(APPLY_ON); } end(APPLICABILITY_SCOPE); }</code><technical_language>capability name</technical_language>

Target:
protected void writeApplicabilityScope(IRequirement[][] capabilities) { start(APPLICABILITY_SCOPE); for (IRequirement[] capability : capabilities) { start(APPLY_ON); writeRequirements(Arrays.asList(capability)); end(APPLY_ON); } end(APPLICABILITY_SCOPE); }
Source:
<code>private static List<? extends IPAddress> getDhcpRouters(String interfaceName, IPAddress address) { List<IPAddress> routers = null; if (address != null) { <START> DhcpClientLeases dhcpClientLeases = DhcpClientLeases.getInstance(); <END> try { routers = dhcpClientLeases.getDhcpGateways(interfaceName, address); } catch (KuraException e) { logger.error("Error getting DHCP DNS servers", e); } } if (routers == null) { routers = new ArrayList<>(); } return routers; }</code><technical_language>This approach more difficult test. Consider e.g. protected DhcpClientLeases getDhcpClientLeases() a static injectable variable</technical_language>

Target:
private List<? extends IPAddress> getDhcpRouters(String interfaceName, IPAddress address) { List<IPAddress> routers = null; if (address != null) { DhcpClientLeases dhcpClientLeases = getDhcpClientLeases(); try { routers = dhcpClientLeases.getDhcpGateways(interfaceName, address); } catch (KuraException e) { logger.error("Error getting DHCP DNS servers", e); } } if (routers == null) { routers = new ArrayList<>(); } return routers; }
Source:
<code>protected void sleepJobInfo(JobInfo info) { if (isInfrastructureJob(info.getJob())) return; GroupInfo group = info.getGroupInfo(); if (group != null) { sleepGroup(group,info); } Object[] listenersArray = listeners.getListeners(); <START> for (Object element : listenersArray) { <END> IJobProgressManagerListener listener = (IJobProgressManagerListener) element; if (isNeverDisplaying(info.getJob(), listener.showsDebug())) continue; if (listener.showsDebug()) listener.refreshJobInfo(info); else listener.removeJob(info); } }</code><technical_language>inline listeners.getListeners()</technical_language>

Target:
protected void sleepJobInfo(JobInfo info) { if (isInfrastructureJob(info.getJob())) return; GroupInfo group = info.getGroupInfo(); if (group != null) { sleepGroup(group,info); } for (Object element : listeners.getListeners()) { IJobProgressManagerListener listener = (IJobProgressManagerListener) element; if (isNeverDisplaying(info.getJob(), listener.showsDebug())) continue; if (listener.showsDebug()) listener.refreshJobInfo(info); else listener.removeJob(info); } }
Source:
<code>private boolean isPartitionRequired(int opid, List<KafkaConsumer.KafkaMeterStats> kstats) { long t = System.currentTimeMillis(); if (kstats.size() > 0) { logger.debug("Checking offset updates for offset manager"); updateOffsets(kstats); } if (t - lastCheckTime < repartitionCheckInterval) { return false; } if(repartitionInterval < 0){ return false; } if(t - lastRepartitionTime < repartitionInterval) { return false; } kafkaStatsHolder.put(opid, kstats); if (kafkaStatsHolder.size() != currentPartitionInfo.size() || currentPartitionInfo.size() == 0) { return false; } try { { Set<KafkaPartition> existingIds = new HashSet<KafkaPartition>(); for (PartitionInfo pio : currentPartitionInfo) { existingIds.addAll(pio.kpids); } Map<String, List<PartitionMetadata>> partitionsMeta = KafkaMetadataUtil.getPartitionsForTopic(consumer.brokers, consumer.getTopic()); if(partitionsMeta == null){ return false; } for (Map.Entry<String, List<PartitionMetadata>> en : partitionsMeta.entrySet()) { if(en.getValue() == null){ continue; } for (PartitionMetadata pm : en.getValue()) { KafkaPartition pa = new KafkaPartition(en.getKey(), consumer.topic, pm.partitionId()); if(!existingIds.contains(pa)){ newWaitingPartition.add(pa); } } } if (newWaitingPartition.size() != 0) { lastRepartitionTime = t; return true; } } if (strategy == PartitionStrategy.ONE_TO_ONE) { return false; } <START> if (!isPartitionBasedOnLoad) { <END> return false; } boolean b = breakHardConstraint(kstats) || breakSoftConstraint(); return b; } finally { lastCheckTime = System.currentTimeMillis(); } }</code><technical_language>this line involved. If is new kafka partition, return true line 829. new kafka partition added waiting list</technical_language>

Target:
private boolean isPartitionRequired(int opid, List<KafkaConsumer.KafkaMeterStats> kstats) { long t = System.currentTimeMillis(); if (kstats.size() > 0) { logger.debug("Checking offset updates for offset manager"); updateOffsets(kstats); } if (t - lastCheckTime < repartitionCheckInterval) { return false; } if(repartitionInterval < 0){ return false; } if(t - lastRepartitionTime < repartitionInterval) { return false; } kafkaStatsHolder.put(opid, kstats); if (kafkaStatsHolder.size() != currentPartitionInfo.size() || currentPartitionInfo.size() == 0) { return false; } try { { Set<KafkaPartition> existingIds = new HashSet<KafkaPartition>(); for (PartitionInfo pio : currentPartitionInfo) { existingIds.addAll(pio.kpids); } Map<String, List<PartitionMetadata>> partitionsMeta = KafkaMetadataUtil.getPartitionsForTopic(consumer.brokers, consumer.getTopic()); if(partitionsMeta == null){ return false; } for (Map.Entry<String, List<PartitionMetadata>> en : partitionsMeta.entrySet()) { if(en.getValue() == null){ continue; } for (PartitionMetadata pm : en.getValue()) { KafkaPartition pa = new KafkaPartition(en.getKey(), consumer.topic, pm.partitionId()); if(!existingIds.contains(pa)){ newWaitingPartition.add(pa); } } } if (newWaitingPartition.size() != 0) { lastRepartitionTime = t; return true; } } return false; } finally { lastCheckTime = System.currentTimeMillis(); } }
Source:
<code>public void doTransactionScan(DB db) { int keynum = nextKeynum(); String startk = null; String comparable = null; if(startkeyname.equals("true")) { keynum = nextKeynum(); startk = buildKeyName(keynum); } else startk = "false"; int len = scanlength.nextValue().intValue(); HashSet<String> fields = null; if(is_filter.equals("true")) { String compOperation = doCompareOperation(); <START> if (comparevalue.equals("false")) { <END> keynum = nextKeynum(); comparable = buildKeyName(keynum); } else comparable = comparevalue; fields = new HashSet<>(); fields.add("isFilter#true:"+compOperation+":"+comparable); } else { if (!readallfields) { String fieldname = fieldnames.get(fieldchooser.nextValue().intValue()); fields = new HashSet<String>(); fields.add(fieldname); } } db.scan(table, startkeyname, len, fields, new Vector<HashMap<String, ByteIterator>>()); }</code><technical_language>null instead of "false" default value</technical_language>

Target:
public void doTransactionScan(DB db) { int keynum = nextKeynum(); String startk = null; String comparable = null; if(startkeyname != null) { keynum = nextKeynum(); startk = buildKeyName(keynum); } else startk = "false"; int len = scanlength.nextValue().intValue(); HashSet<String> fields = null; if(is_filter != null) { String compOperation = doCompareOperation(); if (comparevalue == null) { keynum = nextKeynum(); comparable = buildKeyName(keynum); } else comparable = comparevalue; fields = new HashSet<>(); fields.add("isFilter#true:"+compOperation+":"+comparable); } else { if (!readallfields) { String fieldname = fieldnames.get(fieldchooser.nextValue().intValue()); fields = new HashSet<String>(); fields.add(fieldname); } } db.scan(table, startk, len, fields, new Vector<HashMap<String, ByteIterator>>()); }
Source:
<code>public void createNetworkSecurityGroup() throws InterruptedException { NetworkSecurityGroup nsg = createGroup(); server.enqueue(jsonResponse("/networksecuritygroupcreate.json").setResponseCode(200)); final NetworkSecurityGroupApi nsgApi = api.getNetworkSecurityGroupApi(resourcegroup); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/networkSecurityGroups/%s?%s", subscriptionid, resourcegroup, DEFAULT_NSG_NAME, apiVersion); NetworkSecurityGroup result = nsgApi.createOrUpdate(DEFAULT_NSG_NAME, "westus", null, nsg.properties()); <START> assertSent(server, "PUT", path); <END> assertEquals(result.name(), DEFAULT_NSG_NAME); assertEquals(result.location(), "westus"); assertEquals(result.properties().securityRules().size(), 1); assertEquals(result.properties().securityRules().get(0).properties().protocol(), Protocol.Tcp); }</code><technical_language>verify body generated</technical_language>

Target:
public void createNetworkSecurityGroup() throws InterruptedException { NetworkSecurityGroup nsg = createGroup(); server.enqueue(jsonResponse("/networksecuritygroupcreate.json").setResponseCode(200)); final NetworkSecurityGroupApi nsgApi = api.getNetworkSecurityGroupApi(resourcegroup); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/networkSecurityGroups/%s?%s", subscriptionid, resourcegroup, DEFAULT_NSG_NAME, apiVersion); String json = String.format("{\"location\":\"%s\",\"properties\":%s}", "westus", new Gson().toJson(nsg.properties())); NetworkSecurityGroup result = nsgApi.createOrUpdate(DEFAULT_NSG_NAME, "westus", null, nsg.properties()); assertSent(server, "PUT", path, json); assertEquals(result.name(), DEFAULT_NSG_NAME); assertEquals(result.location(), "westus"); assertEquals(result.properties().securityRules().size(), 1); assertEquals(result.properties().securityRules().get(0).properties().protocol(), Protocol.Tcp); }
Source:
<code>public WebSocketPanelSender() { connectedProxies = new HashMap<>(); closedProxies= new HashMap<>(); <START> this.webSocketReopenSend = webSocketReopenSend; <END> }</code><technical_language>Is this necessary? passed constructor change value</technical_language>

Target:
public WebSocketPanelSender() { connectedProxies = new HashMap<>(); closedProxies= new HashMap<>(); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ServiceV3AuthsPostRequest)) return false; ServiceV3AuthsPostRequest that = (ServiceV3AuthsPostRequest) o; return Objects.equals(getUsername(), that.getUsername()) && Objects.equals(getPolicy(), that.getPolicy()) && Objects.equals(getContext(), that.getContext()) && Objects.equals(getTitle(), that.getTitle()) && <START> Objects.equals(ttl, that.ttl); <END> }</code><technical_language>I assume this comparison a getter well</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ServiceV3AuthsPostRequest)) return false; ServiceV3AuthsPostRequest that = (ServiceV3AuthsPostRequest) o; return Objects.equals(getUsername(), that.getUsername()) && Objects.equals(getPolicy(), that.getPolicy()) && Objects.equals(getContext(), that.getContext()) && Objects.equals(getTitle(), that.getTitle()) && Objects.equals(getTTL(), that.getTTL()); }
Source:
<code>public boolean isValid(TreeReference ref, QueryContext context) { if(ref == null) { return false; } else { ModelQuerySet set = context.getQueryCache(QuerySetCache.class).getModelQuerySet(CurrentModelQuerySet.CURRENT_QUERY_SET_ID); if (set == null) { return false; } <START> return true; <END> } }</code><technical_language>of tests in CaseDbQueryTests handle condition this Lookup is valid (and of other tests cover this code path)</technical_language>

Target:
public boolean isValid(TreeReference ref, QueryContext context) { if(ref == null) { return false; } else { ModelQuerySet set = context.getQueryCache(QuerySetCache.class).getModelQuerySet(CurrentModelQuerySet.CURRENT_QUERY_SET_ID); return set != null; } }
Source:
<code>public TokenAuthenticationFilterTest() throws IOException, ServletException { filterChain = mock(FilterChain.class); doAnswer(invocationOnMock -> { capturedContext.set(SecurityContextHolder.getContext()); return null; }).when(filterChain).doFilter(any(), any()); response = mock(HttpServletResponse.class); request = mock(HttpServletRequest.class); <START> filter = new TokenAuthenticationFilter(DigestUtils.sha256Hex("myToken"), "X_TALEND_TOKEN", "AUTH1, AUTH2"); <END> }</code><technical_language>consistent doc (missing _ADMIN; other instances of below)</technical_language>

Target:
public TokenAuthenticationFilterTest() throws IOException, ServletException { filterChain = mock(FilterChain.class); doAnswer(invocationOnMock -> { capturedAuthentication.set(SecurityContextHolder.getContext().getAuthentication()); return null; }).when(filterChain).doFilter(any(), any()); response = mock(HttpServletResponse.class); request = mock(HttpServletRequest.class); when(request.getServletPath()).thenReturn("/actuator/prometheus"); final RequestMatcher requestMatcher = new AntPathRequestMatcher("/actuator/**"); filter = new TokenAuthenticationFilter("myToken", requestMatcher); }
Source:
<code>private void initCommandExecutor() { if (!cmdExecutorInitialized) { <START> synchronized(LOCK) { <END> if (!cmdExecutorInitialized) { for (CommandEntity cmdEntity : coco.getCommandsWithCallBackEnabled()) { switch(cmdEntity.getCommandStatus()) { case ACTIVE_SYNC: case NOT_STARTED: coco.retrieveCommand(cmdEntity.getId()).setCommandStatus(CommandStatus.FAILED_RESTARTED); break; default: if (!cmdEntity.isCallBackNotified()) { addToCallBackMap(cmdEntity); } break; } } cmdExecutorInitialized = true; } } } }</code><technical_language>please rebase, arik removed lock in a patch</technical_language>

Target:
private void initCommandExecutor() { if (!cmdExecutorInitialized) { for (CommandEntity cmdEntity : coco.getCommandsWithCallBackEnabled()) { switch(cmdEntity.getCommandStatus()) { case ACTIVE_SYNC: case NOT_STARTED: coco.retrieveCommand(cmdEntity.getId()).setCommandStatus(CommandStatus.FAILED_RESTARTED); break; default: if (!cmdEntity.isCallBackNotified()) { addToCallBackMap(cmdEntity); } break; } } cmdExecutorInitialized = true; } }
Source:
<code>private static void parseEndpointElement(final ConfigurationXMLStreamReader reader, final EndpointBuilder builder) throws ConfigXMLParseException { final int attributeCount = reader.getAttributeCount(); int readTimeout = -1; int writeTimeout = -1; boolean tcpKeepAlive = false; boolean setTcpKeepAlive = false; int heartbeatInterval = -1; for (int i = 0; i < attributeCount; i++) { checkAttributeNamespace(reader, i); switch (reader.getAttributeLocalName(i)) { case "name": { builder.setEndpointName(reader.getAttributeValueResolved(i)); break; } case "read-timeout": { readTimeout = reader.getIntAttributeValueResolved(i, 0, Integer.MAX_VALUE); break; } case "write-timeout": { writeTimeout = reader.getIntAttributeValueResolved(i, 0, Integer.MAX_VALUE); break; } case "tcp-keepalive": { setTcpKeepAlive = true; tcpKeepAlive = reader.getBooleanAttributeValueResolved(i); break; } case "heartbeat-interval": { heartbeatInterval = reader.getIntAttributeValueResolved(i, 0, Integer.MAX_VALUE); break; } default: { throw reader.unexpectedAttribute(i); } } } OptionMap.Builder optionMapBuilder = OptionMap.builder(); if (readTimeout != -1L) { optionMapBuilder.set(Options.READ_TIMEOUT, readTimeout); } if (writeTimeout != -1L) { optionMapBuilder.set(Options.WRITE_TIMEOUT, writeTimeout); } if (setTcpKeepAlive) { optionMapBuilder.set(Options.KEEP_ALIVE, tcpKeepAlive); } if (heartbeatInterval != -1) { optionMapBuilder.set(RemotingOptions.HEARTBEAT_INTERVAL, heartbeatInterval); } <START> builder.buildDefaultConnectionsOptionMap(optionMapBuilder.getMap()); <END> while (reader.hasNext()) { switch (reader.nextTag()) { case START_ELEMENT: { checkElementNamespace(reader); switch (reader.getLocalName()) { case "providers": { parseProvidersElement(reader, builder); break; } case "connections": { parseConnectionsElement(reader, builder); break; } default: throw reader.unexpectedElement(); } break; } case END_ELEMENT: { return; } } } throw reader.unexpectedDocumentEnd(); }</code><technical_language>builder.setDefaultConnectionsOptionMap a more name here, slight difference in behavior this method compared simpler setEndpointName, for example</technical_language>

Target:
private static void parseEndpointElement(final ConfigurationXMLStreamReader reader, final EndpointBuilder builder) throws ConfigXMLParseException { if( reader.hasNamespace()) { switch (reader.getNamespaceURI()) { case NS_REMOTING_5_0:{ parseEndpointElement50(reader, builder); break; } case NS_REMOTING_5_1: { parseEndpointElement51(reader, builder); break; } default: { throw reader.unexpectedElement(); } } while (reader.hasNext()) { switch (reader.nextTag()) { case START_ELEMENT: { checkElementNamespace(reader); switch (reader.getLocalName()) { case "providers": { parseProvidersElement(reader, builder); break; } case "connections": { parseConnectionsElement(reader, builder); break; } default: throw reader.unexpectedElement(); } break; } case END_ELEMENT: { return; } } } throw reader.unexpectedDocumentEnd(); } else { throw reader.unexpectedDocumentEnd(); } }
Source:
<code><START> private void decodeBigInteger(int value) throws Exception { <END> boolean done = false; while (!done) { long lowBits = 0; while (value > 0 && !done) { int b = value & 0xFF; if (b == 0) { done = true; if (lowBits == 0) { } } else if (b != 0xFF) { if (value == 1) { int digit = (b >>> 4) & 0x0F; lowBits = lowBits * 10 + digit; } } value++; } lowBits = -lowBits; } }</code><technical_language>Test case simplified</technical_language>

Target:
private void decodeBigInteger(int value) throws Exception { long lowBits = 0; while (value > 0) { int b = value & 1; if (b == 0) { if (lowBits == 0) { } } else { lowBits += b; } } lowBits = -lowBits; }
Source:
<code>public void establishTopology(String containerName, String cacheName, long timeout, String... nodes) throws InterruptedException { Set<String> expectedMembers = Stream.of(nodes).sorted().collect(Collectors.toSet()); Cache<?, ?> cache = findCache(containerName, cacheName); if (cache == null) { throw new IllegalStateException(String.format("Cache %s.%s not found", containerName, cacheName)); } cache.addListener(this); try { synchronized (this) { DistributionManager dist = cache.getAdvancedCache().getDistributionManager(); LocalizedCacheTopology topology = dist.getCacheTopology(); Set<String> members = getMembers(topology); long start = System.currentTimeMillis(); long now = start; long endTime = start + timeout; while (!expectedMembers.equals(members)) { <START> logger.debugf("%s != %s, waiting for a topology change event. Current topology id = %d", expectedMembers, members, topology.getTopologyId()); <END> this.wait(endTime - now); now = System.currentTimeMillis(); if (now >= endTime) { throw new InterruptedException(String.format("Cache %s/%s failed to establish view %s within %d ms. Current view is: %s", containerName, cacheName, expectedMembers, timeout, members)); } topology = dist.getCacheTopology(); members = getMembers(topology); } logger.debugf("Cache %s/%s successfully established view %s within %d ms. Topology id = %d", containerName, cacheName, expectedMembers, now - start, topology.getTopologyId()); } } finally { cache.removeListener(this); } }</code><technical_language>I need INFO debugging. @pferraro agree</technical_language>

Target:
public void establishTopology(String containerName, String cacheName, long timeout, String... nodes) throws InterruptedException { Set<String> expectedMembers = Stream.of(nodes).sorted().collect(Collectors.toSet()); Cache<?, ?> cache = findCache(containerName, cacheName); if (cache == null) { throw new IllegalStateException(String.format("Cache %s.%s not found", containerName, cacheName)); } cache.addListener(this); try { synchronized (this) { DistributionManager dist = cache.getAdvancedCache().getDistributionManager(); LocalizedCacheTopology topology = dist.getCacheTopology(); Set<String> members = getMembers(topology); long start = System.currentTimeMillis(); long now = start; long endTime = start + timeout; while (!expectedMembers.equals(members)) { logger.infof("%s != %s, waiting for a topology change event. Current topology id = %d", expectedMembers, members, topology.getTopologyId()); this.wait(endTime - now); now = System.currentTimeMillis(); if (now >= endTime) { throw new InterruptedException(String.format("Cache %s/%s failed to establish view %s within %d ms. Current view is: %s", containerName, cacheName, expectedMembers, timeout, members)); } topology = dist.getCacheTopology(); members = getMembers(topology); } logger.infof("Cache %s/%s successfully established view %s within %d ms. Topology id = %d", containerName, cacheName, expectedMembers, now - start, topology.getTopologyId()); } } finally { cache.removeListener(this); } }
Source:
<code>public boolean hasNext() { if (delegate.hasNext()) { <START> if (limit >= totalItems + returnOneIfNextRowIsNew()) { <END> return true; } } return false; }</code><technical_language>int-returning method getTotalItems() like: if (nextRowIsNew()) { return totalItems + 1; } else { return totalItems; }</technical_language>

Target:
public boolean hasNext() { if (delegate.hasNext()) { if (limit >= totalItemsWithNextEntry()) { return true; } } return false; }
Source:
<code>public HttpResponse execute(HttpUriRequest request) throws IOException { HttpClientContext clientContext = HttpClientContext.create(); <START> if(clientContext.getAttribute(ORIGINAL_HOST_CONTEXT_PARAM) == null) { <END> clientContext.setAttribute(ORIGINAL_HOST_CONTEXT_PARAM, request.getURI().getHost()); } if (StringUtils.isNotEmpty(accessToken)) { clientContext.setUserToken(accessToken); } return httpClient.execute(request, clientContext); }</code><technical_language>Missing white-space **if**</technical_language>

Target:
public HttpResponse execute(HttpUriRequest request) throws IOException { HttpClientContext clientContext = HttpClientContext.create(); if (clientContext.getAttribute(PreemptiveAuthInterceptor.ORIGINAL_HOST_CONTEXT_PARAM) == null) { clientContext.setAttribute(PreemptiveAuthInterceptor.ORIGINAL_HOST_CONTEXT_PARAM, request.getURI().getHost()); } if (StringUtils.isNotEmpty(accessToken)) { clientContext.setUserToken(accessToken); } return httpClient.execute(request, clientContext); }
Source:
<code>public void deleteCollectionDefaultItemReadGroupForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); String itemGroupString = "ITEM"; int defaultItemRead = Constants.DEFAULT_ITEM_READ; Group role = createDefaultReadGroup(itemGroupString, defaultItemRead); context.restoreAuthSystemState(); String token = getAuthToken(eperson.getEmail(), password); <START> getClient(token).perform(delete("/api/core/collections/" + collection.getID() + "/itemReadGroup")) <END> .andExpect(status().isForbidden()); }</code><technical_language>double check group is</technical_language>

Target:
public void deleteCollectionDefaultItemReadGroupForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); String itemGroupString = "ITEM"; int defaultItemRead = Constants.DEFAULT_ITEM_READ; Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead); context.restoreAuthSystemState(); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(delete("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isForbidden()); token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(role.getID(), role.getName()))); }