This is an automated email from the ASF dual-hosted git repository.

shoothzj pushed a commit to branch default-entry-log-junit5
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit 2aa3211f11201cf6fee971cbcf96fbf2b4643181
Author: ZhangJian He <[email protected]>
AuthorDate: Wed Oct 9 13:45:07 2024 +0800

    refactor: DefaultEntryLogTest to junit5
    
    Signed-off-by: ZhangJian He <[email protected]>
---
 .../bookkeeper/bookie/DefaultEntryLogTest.java     | 220 ++++++++++-----------
 1 file changed, 100 insertions(+), 120 deletions(-)

diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/DefaultEntryLogTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/DefaultEntryLogTest.java
index 4b92df528f..2f96fdf504 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/DefaultEntryLogTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/DefaultEntryLogTest.java
@@ -22,12 +22,13 @@ package org.apache.bookkeeper.bookie;
 
 import static 
org.apache.bookkeeper.bookie.storage.EntryLogTestUtils.assertEntryEquals;
 import static org.apache.bookkeeper.bookie.storage.EntryLogTestUtils.makeEntry;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.ArgumentMatchers.anyString;
@@ -41,7 +42,6 @@ import io.netty.buffer.Unpooled;
 import io.netty.buffer.UnpooledByteBufAllocator;
 import io.netty.util.ReferenceCountUtil;
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.channels.FileChannel;
@@ -72,20 +72,23 @@ import org.apache.bookkeeper.util.DiskChecker;
 import org.apache.bookkeeper.util.IOUtils;
 import org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap;
 import org.apache.commons.io.FileUtils;
-import org.junit.After;
 import org.junit.Assert;
-import org.junit.Before;
-import org.junit.FixMethodOrder;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.TestMethodOrder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Tests for EntryLog.
  */
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+@TestMethodOrder(MethodOrderer.MethodName.class)
 public class DefaultEntryLogTest {
     private static final Logger LOG = 
LoggerFactory.getLogger(DefaultEntryLogTest.class);
 
@@ -104,22 +107,22 @@ public class DefaultEntryLogTest {
     private LedgerDirsManager dirsMgr;
     private DefaultEntryLogger entryLogger;
 
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
         this.rootDir = createTempDir("bkTest", ".dir");
         this.curDir = BookieImpl.getCurrentDirectory(rootDir);
         BookieImpl.checkDirectoryStructure(curDir);
         this.conf = TestBKConfiguration.newServerConfiguration();
         this.dirsMgr = new LedgerDirsManager(
-            conf,
-            new File[] { rootDir },
-            new DiskChecker(
-                conf.getDiskUsageThreshold(),
-                conf.getDiskUsageWarnThreshold()));
+                conf,
+                new File[] { rootDir },
+                new DiskChecker(
+                        conf.getDiskUsageThreshold(),
+                        conf.getDiskUsageWarnThreshold()));
         this.entryLogger = new DefaultEntryLogger(conf, dirsMgr);
     }
 
