80818283848586
return (result != null && !"".equals(result)) ? result : entityClass.getSimpleName(); } public static boolean isEntityClass(Class<?> entityClass) { return new EntityVerifier().verify(entityClass); }
29303132333435
private final Verifier<Class<?>> verifier; public AnnotationMetadataExtractor() { this.verifier = new EntityVerifier(); }
30313233343536373839404142
@Test public void should_accept_entity_class() { // given EntityVerifier entityVerifier = new EntityVerifier(); // when boolean isValid = entityVerifier.verify(Simple.class); // then assertTrue(isValid); }
4344454647484950515253545556
@Test public void should_not_accept_class_without_entity_annotation() { // given EntityVerifier entityVerifier = new EntityVerifier(); // when boolean isValid = entityVerifier.verify(EntityWithoutId.class); // then assertFalse(isValid); }