diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/Bar.java b/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/Bar.java new file mode 100644 index 0000000000..8106be9a47 --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/Bar.java @@ -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; +} diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/Baz.java b/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/Baz.java new file mode 100644 index 0000000000..c150bb4a11 --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/Baz.java @@ -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; +} diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/Foo.java b/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/Foo.java new file mode 100644 index 0000000000..b28a5e9e6c --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/Foo.java @@ -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; +} + diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/IncludeExcludeTest.java b/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/IncludeExcludeTest.java new file mode 100644 index 0000000000..654fd54d84 --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/includeexclude/IncludeExcludeTest.java @@ -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 ); + } +}