Skip to content

Commit 68a2e11

Browse files
committed
Update processor tests to use JUnit 5
1 parent 562c5c6 commit 68a2e11

File tree

106 files changed

+796
-715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+796
-715
lines changed

tooling/metamodel-generator/hibernate-processor.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ configurations {
8080
def quarkusOrmPanacheTestTask = tasks.register( 'quarkusOrmPanacheTest', Test ) {
8181
description = 'Runs the Quarkus ORM Panache tests.'
8282
group = 'verification'
83+
useJUnitPlatform()
8384

8485
testClassesDirs = sourceSets.quarkusOrmPanache.output.classesDirs
8586
classpath = sourceSets.quarkusOrmPanache.runtimeClasspath
@@ -89,6 +90,7 @@ def quarkusOrmPanacheTestTask = tasks.register( 'quarkusOrmPanacheTest', Test )
8990
def quarkusHrPanacheTestTask = tasks.register( 'quarkusHrPanacheTest', Test ) {
9091
description = 'Runs the Quarkus HR Panache tests.'
9192
group = 'verification'
93+
useJUnitPlatform()
9294

9395
testClassesDirs = sourceSets.quarkusHrPanache.output.classesDirs
9496
classpath = sourceSets.quarkusHrPanache.runtimeClasspath
@@ -98,6 +100,7 @@ def quarkusHrPanacheTestTask = tasks.register( 'quarkusHrPanacheTest', Test ) {
98100
def jakartaDataTestTask = tasks.register( 'jakartaDataTest', Test ) {
99101
description = 'Runs the Jakarta Data tests.'
100102
group = 'verification'
103+
useJUnitPlatform()
101104

102105
testClassesDirs = sourceSets.jakartaData.output.classesDirs
103106
classpath = sourceSets.jakartaData.runtimeClasspath
@@ -160,4 +163,4 @@ tasks.forbiddenApisQuarkusOrmPanache {
160163

161164
tasks.forbiddenApisQuarkusHrPanache {
162165
enabled = false
163-
}
166+
}

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/basic/DataTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.WithClasses;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1212
import static org.hibernate.processor.test.util.TestUtil.assertNoMetamodelClassGeneratedFor;
@@ -15,10 +15,11 @@
1515
/**
1616
* @author Gavin King
1717
*/
18-
public class DataTest extends CompilationTest {
18+
@CompilationTest
19+
class DataTest {
1920
@Test
2021
@WithClasses({ Author.class, Book.class, BookAuthorRepository.class, IdOperations.class, Concrete.class, Thing.class })
21-
public void test() {
22+
void test() {
2223
System.out.println( getMetaModelSourceAsString( Author.class ) );
2324
System.out.println( getMetaModelSourceAsString( Book.class ) );
2425
System.out.println( getMetaModelSourceAsString( Author.class, true ) );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/eg/EgTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66

77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.WithClasses;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1212
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
1313

1414
/**
1515
* @author Gavin King
1616
*/
17-
public class EgTest extends CompilationTest {
17+
@CompilationTest
18+
class EgTest {
1819
@Test
1920
@WithClasses({ Publisher.class, Author.class, Address.class, Book.class, Library.class, Bookshop.class, Publishers.class })
20-
public void test() {
21+
void test() {
2122
System.out.println( getMetaModelSourceAsString( Author.class ) );
2223
System.out.println( getMetaModelSourceAsString( Book.class ) );
2324
System.out.println( getMetaModelSourceAsString( Author.class, true ) );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/embeddedid/EmbeddedIdTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66

77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.WithClasses;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1212
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
1313

1414
/**
1515
* @author Gavin King
1616
*/
17-
public class EmbeddedIdTest extends CompilationTest {
17+
@CompilationTest
18+
class EmbeddedIdTest {
1819
@Test
1920
@WithClasses({ Thing.class, ThingRepo.class })
20-
public void test() {
21+
void test() {
2122
System.out.println( getMetaModelSourceAsString( ThingRepo.class ) );
2223
assertMetamodelClassGeneratedFor( Thing.class, true );
2324
assertMetamodelClassGeneratedFor( Thing.class );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/fqcninquery/FqcnInQueryTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
import jakarta.persistence.EntityManager;
88
import org.hibernate.processor.test.util.CompilationTest;
99
import org.hibernate.processor.test.util.WithClasses;
10-
import org.junit.Test;
10+
import org.junit.jupiter.api.Test;
1111

1212
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1313
import static org.hibernate.processor.test.util.TestUtil.assertPresenceOfMethodInMetamodelFor;
1414
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
1515

16-
public class FqcnInQueryTest extends CompilationTest {
16+
@CompilationTest
17+
class FqcnInQueryTest {
1718
@Test
1819
@WithClasses({MyEntity.class, MyRepository.class})
19-
public void test() {
20+
void test() {
2021
System.out.println( getMetaModelSourceAsString( MyRepository.class ) );
2122
System.out.println( getMetaModelSourceAsString( MyEntity.class ) );
2223

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/idclass/CompositeIdClassTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77
import org.hibernate.processor.test.data.idclass.MyEntity.MyEntityId;
88
import org.hibernate.processor.test.util.CompilationTest;
99
import org.hibernate.processor.test.util.WithClasses;
10-
import org.junit.Test;
10+
import org.junit.jupiter.api.Test;
1111

1212
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1313
import static org.hibernate.processor.test.util.TestUtil.assertPresenceOfMethodInMetamodelFor;
1414
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
1515

16-
public class CompositeIdClassTest extends CompilationTest {
16+
@CompilationTest
17+
class CompositeIdClassTest {
1718
@Test
1819
@WithClasses({
1920
MyRepository.class,
2021
YourRepository.class,
2122
MyEntity.class,
2223
})
23-
public void test() {
24+
void test() {
2425
System.out.println( getMetaModelSourceAsString( MyEntity.class ) );
2526
System.out.println( getMetaModelSourceAsString( MyEntity.class, true ) );
2627
System.out.println( getMetaModelSourceAsString( MyRepository.class ) );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/innerclass/InnerClassTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@
1010
import org.hibernate.processor.test.data.innerclass.InnerClassTest.One.Two;
1111
import org.hibernate.processor.test.util.CompilationTest;
1212
import org.hibernate.processor.test.util.WithClasses;
13-
import org.junit.Test;
13+
import org.junit.jupiter.api.Test;
1414

1515
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1616
import static org.hibernate.processor.test.util.TestUtil.assertNoMetamodelClassGeneratedFor;
1717
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
18-
import static org.junit.Assert.assertEquals;
18+
import static org.junit.jupiter.api.Assertions.assertEquals;
1919

20-
public class InnerClassTest extends CompilationTest {
20+
@CompilationTest
21+
class InnerClassTest {
2122

2223
@WithClasses({Person.class, Dummy.class, Inner.class, Two.class})
2324
@Test
24-
public void test() {
25+
void test() {
2526
System.out.println( getMetaModelSourceAsString( InnerClassTest.class ) );
2627
System.out.println( getMetaModelSourceAsString( Dummy.class ) );
2728
System.out.println( getMetaModelSourceAsString( Person.class ) );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/innerclass/InnerRepositoryTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
import jakarta.persistence.Id;
1414
import org.hibernate.processor.test.util.CompilationTest;
1515
import org.hibernate.processor.test.util.WithClasses;
16-
import org.junit.Test;
16+
import org.junit.jupiter.api.Test;
1717

1818
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1919
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
2020

21-
public class InnerRepositoryTest extends CompilationTest {
21+
@CompilationTest
22+
class InnerRepositoryTest {
2223

2324
@Test
2425
@WithClasses({Thing.class, ThingRepo.class})
25-
public void test() {
26+
void test() {
2627
System.out.println( getMetaModelSourceAsString( ThingRepo.class ) );
2728
assertMetamodelClassGeneratedFor( ThingRepo.class );
2829
}

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/multivaluebinding/TopicPostTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import jakarta.persistence.EntityManager;
88
import org.hibernate.processor.test.util.CompilationTest;
99
import org.hibernate.processor.test.util.WithClasses;
10-
import org.junit.Test;
10+
import org.junit.jupiter.api.Test;
1111

1212
import java.lang.reflect.Method;
1313
import java.lang.reflect.ParameterizedType;
@@ -21,10 +21,11 @@
2121
import static org.junit.jupiter.api.Assertions.assertEquals;
2222
import static org.junit.jupiter.api.Assertions.fail;
2323

24-
public class TopicPostTest extends CompilationTest {
24+
@CompilationTest
25+
class TopicPostTest {
2526
@Test
2627
@WithClasses({Post.class, PostRepository.class})
27-
public void test() {
28+
void test() {
2829
assertMetamodelClassGeneratedFor( Post.class, true );
2930
assertMetamodelClassGeneratedFor( Post.class );
3031
assertMetamodelClassGeneratedFor( PostRepository.class );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/namedquery/NamedQueryTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.WithClasses;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1212
import static org.hibernate.processor.test.util.TestUtil.assertNoMetamodelClassGeneratedFor;
@@ -15,10 +15,11 @@
1515
/**
1616
* @author Gavin King
1717
*/
18-
public class NamedQueryTest extends CompilationTest {
18+
@CompilationTest
19+
class NamedQueryTest {
1920
@Test
2021
@WithClasses({ Author.class, Book.class, BookAuthorRepository.class, BookAuthorRepository$.class })
21-
public void test() {
22+
void test() {
2223
System.out.println( getMetaModelSourceAsString( Author.class ) );
2324
System.out.println( getMetaModelSourceAsString( Book.class ) );
2425
System.out.println( getMetaModelSourceAsString( Author.class, true ) );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/processingorder/ProcessingOrderTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.WithClasses;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import java.lang.reflect.Method;
1212
import java.lang.reflect.ParameterizedType;
@@ -18,10 +18,11 @@
1818
import static org.junit.jupiter.api.Assertions.assertEquals;
1919
import static org.junit.jupiter.api.Assertions.fail;
2020

21-
public class ProcessingOrderTest extends CompilationTest {
21+
@CompilationTest
22+
class ProcessingOrderTest {
2223
@Test
2324
@WithClasses({Post.class, PostRepository.class, Topic.class})
24-
public void test() {
25+
void test() {
2526
assertMetamodelClassGeneratedFor( PostRepository.class );
2627

2728
assertPresenceOfMethodInMetamodelFor( PostRepository.class, "getPostsByTopic", Topic.class );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/quarkus/QuarkusOrmPanacheTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.hibernate.processor.test.util.CompilationTest;
99
import org.hibernate.processor.test.util.TestUtil;
1010
import org.hibernate.processor.test.util.WithClasses;
11-
import org.junit.Test;
11+
import org.junit.jupiter.api.Test;
1212
import org.junit.jupiter.api.Assertions;
1313

1414
import jakarta.inject.Inject;
@@ -22,11 +22,12 @@
2222
/**
2323
* @author Gavin King
2424
*/
25-
public class QuarkusOrmPanacheTest extends CompilationTest {
25+
@CompilationTest
26+
class QuarkusOrmPanacheTest {
2627

2728
@Test
2829
@WithClasses({ PanacheBook.class, JakartaDataBookRepository.class })
29-
public void testJakartaDataRepositoryMetamodel() throws Exception {
30+
void testJakartaDataRepositoryMetamodel() throws Exception {
3031
// JD repository
3132
System.out.println( TestUtil.getMetaModelSourceAsString( JakartaDataBookRepository.class ) );
3233
Class<?> repositoryClass = getMetamodelClassFor( JakartaDataBookRepository.class );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/reactive/ReactiveTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66

77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.WithClasses;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1212
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
1313

1414
/**
1515
* @author Gavin King
1616
*/
17-
public class ReactiveTest extends CompilationTest {
17+
@CompilationTest
18+
class ReactiveTest {
1819
@Test
1920
@WithClasses({ Publisher.class, Author.class, Address.class, Book.class, Library.class, Library2.class })
20-
public void test() {
21+
void test() {
2122
System.out.println( getMetaModelSourceAsString( Author.class ) );
2223
System.out.println( getMetaModelSourceAsString( Book.class ) );
2324
System.out.println( getMetaModelSourceAsString( Author.class, true ) );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/selectenumproperty/TopicTypeEnumTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66

77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.WithClasses;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1212
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
1313

14-
public class TopicTypeEnumTest extends CompilationTest {
14+
@CompilationTest
15+
class TopicTypeEnumTest {
1516
@Test
1617
@WithClasses({Topic.class, TopicRepository.class})
17-
public void test() {
18+
void test() {
1819
System.out.println( getMetaModelSourceAsString( Topic.class ) );
1920
System.out.println( getMetaModelSourceAsString( Topic.class, true ) );
2021
System.out.println( getMetaModelSourceAsString( TopicRepository.class ) );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/superdao/SuperRepoTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.TestUtil;
99
import org.hibernate.processor.test.util.WithClasses;
10-
import org.junit.Test;
10+
import org.junit.jupiter.api.Test;
1111

1212
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1313

1414
/**
1515
* @author Gavin King
1616
*/
17-
public class SuperRepoTest extends CompilationTest {
17+
@CompilationTest
18+
class SuperRepoTest {
1819
@Test
1920
@WithClasses({ Book.class, SuperRepo.class, Repo.class })
20-
public void testQueryMethod() {
21+
void testQueryMethod() {
2122
System.out.println( TestUtil.getMetaModelSourceAsString( SuperRepo.class ) );
2223
System.out.println( TestUtil.getMetaModelSourceAsString( Repo.class ) );
2324
assertMetamodelClassGeneratedFor( Book.class );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/superdao/generic/SuperRepoTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.TestUtil;
99
import org.hibernate.processor.test.util.WithClasses;
10-
import org.junit.Test;
10+
import org.junit.jupiter.api.Test;
1111

1212
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1313

1414
/**
1515
* @author Gavin King
1616
*/
17-
public class SuperRepoTest extends CompilationTest {
17+
@CompilationTest
18+
class SuperRepoTest {
1819
@Test
1920
@WithClasses({ Book.class, SuperRepo.class, Repo.class })
20-
public void testQueryMethod() {
21+
void testQueryMethod() {
2122
// System.out.println( TestUtil.getMetaModelSourceAsString( SuperRepo.class ) );
2223
System.out.println( TestUtil.getMetaModelSourceAsString( Repo.class ) );
2324
assertMetamodelClassGeneratedFor( Book.class );

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/versioned/VersionedTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66

77
import org.hibernate.processor.test.util.CompilationTest;
88
import org.hibernate.processor.test.util.WithClasses;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor;
1212
import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString;
1313

1414
/**
1515
* @author Gavin King
1616
*/
17-
public class VersionedTest extends CompilationTest {
17+
@CompilationTest
18+
class VersionedTest {
1819
@Test
1920
@WithClasses({ Versioned.class, VersionedRepo.class, SpecialVersioned.class, SpecialVersionedRepo.class })
20-
public void test() {
21+
void test() {
2122
System.out.println( getMetaModelSourceAsString( VersionedRepo.class ) );
2223
assertMetamodelClassGeneratedFor( Versioned.class, true );
2324
assertMetamodelClassGeneratedFor( Versioned.class );

0 commit comments

Comments
 (0)