Skip to content

Commit aa80404

Browse files
committed
HSEARCH-5369 Cleanup the Junit 4 remains
1 parent 0c3c3ac commit aa80404

File tree

9 files changed

+31
-18
lines changed

9 files changed

+31
-18
lines changed

build/config/src/main/resources/forbidden-internal.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ org.junit.AfterClass @ Use JUnit 5 instead
4343
org.junit.Rule @ Use JUnit 5 instead
4444
org.junit.ClassRule @ Use JUnit 5 instead
4545
org.junit.Ignore @ Use JUnit 5 instead
46+
org.junit.Assume @ Use JUnit 5 instead
4647

4748
################################################################################################################
4849
# Unsafe API/SPI from Hibernate ORM

build/parents/build/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@
129129

130130
<!-- >>> Common -->
131131
<version.log4j>2.24.3</version.log4j>
132-
<version.junit>4.13.2</version.junit>
133132
<version.junit-jupiter>5.12.2</version.junit-jupiter>
134133
<version.junit-platform-suite-engine>1.10.0</version.junit-platform-suite-engine>
135134
<version.org.osgi.core>6.0.0</version.org.osgi.core>

integrationtest/mapper/orm-jakarta-batch/src/test/java/org/hibernate/search/integrationtest/jakarta/batch/massindexing/MassIndexingJobIT.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import static org.assertj.core.api.Assertions.assertThat;
88
import static org.assertj.core.api.Assertions.entry;
99
import static org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmUtils.with;
10-
import static org.junit.Assume.assumeTrue;
10+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
1111

1212
import java.util.ArrayList;
1313
import java.util.List;
@@ -214,10 +214,11 @@ void indexedEmbeddedCollection() throws InterruptedException {
214214
void indexedEmbeddedCollection_idFetchSize_entityFetchSize_mysql() throws InterruptedException {
215215
Dialect dialect = emf.unwrap( SessionFactoryImplementor.class ).getJdbcServices()
216216
.getJdbcEnvironment().getDialect();
217-
assumeTrue( "This test only makes sense on MySQL,"
218-
+ " which is the only JDBC driver that accepts (and, in a sense, requires)"
219-
+ " passing Integer.MIN_VALUE for the JDBC fetch size",
220-
dialect instanceof MySQLDialect && !( dialect instanceof MariaDBDialect ) );
217+
assumeTrue( dialect instanceof MySQLDialect && !( dialect instanceof MariaDBDialect ),
218+
"This test only makes sense on MySQL,"
219+
+ " which is the only JDBC driver that accepts (and, in a sense, requires)"
220+
+ " passing Integer.MIN_VALUE for the JDBC fetch size"
221+
);
221222

222223
List<CompanyGroup> groupsContainingGoogle =
223224
JobTestUtil.findIndexedResults( emf, CompanyGroup.class, "companies.name", "Google" );

integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/schema/management/ElasticsearchSchemaManagerExporterIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import static org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.dialect.ElasticsearchTestDialect.isActualVersion;
88
import static org.hibernate.search.util.impl.test.JsonHelper.assertJsonEquals;
99
import static org.hibernate.search.util.impl.test.JsonHelper.assertJsonEqualsIgnoringUnknownFields;
10-
import static org.junit.Assume.assumeFalse;
10+
import static org.junit.jupiter.api.Assumptions.assumeFalse;
1111

1212
import java.io.IOException;
1313
import java.nio.file.Files;
@@ -46,11 +46,11 @@ class ElasticsearchSchemaManagerExporterIT {
4646
@Test
4747
void elasticsearch() throws IOException {
4848
assumeFalse(
49-
"Older versions of Elasticsearch would not match the mappings",
5049
isActualVersion(
5150
esVersion -> esVersion.isLessThan( "7.0" ),
5251
osVersion -> false
53-
)
52+
),
53+
"Older versions of Elasticsearch would not match the mappings"
5454
);
5555
String version = ElasticsearchTestDialect.getActualVersion().toString();
5656
entityManagerFactory = setupHelper.start()

integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/AutomaticIndexingBasicIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package org.hibernate.search.integrationtest.mapper.orm.automaticindexing;
66

77
import static org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmUtils.with;
8-
import static org.junit.Assume.assumeTrue;
8+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
99

1010
import java.util.function.Consumer;
1111

@@ -102,8 +102,8 @@ void directPersistUpdateDelete() {
102102

103103
@Test
104104
void rollback_discardPreparedWorks() {
105-
assumeTrue( "This test only makes sense if entities are processed in-session",
106-
ormSetupHelper.areEntitiesProcessedInSession() );
105+
assumeTrue( ormSetupHelper.areEntitiesProcessedInSession(),
106+
"This test only makes sense if entities are processed in-session" );
107107

108108
with( sessionFactory ).runNoTransaction( session -> {
109109
Transaction trx = session.beginTransaction();

integrationtest/v5migrationhelper/orm/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
<dependency>
5454
<groupId>org.hibernate.orm</groupId>
5555
<artifactId>hibernate-testing</artifactId>
56+
<exclusions>
57+
<exclusion>
58+
<groupId>junit</groupId>
59+
<artifactId>junit</artifactId>
60+
</exclusion>
61+
</exclusions>
5662
<scope>test</scope>
5763
</dependency>
5864
</dependencies>

integrationtest/v5migrationhelper/orm/src/test/java/org/hibernate/search/test/bridge/UnresolvedBridgeTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*/
55
package org.hibernate.search.test.bridge;
66

7-
import static org.junit.Assert.assertTrue;
8-
import static org.junit.Assert.fail;
7+
import static org.assertj.core.api.Assertions.assertThat;
8+
import static org.junit.jupiter.api.Assertions.fail;
99

1010
import java.util.HashMap;
1111
import java.util.Map;
@@ -52,7 +52,7 @@ else if ( ee instanceof SearchException ) {
5252
}
5353
ee = ee.getCause();
5454
}
55-
assertTrue( hasSearchException );
55+
assertThat( hasSearchException ).isTrue();
5656
}
5757
}
5858

integrationtest/v5migrationhelper/orm/src/test/java/org/hibernate/search/test/engine/TransactionSynchronizationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
package org.hibernate.search.test.engine;
77

8-
import static org.junit.Assert.assertTrue;
9-
import static org.junit.Assert.fail;
8+
import static org.junit.jupiter.api.Assertions.assertTrue;
9+
import static org.junit.jupiter.api.Assertions.fail;
1010

1111
import jakarta.persistence.Entity;
1212
import jakarta.persistence.GeneratedValue;
@@ -48,7 +48,7 @@ void testProperExceptionPropagation() {
4848
raised = true;
4949
transaction.rollback();
5050
}
51-
assertTrue( "An exception should have been raised", raised );
51+
assertTrue( raised, "An exception should have been raised" );
5252
fts.close();
5353
}
5454

util/internal/integrationtest/mapper/orm/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
<dependency>
4747
<groupId>org.hibernate.orm</groupId>
4848
<artifactId>hibernate-testing</artifactId>
49+
<exclusions>
50+
<exclusion>
51+
<groupId>junit</groupId>
52+
<artifactId>junit</artifactId>
53+
</exclusion>
54+
</exclusions>
4955
</dependency>
5056
<dependency>
5157
<groupId>org.testcontainers</groupId>

0 commit comments

Comments
 (0)