You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/07/20 15:50:18 UTC

[GitHub] [solr] uschindler commented on a diff in pull request #947: SOLR-16300: migrate assert to non deprecated version

uschindler commented on code in PR #947:
URL: https://github.com/apache/solr/pull/947#discussion_r925775026


##########
solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java:
##########
@@ -72,6 +74,11 @@
  */
 public class SolrCloudTestCase extends SolrTestCaseJ4 {
 
+
+  public static <T> void assertThat(T actual, Matcher<? super T> matcher) {

Review Comment:
   I am tentative/hesitant:
   1. I generally also prefer static imports for normal production code
   2. I like Class#staticMethod more, that's also what code guidelines say: "always use class name when invoking static methods as there's no inheritance" (when you call a static method theres no inheritance involved, it is just the compiler hardcoding the class name in the call site)
   3. But for testing this is quite horrible to use, because auto-completion by IDEs does not work until you have added the imports and found the correct class. By having it in the base class it is more accessible for quickly writing a test, although this is against #2.
   
   Uwe



##########
solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java:
##########
@@ -72,6 +74,11 @@
  */
 public class SolrCloudTestCase extends SolrTestCaseJ4 {
 
+
+  public static <T> void assertThat(T actual, Matcher<? super T> matcher) {

Review Comment:
   I am tentative/hesitant:
   1. I generally also prefer static imports for normal production code
   2. I like Class#staticMethod more, that's also what code guidelines say: "always use class name when invoking static methods as there's no inheritance" (when you call a static method theres no inheritance involved, it is just the compiler hardcoding the class name in the call site)
   3. But for testing this is quite horrible to use, because auto-completion by IDEs does not work until you have added the imports and found the correct class. By having it in the base class it is more accessible for quickly writing a test, although this is against # 2.
   
   Uwe



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org