milamberspace commented on code in PR #6462: URL: https://github.com/apache/jmeter/pull/6462#discussion_r2152613947
########## src/components/src/main/java/org/apache/jmeter/config/CSVDataSet.java: ########## @@ -222,20 +222,21 @@ private void initVars(FileServer server, final JMeterContext context, String del private void setAlias(final JMeterContext context, String alias) { String mode = getShareMode(); int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode); - switch(modeInt){ - case CSVDataSetBeanInfo.SHARE_ALL: - this.alias = alias; - break; - case CSVDataSetBeanInfo.SHARE_GROUP: - this.alias = alias + "@" + System.identityHashCode(context.getThreadGroup()); - break; - case CSVDataSetBeanInfo.SHARE_THREAD: - this.alias = alias + "@" + System.identityHashCode(context.getThread()); - break; - default: - this.alias = alias + "@" + mode; // user-specified key - break; - } + this.alias = switch(modeInt){ + case CSVDataSetBeanInfo.SHARE_ALL -> alias; + case CSVDataSetBeanInfo.SHARE_GROUP -> { + // Complex logic for thread group sharing + yield alias + "@" + System.identityHashCode(context.getThreadGroup()); Review Comment: Thanks for comment, change in last PR version ########## src/components/src/main/java/org/apache/jmeter/assertions/SizeAssertion.java: ########## @@ -174,42 +174,41 @@ public void setAllowedSize(long size) { * than equal, less than equal. * */ + private record ComparisonResult(boolean result, String errorMessage) {} + private String compareSize(long resultSize) { - String comparatorErrorMessage; long allowedSize = Long.parseLong(getAllowedSize()); - boolean result; int comp = getCompOper(); - switch (comp) { - case EQUAL: - result = resultSize == allowedSize; - comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_equal"); //$NON-NLS-1$ - break; - case NOTEQUAL: - result = resultSize != allowedSize; - comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_notequal"); //$NON-NLS-1$ - break; - case GREATERTHAN: - result = resultSize > allowedSize; - comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_greater"); //$NON-NLS-1$ - break; - case LESSTHAN: - result = resultSize < allowedSize; - comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_less"); //$NON-NLS-1$ - break; - case GREATERTHANEQUAL: - result = resultSize >= allowedSize; - comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_greaterequal"); //$NON-NLS-1$ - break; - case LESSTHANEQUAL: - result = resultSize <= allowedSize; - comparatorErrorMessage = JMeterUtils.getResString("size_assertion_comparator_error_lessequal"); //$NON-NLS-1$ - break; - default: - result = false; - comparatorErrorMessage = "ERROR - invalid condition"; - break; - } - return result ? "" : comparatorErrorMessage; + + ComparisonResult comparison = switch (comp) { + case EQUAL -> new ComparisonResult( + resultSize == allowedSize, + JMeterUtils.getResString("size_assertion_comparator_error_equal") //$NON-NLS-1$ + ); + case NOTEQUAL -> new ComparisonResult( Review Comment: Thanks for comment, change in last PR version -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org