BAEL-4531 (#10093)
* Added code for checking if a class is abstract or not. * Renamed test name as per review comments.
This commit is contained in:
parent
be48134840
commit
d48defc3e2
@ -0,0 +1,15 @@
|
|||||||
|
package com.baeldung.reflection.check.abstractclass;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
|
public abstract class AbstractExample {
|
||||||
|
|
||||||
|
public static String getAuthorName() {
|
||||||
|
return "Umang Budhwar";
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract LocalDate getLocalDate();
|
||||||
|
|
||||||
|
public abstract LocalTime getLocalTime();
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.baeldung.reflection.check.abstractclass;
|
||||||
|
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class AbstractExampleUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void givenAbstractClass_whenCheckModifierIsAbstract_thenTrue() throws Exception {
|
||||||
|
Class<AbstractExample> clazz = AbstractExample.class;
|
||||||
|
Assertions.assertTrue(Modifier.isAbstract(clazz.getModifiers()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user