On Wed, 22 Jul 2026 16:53:37 GMT, Jorn Vernee <[email protected]> wrote:
> Copied from the JBS issue: > > While converting these tests to use JUnit instead of TestNG, I noticed some > false positives in the following tests: > > - `TestByteBuffer::testMapCustomPath` tries to provoke an > `UnsupportedOperationException` when calling `FileChannel::map`, but instead > causes one when opening the file channel. > > - `TestFunctionDescriptor::testBadCarrierMethodType` looks for an > `IllegalArgumentException` when calling `FunctionDescriptor::toMethodType`, > but this method is no longer specified to throw that exception. The exception > instead occurs when creating the function descriptor itself. > > - `testBadSequenceElementAlignmentTooBig` and `testBadStruct` in > `TestLayouts` try to provoke exceptions when using hyper-aligned layouts, but > instead trigger exceptions when using an alignment that is not a power of 2 > in some cases. > > - `TestMemoryAlignment::testUnalignedAccess` tries to provoke an exception on > unaligned access, but the exception is instead thrown when creating the > layout upfront. > > - `TestSpliterator::testHyperAligned` tries to provoke an exception when > calling `MemorySegments::elements` with a layout that isn't aligned for that > segment, but instead fails when creating the layout. > > I've switched some of these to use `assertThrows` instead of > `expectedException`, since that can be used to more precisely check that a > particular line throws an exception. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). Look reasonable. ------------- Marked as reviewed by liach (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/32014#pullrequestreview-4764321602
