Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix logging unit tests #3630

Merged
merged 1 commit into from
Aug 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public void testPublishLevels() {
logging.write(ImmutableList.of(EMERGENCY_ENTRY), DEFAULT_OPTIONS);
expectLastCall().once();
replay(options, logging);
Handler handler = new LoggingHandler(LOG_NAME, options);
Handler handler = new LoggingHandler(LOG_NAME, options, DEFAULT_RESOURCE);
handler.setLevel(Level.ALL);
handler.setFormatter(new TestFormatter());
// default levels
Expand Down Expand Up @@ -362,7 +362,7 @@ public void testReportWriteError() {
errorManager.error(null, ex, ErrorManager.WRITE_FAILURE);
expectLastCall().once();
replay(errorManager);
Handler handler = new LoggingHandler(LOG_NAME, options);
Handler handler = new LoggingHandler(LOG_NAME, options, DEFAULT_RESOURCE);
handler.setLevel(Level.ALL);
handler.setErrorManager(errorManager);
handler.setFormatter(new TestFormatter());
Expand All @@ -388,7 +388,7 @@ public void testReportFlushError() {
expectLastCall().once();
replay(options, logging, errorManager);
LogRecord record = newLogRecord(Level.FINEST, MESSAGE);
Handler handler = new LoggingHandler(LOG_NAME, options);
Handler handler = new LoggingHandler(LOG_NAME, options, DEFAULT_RESOURCE);
handler.setLevel(Level.ALL);
handler.setErrorManager(errorManager);
handler.setFormatter(new TestFormatter());
Expand All @@ -414,7 +414,7 @@ public void testReportFormatError() {
LogRecord record = newLogRecord(Level.FINEST, MESSAGE);
expect(formatter.format(record)).andThrow(ex);
replay(errorManager, formatter);
Handler handler = new LoggingHandler(LOG_NAME, options);
Handler handler = new LoggingHandler(LOG_NAME, options, DEFAULT_RESOURCE);
handler.setLevel(Level.ALL);
handler.setErrorManager(errorManager);
handler.setFormatter(formatter);
Expand All @@ -439,7 +439,7 @@ public void testFlushLevel() {
DEFAULT_OPTIONS);
expectLastCall().once();
replay(options, logging);
LoggingHandler handler = new LoggingHandler(LOG_NAME, options);
LoggingHandler handler = new LoggingHandler(LOG_NAME, options, DEFAULT_RESOURCE);
handler.setLevel(Level.ALL);
handler.setFlushLevel(Level.WARNING);
handler.setFormatter(new TestFormatter());
Expand Down Expand Up @@ -473,7 +473,7 @@ public void testSyncWrite() {
expectLastCall().once();
replay(options, logging);

LoggingHandler handler = new LoggingHandler(LOG_NAME, options);
LoggingHandler handler = new LoggingHandler(LOG_NAME, options, DEFAULT_RESOURCE);
handler.setLevel(Level.ALL);
handler.setSynchronicity(Synchronicity.SYNC);
handler.setFormatter(new TestFormatter());
Expand All @@ -493,7 +493,7 @@ public void testAddHandler() {
logging.write(ImmutableList.of(FINEST_ENTRY), DEFAULT_OPTIONS);
expectLastCall().once();
replay(options, logging);
LoggingHandler handler = new LoggingHandler(LOG_NAME, options) {
LoggingHandler handler = new LoggingHandler(LOG_NAME, options, DEFAULT_RESOURCE) {
@Override
public void close() {
// Make close NOOP to avoid mock close exception
Expand All @@ -520,7 +520,7 @@ public void testClose() throws Exception {
logging.close();
expectLastCall().once();
replay(options, logging);
Handler handler = new LoggingHandler(LOG_NAME, options);
Handler handler = new LoggingHandler(LOG_NAME, options, DEFAULT_RESOURCE);
handler.setLevel(Level.ALL);
handler.setFormatter(new TestFormatter());
handler.publish(newLogRecord(Level.FINEST, MESSAGE));
Expand Down