You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/04/06 11:56:06 UTC

[GitHub] [spark] LuciferYang commented on pull request #36078: [DON'T MERGE] Migrate Junit4 to Junit5

LuciferYang commented on PR #36078:
URL: https://github.com/apache/spark/pull/36078#issuecomment-1090182735

   @srowen @dongjoon-hyun @HyukjinKwon I'm sorry to take up your time. I tried to migrate Junit 4 to Junit 5, passed all UTs and give this draft pr. 
   
   I haven't create a new jira yet because I'm not sure if we we're interested in it.
   
   I think JUnit 5 provides some new features that will help us simplify the test code in the future, so I give this draft pr.
   
   For examples, when we use the [Parameterized Tests](https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests), the following test code
   
   https://github.com/apache/spark/blob/fb3f380b3834ca24947a82cb8d87efeae6487664/common/kvstore/src/test/java/org/apache/spark/util/kvstore/RocksDBTypeInfoSuite.java#L46-L74
   
   can be simplified to
   
   ```scala
     @ParameterizedTest
     @ValueSource(classes = {NoNaturalIndex.class, NoNaturalIndex2.class, DuplicateIndex.class,
        EmptyIndexName.class, IllegalIndexName.class, IllegalIndexMethod.class})
     public void testIllegalType(Class<?> type) {
       assertThrows(IllegalArgumentException.class, () -> newTypeInfo(type));
     }
   ```
   
   For another example, JUnit 5 provides `EnabledOnOs`, `DisabledIfSystemProperty` and other annotations, which makes it easier for us to enable or disable some UTs.
   
   I'd like to know your suggestions to decide whether to continue to finish this work


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org