Logger logger = createNiceMock(Logger.class);
SessionLogEntry severeEntry = createNiceMock(SessionLogEntry.class);
SessionLogEntry configEntry = createNiceMock(SessionLogEntry.class);
SessionLogEntry finestEntry = createNiceMock(SessionLogEntry.class);
Formatter formatter = createNiceMock(Formatter.class);
JpaLogger jpaLogger = new TestJpaLogger(logger, formatter);
// set expectations
expect(severeEntry.getLevel()).andReturn(SessionLog.SEVERE);
expect(formatter.format((LogRecord) anyObject())).andReturn("severe log message");
logger.error("severe log message");
expect(configEntry.getLevel()).andReturn(SessionLog.CONFIG);
expect(formatter.format((LogRecord) anyObject())).andReturn("config log message");
logger.info("config log message");
expect(finestEntry.getLevel()).andReturn(SessionLog.FINEST);
expect(formatter.format((LogRecord) anyObject())).andReturn("finest log message");
logger.debug("finest log message");
// replay
replay(logger, severeEntry, configEntry, finestEntry, formatter);