Skip to content

Commit 23d784f

Browse files
committed
HHH-19847 - Drop JUnit 4 support: removed some leftover junit4 references from jcache + a few very minor cleanups
Signed-off-by: Jan Schatteman <[email protected]>
1 parent ad1be82 commit 23d784f

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

hibernate-jcache/src/test/java/org/hibernate/orm/test/caching/CacheableNaturalIdTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import jakarta.persistence.Entity;
2222
import jakarta.persistence.Id;
2323

24-
import static org.junit.Assert.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertEquals;
2525

2626
/**
2727
* @author Vlad Mihalcea

hibernate-jcache/src/test/java/org/hibernate/orm/test/caching/SecondLevelCacheTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
import static org.hibernate.jpa.HibernateHints.HINT_CACHEABLE;
3737
import static org.hibernate.jpa.HibernateHints.HINT_CACHE_REGION;
38-
import static org.junit.Assert.assertNotNull;
38+
import static org.junit.jupiter.api.Assertions.assertNotNull;
3939

4040

4141
/**
@@ -74,7 +74,7 @@ public void testCache(EntityManagerFactoryScope scope) {
7474
log.info("Native load by id");
7575
Session session = entityManager.unwrap(Session.class);
7676
//tag::caching-entity-native-example[]
77-
Person person = session.get(Person.class, 1L);
77+
Person person = session.find(Person.class, 1L);
7878
//end::caching-entity-native-example[]
7979
});
8080

@@ -208,7 +208,7 @@ public void testCache(EntityManagerFactoryScope scope) {
208208
Session session = entityManager.unwrap(Session.class);
209209
//tag::caching-management-cache-mode-entity-native-example[]
210210
session.setCacheMode(CacheMode.REFRESH);
211-
Person person = session.get(Person.class, 1L);
211+
Person person = session.find(Person.class, 1L);
212212
//end::caching-management-cache-mode-entity-native-example[]
213213
});
214214

hibernate-jcache/src/test/java/org/hibernate/orm/test/jcache/HibernateCacheTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void testQueryCacheInvalidation() {
5757

5858
s = sessionFactory().openSession();
5959
t = s.beginTransaction();
60-
i = s.get( Item.class, i.getId() );
60+
i = s.find( Item.class, i.getId() );
6161

6262
assertThat( slcs.getHitCount(), equalTo( 1L ) );
6363
assertThat( slcs.getMissCount(), equalTo( 0L ) );
@@ -117,8 +117,6 @@ public void testStaleWritesLeaveCacheConsistent() {
117117
txn.commit();
118118
s.close();
119119

120-
Long initialVersion = item.getVersion();
121-
122120
// manually revert the version property
123121
item.setVersion( item.getVersion() - 1 );
124122

@@ -209,7 +207,7 @@ public void testGeneralUsage() {
209207
mgr.addEmailToPerson( steveId, "[email protected]" );
210208
mgr.addEmailToPerson( steveId, "[email protected]" );
211209
mgr.addTalismanToPerson( steveId, "rabbit foot" );
212-
mgr.addTalismanToPerson( steveId, "john de conqueroo" );
210+
mgr.addTalismanToPerson( steveId, "john de conqueror" );
213211

214212
PhoneNumber p1 = new PhoneNumber();
215213
p1.setNumberType( "Office" );

hibernate-jcache/src/test/java/org/hibernate/orm/test/jcache/InsertedDataTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void testInsertWithRefreshThenRollback() {
226226
inTransaction(
227227
sessionFactory,
228228
s -> {
229-
CacheableItem item = s.get( CacheableItem.class, 1L );
229+
CacheableItem item = s.find( CacheableItem.class, 1L );
230230
assertNull( item, "it should be null" );
231231
}
232232
);
@@ -280,7 +280,7 @@ public void testInsertWithClearThenRollback() {
280280
s.persist( item );
281281
s.flush();
282282
s.clear();
283-
item = s.get( CacheableItem.class, item.getId() );
283+
s.find( CacheableItem.class, item.getId() );
284284
s.getTransaction().markRollbackOnly();
285285
}
286286
);
@@ -290,7 +290,7 @@ public void testInsertWithClearThenRollback() {
290290
inTransaction(
291291
sessionFactory,
292292
s -> {
293-
final CacheableItem item = s.get( CacheableItem.class, 1L );
293+
final CacheableItem item = s.find( CacheableItem.class, 1L );
294294
assertNull( item, "it should be null" );
295295
}
296296
);
@@ -308,7 +308,7 @@ public void testInsertWithClearThenRollback2() {
308308
s.persist( item );
309309
s.flush();
310310
s.clear();
311-
item = s.get( CacheableEmbeddedIdItem.class, item.getId() );
311+
s.find( CacheableEmbeddedIdItem.class, item.getId() );
312312
s.getTransaction().markRollbackOnly();
313313
}
314314
);
@@ -318,7 +318,7 @@ public void testInsertWithClearThenRollback2() {
318318
inTransaction(
319319
sessionFactory,
320320
s -> {
321-
final CacheableEmbeddedIdItem item = s.get( CacheableEmbeddedIdItem.class, new PK( 2l ) );
321+
final CacheableEmbeddedIdItem item = s.find( CacheableEmbeddedIdItem.class, new PK( 2l ) );
322322
assertNull( item, "it should be null" );
323323
}
324324
);

hibernate-jcache/src/test/java/org/hibernate/orm/test/jcache/RefreshUpdatedDataTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,19 @@ public void testUpdateAndFlushThenRefresh() {
130130
s1 -> {
131131
final String AFTER = "after";
132132

133-
ReadWriteCacheableItem readWriteCacheableItem1 = s1.get( ReadWriteCacheableItem.class, 1L );
133+
ReadWriteCacheableItem readWriteCacheableItem1 = s1.find( ReadWriteCacheableItem.class, 1L );
134134
readWriteCacheableItem1.setName( AFTER );
135135
readWriteCacheableItem1.getTags().remove("ORM");
136136

137-
ReadWriteVersionedCacheableItem readWriteVersionedCacheableItem1 = s1.get( ReadWriteVersionedCacheableItem.class, 1L );
137+
ReadWriteVersionedCacheableItem readWriteVersionedCacheableItem1 = s1.find( ReadWriteVersionedCacheableItem.class, 1L );
138138
readWriteVersionedCacheableItem1.setName( AFTER );
139139
readWriteVersionedCacheableItem1.getTags().remove("ORM");
140140

141-
NonStrictReadWriteCacheableItem nonStrictReadWriteCacheableItem1 = s1.get( NonStrictReadWriteCacheableItem.class, 1L );
141+
NonStrictReadWriteCacheableItem nonStrictReadWriteCacheableItem1 = s1.find( NonStrictReadWriteCacheableItem.class, 1L );
142142
nonStrictReadWriteCacheableItem1.setName( AFTER );
143143
nonStrictReadWriteCacheableItem1.getTags().remove("ORM");
144144

145-
NonStrictReadWriteVersionedCacheableItem nonStrictReadWriteVersionedCacheableItem1 = s1.get( NonStrictReadWriteVersionedCacheableItem.class, 1L );
145+
NonStrictReadWriteVersionedCacheableItem nonStrictReadWriteVersionedCacheableItem1 = s1.find( NonStrictReadWriteVersionedCacheableItem.class, 1L );
146146
nonStrictReadWriteVersionedCacheableItem1.setName( AFTER );
147147
nonStrictReadWriteVersionedCacheableItem1.getTags().remove("ORM");
148148

@@ -164,10 +164,10 @@ public void testUpdateAndFlushThenRefresh() {
164164
inTransaction(
165165
sessionFactory,
166166
s2 -> {
167-
ReadWriteCacheableItem readWriteCacheableItem2 = s2.get( ReadWriteCacheableItem.class, 1L );
168-
ReadWriteVersionedCacheableItem readWriteVersionedCacheableItem2 = s2.get( ReadWriteVersionedCacheableItem.class, 1L );
169-
NonStrictReadWriteCacheableItem nonStrictReadWriteCacheableItem2 = s2.get( NonStrictReadWriteCacheableItem.class, 1L );
170-
NonStrictReadWriteVersionedCacheableItem nonStrictReadWriteVersionedCacheableItem2 = s2.get( NonStrictReadWriteVersionedCacheableItem.class, 1L );
167+
ReadWriteCacheableItem readWriteCacheableItem2 = s2.find( ReadWriteCacheableItem.class, 1L );
168+
ReadWriteVersionedCacheableItem readWriteVersionedCacheableItem2 = s2.find( ReadWriteVersionedCacheableItem.class, 1L );
169+
NonStrictReadWriteCacheableItem nonStrictReadWriteCacheableItem2 = s2.find( NonStrictReadWriteCacheableItem.class, 1L );
170+
NonStrictReadWriteVersionedCacheableItem nonStrictReadWriteVersionedCacheableItem2 = s2.find( NonStrictReadWriteVersionedCacheableItem.class, 1L );
171171

172172
assertEquals( BEFORE, readWriteCacheableItem2.getName() );
173173
assertEquals( 2, readWriteCacheableItem2.getTags().size() );

0 commit comments

Comments
 (0)