Compare commits

...

2 Commits

Author SHA1 Message Date
Robert Knutsson 823cab764c
Merge 58f3684822 into bdbdf8d710 2026-07-29 13:36:33 +08:00
Robert Knutsson 58f3684822 NPE when Clean.apply called with null as first argument 2024-12-11 15:10:58 +01:00
1 changed files with 17 additions and 0 deletions

View File

@ -35,6 +35,7 @@ import org.apache.cassandra.utils.concurrent.AsyncPromise;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.when;
public class MemtableCleanerThreadTest
@ -111,6 +112,22 @@ public class MemtableCleanerThreadTest
stopThread();
}
@Test
public void testCleanerError() throws Exception
{
when(pool.needsCleaning()).thenReturn(false);
AsyncPromise<Boolean > fut = new AsyncPromise<>();
cleaner = () -> {
return fut;
};
Clean<> clean = new Clean<>(pool, cleaner);
Boolean res = clean.apply(null, null);
assertNull(res);
}
@Test
public void testCleanerError() throws Exception
{