Skip to content

Commit 83f956b

Browse files
Migration to junit5 (#1776)
* Bump ibm image (old one is reported as ransomware by company firewall) * Migration of sql module to junit5 * Migration of spatial module to junit5 * Migration of apt test module to junit5 (tested locally, bc by default are skipped) + fixed NoteTest.java tests * Migration of codegen module to junit5 * Migration of codegen module to junit5 * Migration of collection module to junit5 * Migration of jpa codegen module to junit5 * Migration of r2dbc module to junit5 * Migration of jpa module to junit5 * Migration of maven module to junit5 * Migration of sql codegen module to junit5 * Migration of spatial module to junit5 * Migration of scala module to junit5 * Migration of kotlin and ksp module to junit5 * Migration of example modules to junit5 * Migration to junit 5 modules * Migration to junit 5 modules - fixed tests that never been runned (even wrong config) + fixed bug with dialect functions registration and fix MetaDataExporter bug * Migration to junit 5 modules - fixed tests that never been runned (even wrong config) + fixed bug with dialect functions registration and fix MetaDataExporter bug - velo requested changes
1 parent 61a898a commit 83f956b

694 files changed

Lines changed: 4004 additions & 3180 deletions

File tree

Some content is hidden

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

pom.xml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,6 @@
300300
<artifactId>junit-jupiter-api</artifactId>
301301
<scope>test</scope>
302302
</dependency>
303-
<dependency>
304-
<groupId>org.junit.vintage</groupId>
305-
<artifactId>junit-vintage-engine</artifactId>
306-
<scope>test</scope>
307-
</dependency>
308303
<dependency>
309304
<groupId>org.easymock</groupId>
310305
<artifactId>easymock</artifactId>
@@ -989,6 +984,17 @@
989984
<properties>
990985
<excludedGroups>com.querydsl.core.testutil.Database,
991986
com.querydsl.core.testutil.MongoDB,
987+
com.querydsl.core.testutil.CUBRID,
988+
com.querydsl.core.testutil.DB2,
989+
com.querydsl.core.testutil.Derby,
990+
com.querydsl.core.testutil.Firebird,
991+
com.querydsl.core.testutil.H2,
992+
com.querydsl.core.testutil.HSQLDB,
993+
com.querydsl.core.testutil.MySQL,
994+
com.querydsl.core.testutil.Oracle,
995+
com.querydsl.core.testutil.PostgreSQL,
996+
com.querydsl.core.testutil.SQLite,
997+
com.querydsl.core.testutil.SQLServer,
992998
com.querydsl.core.testutil.SlowTest,
993999
com.querydsl.core.testutil.Performance,
9941000
com.querydsl.core.testutil.ReportingOnly</excludedGroups>
@@ -1009,6 +1015,13 @@
10091015
<!-- default groups to exclude from surefire plugin -->
10101016
<excludedGroups>com.querydsl.core.testutil.ExternalDatabase,
10111017
com.querydsl.core.testutil.MongoDB,
1018+
com.querydsl.core.testutil.CUBRID,
1019+
com.querydsl.core.testutil.DB2,
1020+
com.querydsl.core.testutil.Firebird,
1021+
com.querydsl.core.testutil.MySQL,
1022+
com.querydsl.core.testutil.Oracle,
1023+
com.querydsl.core.testutil.PostgreSQL,
1024+
com.querydsl.core.testutil.SQLServer,
10121025
com.querydsl.core.testutil.SlowTest,
10131026
com.querydsl.core.testutil.Performance,
10141027
com.querydsl.core.testutil.ReportingOnly</excludedGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.querydsl.example.jpa.guice;
2+
3+
import com.google.inject.Guice;
4+
import org.junit.jupiter.api.extension.ExtensionContext;
5+
import org.junit.jupiter.api.extension.TestInstanceFactory;
6+
import org.junit.jupiter.api.extension.TestInstanceFactoryContext;
7+
8+
/** JUnit 5 replacement for the former {@code GuiceTestRunner}: builds test instances via Guice. */
9+
public class GuiceTestExtension implements TestInstanceFactory {
10+
11+
@Override
12+
public Object createTestInstance(
13+
TestInstanceFactoryContext factoryContext, ExtensionContext extensionContext) {
14+
return Guice.createInjector(new ServiceModule()).getInstance(factoryContext.getTestClass());
15+
}
16+
}

querydsl-examples/querydsl-example-jpa-guice/src/test/java/com/querydsl/example/jpa/guice/GuiceTestRunner.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

querydsl-examples/querydsl-example-jpa-guice/src/test/java/com/querydsl/example/jpa/repository/AbstractPersistenceTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.querydsl.example.jpa.repository;
22

33
import com.google.inject.persist.Transactional;
4-
import com.querydsl.example.jpa.guice.GuiceTestRunner;
4+
import com.querydsl.example.jpa.guice.GuiceTestExtension;
55
import jakarta.inject.Inject;
66
import jakarta.inject.Provider;
77
import jakarta.persistence.EntityManager;
@@ -11,14 +11,14 @@
1111
import java.util.List;
1212
import org.hibernate.Session;
1313
import org.hibernate.jdbc.Work;
14-
import org.junit.Before;
15-
import org.junit.runner.RunWith;
14+
import org.junit.jupiter.api.BeforeEach;
15+
import org.junit.jupiter.api.extension.ExtendWith;
1616

17-
@RunWith(GuiceTestRunner.class)
17+
@ExtendWith(GuiceTestExtension.class)
1818
public abstract class AbstractPersistenceTest {
1919
@Inject private Provider<EntityManager> em;
2020

21-
@Before
21+
@BeforeEach
2222
@Transactional
2323
public void before() {
2424
var entityManager = em.get();

querydsl-examples/querydsl-example-jpa-guice/src/test/java/com/querydsl/example/jpa/repository/TweetRepositoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Arrays;
1111
import java.util.Collections;
1212
import java.util.List;
13-
import org.junit.Test;
13+
import org.junit.jupiter.api.Test;
1414

1515
public class TweetRepositoryTest extends AbstractPersistenceTest {
1616
@Inject private TweetRepository repository;

querydsl-examples/querydsl-example-jpa-guice/src/test/java/com/querydsl/example/jpa/repository/UserRepositoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import com.querydsl.example.jpa.model.User;
66
import jakarta.inject.Inject;
7-
import org.junit.Test;
7+
import org.junit.jupiter.api.Test;
88

99
public class UserRepositoryTest extends AbstractPersistenceTest {
1010
@Inject private UserRepository repository;

querydsl-examples/querydsl-example-kotlin-codegen/src/test/kotlin/com/querydsl/examples/kotlin/ExampleEntityTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import com.querydsl.examples.kotlin.entity.ExampleEntity
2020
import com.querydsl.examples.kotlin.entity.QExampleEntity
2121
import com.querydsl.examples.kotlin.entity.QExampleEntity.Companion.exampleEntity
2222
import com.querydsl.jpa.impl.JPAQuery
23-
import org.junit.Test
23+
import org.junit.jupiter.api.Test
2424

2525
class ExampleEntityTest {
2626

querydsl-examples/querydsl-example-kotlin-jpa/src/test/kotlin/com/querydsl/examples/kotlin/ExampleEntityTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import com.querydsl.examples.kotlin.entity.ExampleEntity
2020
import com.querydsl.examples.kotlin.entity.QExampleEntity
2121
import com.querydsl.examples.kotlin.entity.QExampleEntity.exampleEntity
2222
import com.querydsl.jpa.impl.JPAQuery
23-
import org.junit.Test
23+
import org.junit.jupiter.api.Test
2424

2525
class ExampleEntityTest {
2626

querydsl-examples/querydsl-example-kotlin-mongodb/src/test/kotlin/com/querydsl/examples/kotlin/ExampleEntityTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package com.querydsl.examples.kotlin
1818

1919
import com.querydsl.examples.kotlin.entity.QExampleEntity
20-
import org.junit.Test
20+
import org.junit.jupiter.api.Test
2121

2222
class ExampleEntityTest {
2323

querydsl-examples/querydsl-example-r2dbc-sql-codegen/src/test/java/com/querydsl/example/dao/AbstractDaoTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
import com.querydsl.example.config.TestConfiguration;
44
import com.querydsl.example.config.TestDataService;
5-
import org.junit.After;
6-
import org.junit.Before;
7-
import org.junit.runner.RunWith;
5+
import org.junit.jupiter.api.AfterEach;
6+
import org.junit.jupiter.api.BeforeEach;
7+
import org.junit.jupiter.api.extension.ExtendWith;
88
import org.springframework.beans.factory.annotation.Autowired;
99
import org.springframework.test.context.ContextConfiguration;
10-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
10+
import org.springframework.test.context.junit.jupiter.SpringExtension;
1111

12-
@RunWith(SpringJUnit4ClassRunner.class)
12+
@ExtendWith(SpringExtension.class)
1313
@ContextConfiguration(classes = {TestConfiguration.class})
1414
public abstract class AbstractDaoTest {
1515

1616
@Autowired TestDataService testDataService;
1717

18-
@Before
18+
@BeforeEach
1919
public void setUp() {
2020
testDataService.addTestData();
2121
}
2222

23-
@After
23+
@AfterEach
2424
public void tearDown() throws Exception {
2525
testDataService.removeTestData();
2626
}

0 commit comments

Comments
 (0)