On Fri, 13 Mar 2026 14:45:31 GMT, Volkan Yazici <[email protected]> wrote:

>> test/jaxp/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java
>>  line 97:
>> 
>>> 95:      */
>>> 96:     @ParameterizedTest
>>> 97:     @JAXPDataProvider.NewInstanceNeg
>> 
>> This new `@JAXPDataProvider.NewInstanceNeg` annotation is sadly very 
>> necessary. Without it, or something similar, you need to use 
>> `@MethodSource("class-name#method")` but that doesn't actually cause the 
>> compiler to bring in the class in question (`JAXPDataProvider`) so it fails 
>> at runtime. Defining a new JUnit data provider annotation means the target 
>> class is in scope at compilation time.
>> 
>> Overall the whole thing of having an opaque shared class for exactly one bit 
>> of trivial test data is a complexity I'd love to remove altogether, but this 
>> is the least invasive thing I can do for now.
>
> This is not necessary. You just need to add `@build 
> jaxp.library.JAXPDataProvider`.

Ahh okay. Mind you, I almost prefer the annotation approach since it's not 
relying on the late binding of a string for a class/method name. You can 
navigate to the data provider easily and refactoring will be more reliable.

>> test/jaxp/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java
>>  line 85:
>> 
>>> 83:         Document doc = dbf.newDocumentBuilder().parse(new File(XML_DIR, 
>>> "namespace1.xml"));
>>> 84:         dummyTransform(doc, outputfile);
>>> 85:         assertTrue(compareWithGold(goldfile, outputfile));
>> 
>> compareWithGold() is a util method in JAXPTestUtilities, but that cannot be 
>> compiled for JUnit tests (it used TestNG classes). Luckily JUnit has a 
>> good-enough assert for making this a one-line replacement.
>
> There is also `jdk.test.lib.Asserts#assertFileContentsEqual(Path,Path)`.

If the JUnit, built in API is sufficient, I prefer it. There's also a 
file-based JUnit assert, but I kept it line-by-line for slightly neater diffs 
(since it's text).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30165#discussion_r2932632063
PR Review Comment: https://git.openjdk.org/jdk/pull/30165#discussion_r2932655720

Reply via email to