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).

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

Commit messages:
 - Remove redundant test
 - Fix some false positives

Changes: https://git.openjdk.org/jdk/pull/32014/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32014&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8388792
  Stats: 78 lines in 5 files changed: 27 ins; 36 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/32014.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32014/head:pull/32014

PR: https://git.openjdk.org/jdk/pull/32014

Reply via email to