You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2025/11/02 18:03:25 UTC
(activemq) branch main updated: Migrate DataFileAccessorPoolTest to Mockito (#1521)
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git
The following commit(s) were added to refs/heads/main by this push:
new 8815a9af3c Migrate DataFileAccessorPoolTest to Mockito (#1521)
8815a9af3c is described below
commit 8815a9af3ca864ca765d5e9d0e2cb062f4ce33cd
Author: Ken Liao <ke...@gmail.com>
AuthorDate: Sun Nov 2 10:03:19 2025 -0800
Migrate DataFileAccessorPoolTest to Mockito (#1521)
---
.../disk/journal/DataFileAccessorPoolTest.java | 23 +++++-----------------
1 file changed, 5 insertions(+), 18 deletions(-)
diff --git a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/journal/DataFileAccessorPoolTest.java b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/journal/DataFileAccessorPoolTest.java
index ec43857d23..2d33265b8c 100644
--- a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/journal/DataFileAccessorPoolTest.java
+++ b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/journal/DataFileAccessorPoolTest.java
@@ -17,41 +17,28 @@
package org.apache.activemq.store.kahadb.disk.journal;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import java.io.File;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.imposters.ByteBuddyClassImposteriser;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
public class DataFileAccessorPoolTest {
- private Mockery context;
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
- @Before
- public void setUp() throws Exception {
- context = new Mockery() {
- {
- setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
- }
- };
- }
-
@Test
public void disposeUnused() throws Exception {
- final Journal journal = context.mock(Journal.class);
+ Journal journal = mock(Journal.class);
DataFileAccessorPool underTest = new DataFileAccessorPool(journal);
- context.checking(new Expectations(){{exactly(1).of(journal).getInflightWrites();}});
-
DataFile dataFile = new DataFile(new File(temporaryFolder.getRoot(), "aa"), 1);
underTest.closeDataFileAccessor(underTest.openDataFileAccessor(dataFile));
@@ -60,7 +47,7 @@ public class DataFileAccessorPoolTest {
assertEquals("0 in the pool", 0, underTest.size());
- context.assertIsSatisfied();
+ verify(journal, times(1)).getInflightWrites();
}
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact