nandorKollar commented on PR #4583:
URL: https://github.com/apache/polaris/pull/4583#issuecomment-4592380896

   Although the current approach works, I don't really like the reflective 
invocation and the fact, that we need to manually implement BeforeEach. I think 
we can simplify that part using ParmetrizedTestClass. Instead of dynamics 
tests, how about something like this:
   ```
   @ParameterizedClass
   @MethodSource("schemaVersions")
   public class AtomicMetastoreManagerWithJdbcBasePersistenceImplSchemaTest 
extends AtomicMetastoreManagerWithJdbcBasePersistenceImplTest {
       @Parameter
       int schemaVersion;
   
       static SortedSet<Integer> schemaVersions() {
           ClassLoader classLoader = H2SchemaVersions.class.getClassLoader();
           SortedSet<Integer> versions = new TreeSet<>();
           for (int version = 0; ; version++) {
               String resource = String.format("h2/schema-v%d.sql", version);
               if (classLoader.getResource(resource) == null) {
                   break;
               }
               versions.add(version);
           }
           if (versions.isEmpty()) {
               throw new IllegalStateException("No H2 schema files found on 
classpath");
           }
           return versions;
       }
   
       @Override
       public int schemaVersion() {
           return schemaVersion;
       }
   }
   ```
   
   Would this work? Does it look better than dynamic tests?


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to