The MongoDB Appender should use keys and values from a Log4j MapMessage.
Fix up mocks.
*/
package org.apache.logging.log4j.core.appender.db;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.BDDMockito.then;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+
+import java.io.Serializable;
import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.core.Filter;
@@ -25,13 +36,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.same;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.BDDMockito.then;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.reset;
-
@RunWith(MockitoJUnitRunner.class)
public class AbstractDatabaseAppenderTest {
private LocalAbstractDatabaseAppender appender;
@@ -95,20 +99,20 @@ public class AbstractDatabaseAppenderTest {
appender.append(event1);
then(manager).should().connectAndStart();
- then(manager).should().writeInternal(same(event1), null);
+ then(manager).should().writeInternal(same(event1), (Serializable) isNull());
then(manager).should().commitAndClose();
reset(manager);
appender.append(event2);
then(manager).should().connectAndStart();
- then(manager).should().writeInternal(same(event2), null);
+ then(manager).should().writeInternal(same(event2), (Serializable) isNull());
then(manager).should().commitAndClose();
}
private static abstract class LocalAbstractDatabaseManager extends AbstractDatabaseManager {
public LocalAbstractDatabaseManager(final String name, final int bufferSize) {
- super(name, bufferSize);
+ super(name, bufferSize;
}
}
