adoroszlai commented on code in PR #5602:
URL: https://github.com/apache/ozone/pull/5602#discussion_r1394174042
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestContainerCache.java:
##########
@@ -119,34 +113,31 @@ public void testContainerCacheEviction() throws Exception
{
// add one more reference to ContainerCache and verify that it will not
// evict the least recent entry as it has reference.
ReferenceCountedDB db4 = cache.getDB(3, "RocksDB",
- containerDir3.getPath(),
+ containerDir3.getPath(),
VersionedDatanodeFeatures.SchemaV2.chooseSchemaVersion(), conf);
assertEquals(1, db4.getReferenceCount());
assertEquals(2, cache.size());
- Assert.assertNotNull(cache.get(containerDir1.getPath()));
- Assert.assertNull(cache.get(containerDir2.getPath()));
+ Assertions.assertNotNull(cache.get(containerDir1.getPath()));
+ Assertions.assertNull(cache.get(containerDir2.getPath()));
// Now close both the references for container1
db1.close();
db2.close();
assertEquals(0, db1.getReferenceCount());
assertEquals(0, db2.getReferenceCount());
-
// The reference count for container1 is 0 but it is not evicted.
ReferenceCountedDB db5 = cache.getDB(1, "RocksDB",
- containerDir1.getPath(),
+ containerDir1.getPath(),
VersionedDatanodeFeatures.SchemaV2.chooseSchemaVersion(), conf);
- assertEquals(1, db5.getReferenceCount());
- assertEquals(db1, db5);
- db5.close();
- db4.close();
-
-
- // Decrementing reference count below zero should fail.
- thrown.expect(IllegalArgumentException.class);
- db5.close();
+ Assertions.assertThrows(IllegalArgumentException.class, () -> {
+ assertEquals(1, db5.getReferenceCount());
+ assertEquals(db1, db5);
Review Comment:
Nit: I guess these assertions could be moved out of `assertThrows()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]