|
1 | 1 | /* |
2 | 2 | * Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved. |
| 3 | + * Copyright (c) 2026 Contributors to the Eclipse Foundation. All rights reserved. |
3 | 4 | * |
4 | 5 | * This program and the accompanying materials are made available under the |
5 | 6 | * terms of the Eclipse Distribution License v. 1.0, which is available at |
|
10 | 11 |
|
11 | 12 | package jakarta.xml.bind.test; |
12 | 13 |
|
13 | | -import org.junit.Before; |
14 | | -import org.junit.Test; |
| 14 | +import jakarta.xml.bind.JAXBContext; |
| 15 | +import jakarta.xml.bind.JAXBContextFactory; |
| 16 | +import jakarta.xml.bind.JAXBException; |
| 17 | +import jakarta.xml.bind.Marshaller; |
| 18 | +import jakarta.xml.bind.Unmarshaller; |
15 | 19 |
|
16 | | -import jakarta.xml.bind.*; |
17 | 20 | import java.util.Map; |
18 | 21 |
|
19 | | -import static junit.framework.Assert.assertEquals; |
20 | | -import static junit.framework.Assert.assertNotNull; |
21 | | -import static junit.framework.TestCase.fail; |
| 22 | +import org.junit.jupiter.api.Assertions; |
| 23 | +import org.junit.jupiter.api.BeforeEach; |
| 24 | +import org.junit.jupiter.api.Test; |
| 25 | + |
22 | 26 |
|
23 | 27 | /** |
24 | 28 | * regression test for |
@@ -57,27 +61,27 @@ public Marshaller createMarshaller() throws JAXBException { |
57 | 61 | public void testContextPath() { |
58 | 62 | try { |
59 | 63 | JAXBContext ctx = JAXBContext.newInstance("whatever", ClassLoader.getSystemClassLoader()); |
60 | | - assertNotNull("Expected non-null instance to be returned from the test Factory", ctx); |
61 | | - assertEquals("Expected MyContext instance to be returned from the test Factory", MyContext.class, ctx.getClass()); |
| 64 | + Assertions.assertNotNull(ctx,"Expected non-null instance to be returned from the test Factory"); |
| 65 | + Assertions.assertEquals(MyContext.class, ctx.getClass(), "Expected MyContext instance to be returned from the test Factory"); |
62 | 66 | } catch (Throwable t) { |
63 | 67 | t.printStackTrace(); |
64 | | - fail("Not expected to fail!"); |
| 68 | + Assertions.fail("Not expected to fail!"); |
65 | 69 | } |
66 | 70 | } |
67 | 71 |
|
68 | 72 | @Test |
69 | 73 | public void testClasses() { |
70 | 74 | try { |
71 | | - JAXBContext ctx = JAXBContext.newInstance(new Class[0]); |
72 | | - assertNotNull("Expected non-null instance to be returned from the test Factory", ctx); |
73 | | - assertEquals("Expected MyContext instance to be returned from the test Factory", MyContext.class, ctx.getClass()); |
| 75 | + JAXBContext ctx = JAXBContext.newInstance(new Class<?>[0]); |
| 76 | + Assertions.assertNotNull(ctx, "Expected non-null instance to be returned from the test Factory"); |
| 77 | + Assertions.assertEquals(MyContext.class, ctx.getClass(), "Expected MyContext instance to be returned from the test Factory"); |
74 | 78 | } catch (Throwable t) { |
75 | 79 | t.printStackTrace(); |
76 | | - fail("Not expected to fail!"); |
| 80 | + Assertions.fail("Not expected to fail!"); |
77 | 81 | } |
78 | 82 | } |
79 | 83 |
|
80 | | - @Before |
| 84 | + @BeforeEach |
81 | 85 | public void setup() { |
82 | 86 | System.setProperty("jakarta.xml.bind.JAXBContextFactory", "jakarta.xml.bind.test.JAXBContextServiceProviderNPETest$Factory"); |
83 | 87 | } |
|
0 commit comments