RFR: 8375712: Convert java/lang/runtime tests to use JUnit

Johannes Döbler duke at openjdk.org
Wed Jan 21 20:03:07 UTC 2026


On Wed, 21 Jan 2026 16:32:06 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> This PR converts the tests under `test/jdk/java/lang/runtime/` to use JUnit. Mostly converted by the automatic conversion tool, but there's a manual tweak to use `assertThrows` instead of the current manual `try-catch`. Also one manual fix. The changes are in separate commits, which should help reviewing.
> 
> Thanks!

test/jdk/java/lang/runtime/ExactnessConversionsSupportTest.java line 64:

> 62:     @Test
> 63:     public void testByte() {
> 64:         assertEquals(true,  ExactConversionsSupport.isIntToByteExact((byte) (Byte.MAX_VALUE)));

could be shortened to assertTrue(Exact...)``

test/jdk/java/lang/runtime/SwitchBootstrapsTest.java line 161:

> 159:         testEnum(E1.B, 1, 3, "B", "C", "A", E1.class);
> 160:         assertThrows(IllegalArgumentException.class, () ->
> 161:             testEnum(E1.B, 0, -1, E2.class)

for readability it could be worth to add a helper method 
`testEnumError(Class<? extends RuntimeException> exceptionClass, Enum<?> target, int start, int result, Object... labels)`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29350#discussion_r2714105478
PR Review Comment: https://git.openjdk.org/jdk/pull/29350#discussion_r2714126640


More information about the core-libs-dev mailing list