JAVA-27338: Fix VehicleUnitTest

This commit is contained in:
Harry9656 2023-11-16 20:22:43 +01:00
parent df734f467b
commit 58db4f7a09
2 changed files with 10 additions and 10 deletions

View File

@ -18,19 +18,19 @@ public class VehicleUnitTest {
}
@Test
public void givenCar_whenUsingReflectionAPI_thenSuperClassIsSealed() {
public void givenCar_whenUsingReflectionAPI_thenSuperClassIsSealed() throws ClassNotFoundException {
Assertions.assertThat(car.getClass().isSealed()).isEqualTo(false);
Assertions.assertThat(car.getClass().getSuperclass().isSealed()).isEqualTo(true);
Assertions.assertThat(car.getClass().getSuperclass().getPermittedSubclasses())
.contains(ClassDesc.of(car.getClass().getCanonicalName()));
.contains(Class.forName(car.getClass().getCanonicalName()));
}
@Test
public void givenTruck_whenUsingReflectionAPI_thenSuperClassIsSealed() {
public void givenTruck_whenUsingReflectionAPI_thenSuperClassIsSealed() throws ClassNotFoundException {
Assertions.assertThat(truck.getClass().isSealed()).isEqualTo(false);
Assertions.assertThat(truck.getClass().getSuperclass().isSealed()).isEqualTo(true);
Assertions.assertThat(truck.getClass().getSuperclass().getPermittedSubclasses())
.contains(ClassDesc.of(truck.getClass().getCanonicalName()));
.contains(Class.forName(truck.getClass().getCanonicalName()));
}
@Test

View File

@ -18,19 +18,19 @@ public class VehicleUnitTest {
}
@Test
public void givenCar_whenUsingReflectionAPI_thenInterfaceIsSealed() {
public void givenCar_whenUsingReflectionAPI_thenInterfaceIsSealed() throws ClassNotFoundException {
Assertions.assertThat(car.getClass().isSealed()).isEqualTo(false);
Assertions.assertThat(car.getClass().getInterfaces()[0].isSealed()).isEqualTo(true);
Assertions.assertThat(car.getClass().getInterfaces()[0].permittedSubclasses())
.contains(ClassDesc.of(car.getClass().getCanonicalName()));
Assertions.assertThat(car.getClass().getInterfaces()[0].getPermittedSubclasses())
.contains(Class.forName(car.getClass().getCanonicalName()));
}
@Test
public void givenTruck_whenUsingReflectionAPI_thenInterfaceIsSealed() {
public void givenTruck_whenUsingReflectionAPI_thenInterfaceIsSealed() throws ClassNotFoundException {
Assertions.assertThat(truck.getClass().isSealed()).isEqualTo(false);
Assertions.assertThat(truck.getClass().getInterfaces()[0].isSealed()).isEqualTo(true);
Assertions.assertThat(truck.getClass().getInterfaces()[0].permittedSubclasses())
.contains(ClassDesc.of(truck.getClass().getCanonicalName()));
Assertions.assertThat(truck.getClass().getInterfaces()[0].getPermittedSubclasses())
.contains(Class.forName(truck.getClass().getCanonicalName()));
}
@Test