diff --git a/google-cloud-clients/google-cloud-contrib/google-cloud-logging-logback/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java b/google-cloud-clients/google-cloud-contrib/google-cloud-logging-logback/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java index 5855c80177d7..b465f3ab73c9 100644 --- a/google-cloud-clients/google-cloud-contrib/google-cloud-logging-logback/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java +++ b/google-cloud-clients/google-cloud-contrib/google-cloud-logging-logback/src/test/java/com/google/cloud/logging/logback/LoggingAppenderTest.java @@ -31,6 +31,7 @@ import com.google.cloud.logging.LogEntry; import com.google.cloud.logging.Logging; import com.google.cloud.logging.Logging.WriteOption; +import com.google.cloud.logging.LoggingOptions; import com.google.cloud.logging.Payload.StringPayload; import com.google.cloud.logging.Severity; import com.google.common.collect.ImmutableMap; @@ -211,6 +212,20 @@ public void testMdcValuesAreConvertedToLabels() { assertThat(capturedArgument.getValue().iterator().next()).isEqualTo(logEntry); } + @Test + public void testCreateLoggingOptions() { + LoggingAppender appender = + new LoggingAppender() { + @Override + public LoggingOptions createLoggingOptions() { + return LoggingOptions.newBuilder().setProjectId(projectId).build(); + } + }; + assertThat(appender.getProjectId()).isEqualTo(projectId); + appender.start(); + assertThat(appender.isStarted()).isTrue(); + } + private LoggingEvent createLoggingEvent(Level level, long timestamp) { LoggingEvent loggingEvent = new LoggingEvent(); loggingEvent.setMessage("this is a test");