-    @After
+    @AfterEach
     public void tearDown() throws Exception {
         if (null != this.entryLogger) {
             entryLogger.close();
@@ -138,11 +141,11 @@ public class DefaultEntryLogTest {
         // mark `curDir` as filled
         this.conf.setMinUsableSizeForEntryLogCreation(1);
         this.dirsMgr = new LedgerDirsManager(
-            conf,
-            new File[] { rootDir },
-            new DiskChecker(
-                conf.getDiskUsageThreshold(),
-                conf.getDiskUsageWarnThreshold()));
+                conf,
+                new File[] { rootDir },
+                new DiskChecker(
+                        conf.getDiskUsageThreshold(),
+                        conf.getDiskUsageWarnThreshold()));
         this.dirsMgr.addToFilledDirs(curDir);
 
         entryLogger = new DefaultEntryLogger(conf, dirsMgr);
@@ -209,11 +212,11 @@ public class DefaultEntryLogTest {
         // mark `curDir` as filled
         this.conf.setMinUsableSizeForEntryLogCreation(Long.MAX_VALUE);
         this.dirsMgr = new LedgerDirsManager(
-            conf,
-            new File[] { rootDir },
-            new DiskChecker(
-                conf.getDiskUsageThreshold(),
-                conf.getDiskUsageWarnThreshold()));
+                conf,
+                new File[] { rootDir },
+                new DiskChecker(
+                        conf.getDiskUsageThreshold(),
+                        conf.getDiskUsageWarnThreshold()));
         this.dirsMgr.addToFilledDirs(curDir);
 
         entryLogger = new DefaultEntryLogger(conf, dirsMgr);
@@ -332,28 +335,6 @@ public class DefaultEntryLogTest {
         }
     }
 
-    /**
-     * Test that EntryLogger Should fail with FNFE, if entry logger 
directories does not exist.
-     */
-    @Ignore // no longer valid as LedgerDirsManager creates the directory as 
needed
-    public void testEntryLoggerShouldThrowFNFEIfDirectoriesDoesNotExist()
-            throws Exception {
-        File tmpDir = createTempDir("bkTest", ".dir");
-        DefaultEntryLogger entryLogger = null;
-        try {
-            entryLogger = new DefaultEntryLogger(conf, new 
LedgerDirsManager(conf, new File[] { tmpDir },
-                    new DiskChecker(conf.getDiskUsageThreshold(), 
conf.getDiskUsageWarnThreshold())));
-            fail("Expecting FileNotFoundException");
-        } catch (FileNotFoundException e) {
-            assertEquals("Entry log directory '" + tmpDir +  "/current' does 
not exist", e
-                    .getLocalizedMessage());
-        } finally {
-            if (entryLogger != null) {
-                entryLogger.close();
-            }
-        }
-    }
-
     /**
      * Test to verify the DiskFull during addEntry.
      */
@@ -384,9 +365,9 @@ public class DefaultEntryLogTest {
                 
.getCurrentLogForLedger(DefaultEntryLogger.UNASSIGNED_LEDGERID).getLogFile().getParentFile());
         ledgerStorage.addEntry(generateEntry(3, 1));
         // Verify written entries
-        Assert.assertTrue(0 == generateEntry(1, 
1).compareTo(ledgerStorage.getEntry(1, 1)));
-        Assert.assertTrue(0 == generateEntry(2, 
1).compareTo(ledgerStorage.getEntry(2, 1)));
-        Assert.assertTrue(0 == generateEntry(3, 
1).compareTo(ledgerStorage.getEntry(3, 1)));
+        assertEquals(0, generateEntry(1, 
1).compareTo(ledgerStorage.getEntry(1, 1)));
+        assertEquals(0, generateEntry(2, 
1).compareTo(ledgerStorage.getEntry(2, 1)));
+        assertEquals(0, generateEntry(3, 
1).compareTo(ledgerStorage.getEntry(3, 1)));
     }
 
     /**
@@ -1014,10 +995,9 @@ public class DefaultEntryLogTest {
         /*
          * since new entryLogs are set for all the ledgers, previous entrylogs 
would be added to rotatedLogChannels
          */
