add test for include/exclude

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-05-06 21:41:02 +02:00
parent ccaefc168a
commit 503cd3e9ed
4 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,9 @@
package org.hibernate.processor.test.includeexclude;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
@Entity
public class Bar {
@Id long id;
}

View File

@ -0,0 +1,11 @@
package org.hibernate.processor.test.includeexclude;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import org.hibernate.annotations.processing.Exclude;
@Exclude
@Entity
public class Baz {
@Id long id;
}

View File

@ -0,0 +1,10 @@
package org.hibernate.processor.test.includeexclude;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
@Entity
public class Foo {
@Id long id;
}

View File

@ -0,0 +1,22 @@
package org.hibernate.processor.test.includeexclude;
import org.hibernate.processor.HibernateProcessor;
import org.hibernate.processor.test.util.CompilationTest;
import org.hibernate.processor.test.util.WithClasses;
import org.hibernate.processor.test.util.WithProcessorOption;
import org.junit.Test;
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
import static org.hibernate.processor.test.util.TestUtil.assertNoMetamodelClassGeneratedFor;
public class IncludeExcludeTest extends CompilationTest {
@Test
@WithClasses({ Foo.class, Bar.class, Baz.class })
@WithProcessorOption(key = HibernateProcessor.INCLUDE, value = "org.hibernate.processor.test.includeexclude.*")
@WithProcessorOption(key = HibernateProcessor.EXCLUDE, value = "org.hibernate.processor.test.includeexclude.F*")
public void testQueryMethod() {
assertNoMetamodelClassGeneratedFor( Foo.class );
assertMetamodelClassGeneratedFor( Bar.class );
assertNoMetamodelClassGeneratedFor( Baz.class );
}
}