File tree Expand file tree Collapse file tree
core-java-modules/core-java-17/src/test/java/com/baeldung/sealed Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,19 +18,19 @@ public static void createInstances() {
1818 }
1919
2020 @ Test
21- public void givenCar_whenUsingReflectionAPI_thenSuperClassIsSealed () {
21+ public void givenCar_whenUsingReflectionAPI_thenSuperClassIsSealed () throws ClassNotFoundException {
2222 Assertions .assertThat (car .getClass ().isSealed ()).isEqualTo (false );
2323 Assertions .assertThat (car .getClass ().getSuperclass ().isSealed ()).isEqualTo (true );
2424 Assertions .assertThat (car .getClass ().getSuperclass ().getPermittedSubclasses ())
25- .contains (ClassDesc . of (car .getClass ().getCanonicalName ()));
25+ .contains (Class . forName (car .getClass ().getCanonicalName ()));
2626 }
2727
2828 @ Test
29- public void givenTruck_whenUsingReflectionAPI_thenSuperClassIsSealed () {
29+ public void givenTruck_whenUsingReflectionAPI_thenSuperClassIsSealed () throws ClassNotFoundException {
3030 Assertions .assertThat (truck .getClass ().isSealed ()).isEqualTo (false );
3131 Assertions .assertThat (truck .getClass ().getSuperclass ().isSealed ()).isEqualTo (true );
3232 Assertions .assertThat (truck .getClass ().getSuperclass ().getPermittedSubclasses ())
33- .contains (ClassDesc . of (truck .getClass ().getCanonicalName ()));
33+ .contains (Class . forName (truck .getClass ().getCanonicalName ()));
3434 }
3535
3636 @ Test
Original file line number Diff line number Diff line change @@ -18,19 +18,19 @@ public static void createInstances() {
1818 }
1919
2020 @ Test
21- public void givenCar_whenUsingReflectionAPI_thenInterfaceIsSealed () {
21+ public void givenCar_whenUsingReflectionAPI_thenInterfaceIsSealed () throws ClassNotFoundException {
2222 Assertions .assertThat (car .getClass ().isSealed ()).isEqualTo (false );
2323 Assertions .assertThat (car .getClass ().getInterfaces ()[0 ].isSealed ()).isEqualTo (true );
24- Assertions .assertThat (car .getClass ().getInterfaces ()[0 ].permittedSubclasses ())
25- .contains (ClassDesc . of (car .getClass ().getCanonicalName ()));
24+ Assertions .assertThat (car .getClass ().getInterfaces ()[0 ].getPermittedSubclasses ())
25+ .contains (Class . forName (car .getClass ().getCanonicalName ()));
2626 }
2727
2828 @ Test
29- public void givenTruck_whenUsingReflectionAPI_thenInterfaceIsSealed () {
29+ public void givenTruck_whenUsingReflectionAPI_thenInterfaceIsSealed () throws ClassNotFoundException {
3030 Assertions .assertThat (truck .getClass ().isSealed ()).isEqualTo (false );
3131 Assertions .assertThat (truck .getClass ().getInterfaces ()[0 ].isSealed ()).isEqualTo (true );
32- Assertions .assertThat (truck .getClass ().getInterfaces ()[0 ].permittedSubclasses ())
33- .contains (ClassDesc . of (truck .getClass ().getCanonicalName ()));
32+ Assertions .assertThat (truck .getClass ().getInterfaces ()[0 ].getPermittedSubclasses ())
33+ .contains (Class . forName (truck .getClass ().getCanonicalName ()));
3434 }
3535
3636 @ Test
You can’t perform that action at this time.
0 commit comments