8000 fix logging unit tests by yihanzhen · Pull Request #3630 · googleapis/google-cloud-java · GitHub
[go: up one dir, main page]

Skip to content
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());
9932 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
0