-        Assert.assertEquals("Number of current active EntryLogs ", 
numOfLedgers,
-                entryLogManager.getCopyOfCurrentLogs().size());
-        Assert.assertEquals("Number of Rotated Logs ", numOfLedgers,
-                entryLogManager.getRotatedLogChannels().size());
+        assertEquals(numOfLedgers, 
entryLogManager.getCopyOfCurrentLogs().size(),
+                "Number of current active EntryLogs ");
+        assertEquals(numOfLedgers, 
entryLogManager.getRotatedLogChannels().size(), "Number of Rotated Logs ");
 
         for (long i = 0; i < numOfLedgers; i++) {
             entryLogManager.setCurrentLogForLedgerAndAddToRotate(i,
@@ -1028,38 +1008,37 @@ public class DefaultEntryLogTest {
          * again since new entryLogs are set for all the ledgers, previous 
entrylogs would be added to
          * rotatedLogChannels
          */
-        Assert.assertEquals("Number of current active EntryLogs ", 
numOfLedgers,
-                entryLogManager.getCopyOfCurrentLogs().size());
-        Assert.assertEquals("Number of Rotated Logs ", 2 * numOfLedgers,
-                entryLogManager.getRotatedLogChannels().size());
+        assertEquals(numOfLedgers, 
entryLogManager.getCopyOfCurrentLogs().size(),
+                "Number of current active EntryLogs ");
+        assertEquals(2 * numOfLedgers, 
entryLogManager.getRotatedLogChannels().size(), "Number of Rotated Logs ");
 
         for (BufferedLogChannel logChannel : 
entryLogManager.getRotatedLogChannels()) {
             entryLogManager.getRotatedLogChannels().remove(logChannel);
         }
-        Assert.assertEquals("Number of Rotated Logs ", 0, 
entryLogManager.getRotatedLogChannels().size());
+        assertEquals(0, entryLogManager.getRotatedLogChannels().size(), 
"Number of Rotated Logs ");
 
         // entrylogid is sequential
         for (long i = 0; i < numOfLedgers; i++) {
-            assertEquals("EntryLogid for Ledger " + i, 2 * numOfLedgers + i,
-                    entryLogManager.getCurrentLogForLedger(i).getLogId());
+            assertEquals(2 * numOfLedgers + i, 
entryLogManager.getCurrentLogForLedger(i).getLogId(),
+                    "EntryLogId for Ledger " + i);
         }
 
         for (long i = 2 * numOfLedgers; i < (3 * numOfLedgers); i++) {
-            assertTrue("EntryLog with logId: " + i + " should be present",
-                    entryLogManager.getCurrentLogIfPresent(i) != null);
+            assertNotNull(entryLogManager.getCurrentLogIfPresent(i),
+                    "EntryLog with logId: " + i + " should be present");
         }
     }
 
     private DefaultEntryLogger.BufferedLogChannel 
createDummyBufferedLogChannel(DefaultEntryLogger entryLogger,
                                                                                
 long logid,
                                                                                
 ServerConfiguration servConf)
-        throws IOException {
+            throws IOException {
         File tmpFile = File.createTempFile("entrylog", logid + "");
         tmpFile.deleteOnExit();
         FileChannel fc = new RandomAccessFile(tmpFile, "rw").getChannel();
         DefaultEntryLogger.BufferedLogChannel logChannel =
-            new BufferedLogChannel(UnpooledByteBufAllocator.DEFAULT, fc, 10, 
10,
-                logid, tmpFile, servConf.getFlushIntervalInBytes());
+                new BufferedLogChannel(UnpooledByteBufAllocator.DEFAULT, fc, 
10, 10,
+                        logid, tmpFile, servConf.getFlushIntervalInBytes());
         return logChannel;
     }
 
@@ -1070,13 +1049,13 @@ public class DefaultEntryLogTest {
      * of tasks are submitted to the Executor. In each task, lock of that 
ledger is acquired and then released.
      */
     private void validateLockAcquireAndRelease(int numOfLedgers, int 
numOfThreadsPerLedger,
-            EntryLogManagerForEntryLogPerLedger entryLogManager) throws 
InterruptedException {
+                                               
EntryLogManagerForEntryLogPerLedger entryLogManager)
+            throws InterruptedException {
         ExecutorService tpe = Executors.newFixedThreadPool(numOfLedgers * 
numOfThreadsPerLedger);
         CountDownLatch latchToStart = new CountDownLatch(1);
         CountDownLatch latchToWait = new CountDownLatch(1);
         AtomicInteger numberOfThreadsAcquiredLock = new AtomicInteger(0);
         AtomicBoolean irptExceptionHappened = new AtomicBoolean(false);
-        Random rand = new Random();
 
         for (int i = 0; i < numOfLedgers * numOfThreadsPerLedger; i++) {
             long ledgerId = i % numOfLedgers;
@@ -1094,7 +1073,7 @@ public class DefaultEntryLogTest {
             });
         }
 
-        assertEquals("Number Of Threads acquired Lock", 0, 
numberOfThreadsAcquiredLock.get());
+        assertEquals(0, numberOfThreadsAcquiredLock.get(), "Number Of Threads 
acquired Lock");
         latchToStart.countDown();
         Thread.sleep(1000);
         /*
@@ -1107,13 +1086,14 @@ public class DefaultEntryLogTest {
          * After acquiring the lock there must be waiting on 'latchToWait' 
latch
          */
         int currentNumberOfThreadsAcquiredLock = 
numberOfThreadsAcquiredLock.get();
-        assertTrue("Number Of Threads acquired Lock " + 
currentNumberOfThreadsAcquiredLock,
-                (currentNumberOfThreadsAcquiredLock > 0) && 
(currentNumberOfThreadsAcquiredLock <= numOfLedgers));
+        assertTrue((currentNumberOfThreadsAcquiredLock > 0) && 
(currentNumberOfThreadsAcquiredLock <= numOfLedgers),
+                "Number Of Threads acquired Lock " + 
currentNumberOfThreadsAcquiredLock);
+
         latchToWait.countDown();
         Thread.sleep(2000);
-        assertEquals("Number Of Threads acquired Lock", numOfLedgers * 
numOfThreadsPerLedger,
-                numberOfThreadsAcquiredLock.get());
-    }
+
+        assertEquals(numOfLedgers * numOfThreadsPerLedger, 
numberOfThreadsAcquiredLock.get(),
+                "Number Of Threads acquired Lock");    }
 
     /*
      * test EntryLogManager.EntryLogManagerForEntryLogPerLedger removes the
@@ -1144,7 +1124,7 @@ public class DefaultEntryLogTest {
         entryLogManager.setCurrentLogForLedgerAndAddToRotate(ledgerId, 
logChannel);
 
         BufferedLogChannel currentLogForLedger = 
entryLogManager.getCurrentLogForLedger(ledgerId);
-        assertEquals("LogChannel for ledger " + ledgerId + " should match", 
logChannel, currentLogForLedger);
+        assertEquals(logChannel, currentLogForLedger, "LogChannel for ledger " 
+ ledgerId + " should match");
 
         Thread.sleep(evictionPeriod * 1000 + 100);
         entryLogManager.doEntryLogMapCleanup();
@@ -1154,15 +1134,15 @@ public class DefaultEntryLogTest {
          * ledger should not be available anymore
          */
         currentLogForLedger = entryLogManager.getCurrentLogForLedger(ledgerId);
-        assertEquals("LogChannel for ledger " + ledgerId + " should be null", 
null, currentLogForLedger);
-        Assert.assertEquals("Number of current active EntryLogs ", 0, 
entryLogManager.getCopyOfCurrentLogs().size());
-        Assert.assertEquals("Number of rotated EntryLogs ", 1, 
entryLogManager.getRotatedLogChannels().size());
-        Assert.assertTrue("CopyOfRotatedLogChannels should contain the created 
LogChannel",
-                entryLogManager.getRotatedLogChannels().contains(logChannel));
-
-        Assert.assertTrue("since mapentry must have been evicted, it should be 
null",
-                (entryLogManager.getCacheAsMap().get(ledgerId) == null)
-                        || 
(entryLogManager.getCacheAsMap().get(ledgerId).getEntryLogWithDirInfo() == 
null));
+        assertNull(currentLogForLedger, "LogChannel for ledger " + ledgerId + 
" should be null");
+        assertEquals(0, entryLogManager.getCopyOfCurrentLogs().size(), "Number 
of current active EntryLogs ");
+        assertEquals(1, entryLogManager.getRotatedLogChannels().size(), 
"Number of rotated EntryLogs ");
+        
assertTrue(entryLogManager.getRotatedLogChannels().contains(logChannel),
+                "CopyOfRotatedLogChannels should contain the created 
LogChannel");
+
+        assertTrue((entryLogManager.getCacheAsMap().get(ledgerId) == null)
+                        || 
(entryLogManager.getCacheAsMap().get(ledgerId).getEntryLogWithDirInfo() == 
null),
+                "since map entry must have been evicted, it should be null");
     }
 
     /*
@@ -1233,9 +1213,9 @@ public class DefaultEntryLogTest {
                 long readEntryId = buf.readLong();
                 byte[] readData = new byte[buf.readableBytes()];
                 buf.readBytes(readData);
-                assertEquals("LedgerId ", ledgerId, readLedgerId);
-                assertEquals("EntryId ", entryId, readEntryId);
-                assertEquals("Entry Data ", expectedValue, new 
String(readData));
+                assertEquals(ledgerId, readLedgerId, "LedgerId ");
+                assertEquals(entryId, readEntryId, "EntryId ");
+                assertEquals(expectedValue, new String(readData), "Entry Data 
");
             }
         }
     }
@@ -1347,9 +1327,9 @@ public class DefaultEntryLogTest {
          * eviction period time, so it should not be evicted.
          */
         BufferedLogChannel currentLogForLedger = 
entryLogManager.getCurrentLogForLedger(ledgerId);
-        assertEquals("LogChannel for ledger " + ledgerId, newLogChannel, 
currentLogForLedger);
-        Assert.assertEquals("Number of current active EntryLogs ", 1, 
entryLogManager.getCopyOfCurrentLogs().size());
-        Assert.assertEquals("Number of rotated EntryLogs ", 0, 
entryLogManager.getRotatedLogChannels().size());
+        assertEquals(newLogChannel, currentLogForLedger, "LogChannel for 
ledger " + ledgerId);
+        assertEquals(1, entryLogManager.getCopyOfCurrentLogs().size(), "Number 
of current active EntryLogs ");
+        assertEquals(0, entryLogManager.getRotatedLogChannels().size(), 
"Number of rotated EntryLogs ");
     }
 
     /**
@@ -1410,23 +1390,23 @@ public class DefaultEntryLogTest {
         t.start();
         Thread.sleep(evictionPeriod * 1000 + 100);
         entryLogManager.doEntryLogMapCleanup();
-        Assert.assertFalse("Exception occurred in thread, which is not 
expected", exceptionOccurred.get());
+        assertFalse(exceptionOccurred.get(), "Exception occurred in thread, 
which is not expected");
 
         /*
          * since for more than evictionPeriod, that ledger is not accessed and 
cache is cleaned up, mapping for that
          * ledger should not be available anymore
          */
         BufferedLogChannel currentLogForLedger = 
entryLogManager.getCurrentLogForLedger(ledgerId);
-        assertEquals("LogChannel for ledger " + ledgerId + " should be null", 
null, currentLogForLedger);
+        assertNull(currentLogForLedger, "LogChannel for ledger " + ledgerId + 
" should be null");
         // expected number of current active entryLogs is 1 since we created 
entrylog for 'newLedgerId'
-        Assert.assertEquals("Number of current active EntryLogs ", 1, 
entryLogManager.getCopyOfCurrentLogs().size());
-        Assert.assertEquals("Number of rotated EntryLogs ", 1, 
entryLogManager.getRotatedLogChannels().size());
-        Assert.assertTrue("CopyOfRotatedLogChannels should contain the created 
LogChannel",
-                
entryLogManager.getRotatedLogChannels().contains(newLogChannel));
-
-        Assert.assertTrue("since mapentry must have been evicted, it should be 
null",
-                (entryLogManager.getCacheAsMap().get(ledgerId) == null)
-                        || 
(entryLogManager.getCacheAsMap().get(ledgerId).getEntryLogWithDirInfo() == 
null));
+        assertEquals(1, entryLogManager.getCopyOfCurrentLogs().size(), "Number 
of current active EntryLogs ");
+        assertEquals(1, entryLogManager.getRotatedLogChannels().size(), 
"Number of rotated EntryLogs ");
+        
assertTrue(entryLogManager.getRotatedLogChannels().contains(newLogChannel),
+                "CopyOfRotatedLogChannels should contain the created 
LogChannel");
+
+        assertTrue((entryLogManager.getCacheAsMap().get(ledgerId) == null)
+                        || 
(entryLogManager.getCacheAsMap().get(ledgerId).getEntryLogWithDirInfo() == 
null),
+                "since mapentry must have been evicted, it should be null");
     }
 
     /*
@@ -1480,7 +1460,7 @@ public class DefaultEntryLogTest {
         for (long i = 0; i < numOfActiveLedgers; i++) {
             BufferedLogChannel logChannel = 
entryLogManager.getCurrentLogForLedger(i);
             Assert.assertEquals("unpersistedBytes should be 
LOGFILE_HEADER_SIZE",
-                DefaultEntryLogger.LOGFILE_HEADER_SIZE, 
logChannel.getUnpersistedBytes());
+                    DefaultEntryLogger.LOGFILE_HEADER_SIZE, 
logChannel.getUnpersistedBytes());
         }
 
         for (int j = numEntries; j < 2 * numEntries; j++) {
@@ -1502,8 +1482,8 @@ public class DefaultEntryLogTest {
          * rotatedlogchannel and also leastUnflushedLogId should be advanced 
to numOfActiveLedgers
          */
         entryLogger.flush();
-        Assert.assertEquals("Number of rotated entrylogs", 0, 
entryLogManager.getRotatedLogChannels().size());
-        Assert.assertEquals("LeastUnflushedloggerID", numOfActiveLedgers, 
entryLogger.getLeastUnflushedLogId());
+        assertEquals(0, entryLogManager.getRotatedLogChannels().size(), 
"Number of rotated entrylogs");
+        assertEquals(numOfActiveLedgers, entryLogger.getLeastUnflushedLogId(), 
"LeastUnflushedloggerID");
 
         /*
          * after flush (flushCurrentLogs) unpersistedBytes should be 0.
@@ -1516,12 +1496,12 @@ public class DefaultEntryLogTest {
 
     @Test
     public void testSingleEntryLogCreateNewLog() throws Exception {
-        Assert.assertTrue(entryLogger.getEntryLogManager() instanceof 
EntryLogManagerForSingleEntryLog);
+        assertInstanceOf(EntryLogManagerForSingleEntryLog.class, 
entryLogger.getEntryLogManager());
         EntryLogManagerForSingleEntryLog singleEntryLog =
                 (EntryLogManagerForSingleEntryLog) 
entryLogger.getEntryLogManager();
         EntryLogManagerForSingleEntryLog mockSingleEntryLog = 
spy(singleEntryLog);
         BufferedLogChannel activeLogChannel = 
mockSingleEntryLog.getCurrentLogForLedgerForAddEntry(1, 1024, true);
-        Assert.assertTrue(activeLogChannel != null);
+        assertNotNull(activeLogChannel);
 
         verify(mockSingleEntryLog, times(1)).createNewLog(anyLong(), 
anyString());
         // `readEntryLogHardLimit` and `reachEntryLogLimit` should not call if 
new create log
@@ -1580,8 +1560,8 @@ public class DefaultEntryLogTest {
                 long entryId = buf.readLong();
                 byte[] data = new byte[buf.readableBytes()];
                 buf.readBytes(data);
-                assertEquals("LedgerId ", i, ledgerId);
-                assertEquals("EntryId ", j, entryId);
+                assertEquals(i, ledgerId, "LedgerId ");
+                assertEquals(j, entryId, "EntryId ");
                 assertEquals("Entry Data ", expectedValue, new String(data));
             }
         }
@@ -1601,8 +1581,8 @@ public class DefaultEntryLogTest {
                 long entryId = buf.readLong();
                 byte[] data = new byte[buf.readableBytes()];
                 buf.readBytes(data);
-                assertEquals("LedgerId ", i, ledgerId);
-                assertEquals("EntryId ", j, entryId);
+                assertEquals(i, ledgerId, "LedgerId ");
+                assertEquals(j, entryId, "EntryId ");
                 assertEquals("Entry Data ", expectedValue, new String(data));
             }
         }
@@ -1735,8 +1715,8 @@ public class DefaultEntryLogTest {
         DefaultEntryLogger entryLogger = new DefaultEntryLogger(conf, 
ledgerDirsManager);
         EntryLogManagerForEntryLogPerLedger entryLogManager = 
(EntryLogManagerForEntryLogPerLedger)
                 entryLogger.getEntryLogManager();
-        Assert.assertEquals("EntryLogManager class type", 
EntryLogManagerForEntryLogPerLedger.class,
-                entryLogManager.getClass());
+        assertEquals(EntryLogManagerForEntryLogPerLedger.class, 
entryLogManager.getClass(),
+                "EntryLogManager class type");
 
         entryLogger.addEntry(0L, generateEntry(0, 1));
         entryLogger.addEntry(1L, generateEntry(1, 1));
@@ -1842,7 +1822,7 @@ public class DefaultEntryLogTest {
     }
 
     public void testSwappingEntryLogManager(boolean 
initialEntryLogPerLedgerEnabled,
-            boolean laterEntryLogPerLedgerEnabled) throws Exception {
+                                            boolean 
laterEntryLogPerLedgerEnabled) throws Exception {
         ServerConfiguration conf = 
TestBKConfiguration.newServerConfiguration();
         conf.setEntryLogPerLedgerEnabled(initialEntryLogPerLedgerEnabled);
         conf.setLedgerDirNames(createAndGetLedgerDirs(2));
@@ -1917,8 +1897,8 @@ public class DefaultEntryLogTest {
                 long entryId = buf.readLong();
                 byte[] data = new byte[buf.readableBytes()];
                 buf.readBytes(data);
-                assertEquals("LedgerId ", i, ledgerId);
-                assertEquals("EntryId ", j, entryId);
+                assertEquals(i, ledgerId, "LedgerId ");
+                assertEquals(j, entryId, "EntryId ");
                 assertEquals("Entry Data ", expectedValue, new String(data));
             }
         }

Reply via email to