saintstack commented on a change in pull request #1091: HBASE-23731: De-flake 
TestFromClientSide
URL: https://github.com/apache/hbase/pull/1091#discussion_r371069322
 
 

 ##########
 File path: 
hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
 ##########
 @@ -82,6 +99,49 @@ private static long getTimeoutInSeconds(Class<?> clazz) {
         clazz.getName() + " does not have SmallTests/MediumTests/LargeTests in 
@Category");
   }
 
+  /**
+   * @param clazz Test class that is running.
+   * @return the number of parameters for this given test class. If the test 
is not parameterized or
+   *   if there is any issue determining the number of parameters, returns 1.
+   */
+  private static int getNumParameters(Class<?> clazz) {
+    RunWith[] runWiths = clazz.getAnnotationsByType(RunWith.class);
+    boolean isTestParameterized = runWiths != null && 
Arrays.stream(runWiths).anyMatch(
+      (r) -> r.value().equals(Parameterized.class));
+    if (isTestParameterized) {
+      for (Method method : clazz.getMethods()) {
 
 Review comment:
   Style nit, rather than have an if with a big indented clause, I'd avoid the 
indent by testing for the opposite case and just doing an early return if 
succeeds -- especially when near the opening of a method. No biggie. Just a 
consideration for future.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to