HHH-16887 update tests

This commit is contained in:
Gavin King 2023-07-04 15:13:14 +02:00
parent f61e00c642
commit 13877a9a3e
6 changed files with 76 additions and 3 deletions

View File

@ -19,10 +19,9 @@ import static org.hibernate.jpamodelgen.test.util.TestUtil.assertPresenceOfNameF
*/
public class AuxiliaryTest extends CompilationTest {
@Test
@WithClasses({ Book.class, Main.class, Dao.class })
@WithClasses({ Book.class, Main.class })
public void testGeneratedAnnotationNotGenerated() {
System.out.println( TestUtil.getMetaModelSourceAsString( Main.class ) );
System.out.println( TestUtil.getMetaModelSourceAsString( Dao.class ) );
assertMetamodelClassGeneratedFor( Book.class );
assertMetamodelClassGeneratedFor( Main.class );
assertPresenceOfNameFieldInMetamodelFor(

View File

@ -0,0 +1,9 @@
package org.hibernate.jpamodelgen.test.noentity;
import jakarta.persistence.TypedQuery;
import org.hibernate.annotations.processing.HQL;
public interface Dao {
@HQL("select upper('Hibernate')")
TypedQuery<String> getName();
}

View File

@ -0,0 +1,26 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.jpamodelgen.test.noentity;
import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.TestUtil;
import org.hibernate.jpamodelgen.test.util.WithClasses;
import org.junit.Test;
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassGeneratedFor;
/**
* @author Gavin King
*/
public class NoEntityTest extends CompilationTest {
@Test
@WithClasses({ Dao.class })
public void testGeneratedAnnotationNotGenerated() {
System.out.println( TestUtil.getMetaModelSourceAsString( Dao.class ) );
assertMetamodelClassGeneratedFor( Dao.class );
}
}

View File

@ -0,0 +1,12 @@
package org.hibernate.jpamodelgen.test.querymethod;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.NamedEntityGraph;
@Entity
public class Book {
@Id String isbn;
String title;
String text;
}

View File

@ -1,4 +1,4 @@
package org.hibernate.jpamodelgen.test.namedquery;
package org.hibernate.jpamodelgen.test.querymethod;
import jakarta.persistence.TypedQuery;
import org.hibernate.annotations.processing.HQL;

View File

@ -0,0 +1,27 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.jpamodelgen.test.querymethod;
import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.TestUtil;
import org.hibernate.jpamodelgen.test.util.WithClasses;
import org.junit.Test;
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassGeneratedFor;
/**
* @author Gavin King
*/
public class QueryMethodTest extends CompilationTest {
@Test
@WithClasses({ Book.class, Dao.class })
public void testGeneratedAnnotationNotGenerated() {
System.out.println( TestUtil.getMetaModelSourceAsString( Dao.class ) );
assertMetamodelClassGeneratedFor( Book.class );
assertMetamodelClassGeneratedFor( Dao.class );
}
}