From d10fb9320d6703a5ef9e315106fea00380eed385 Mon Sep 17 00:00:00 2001 From: Olav Loite Date: Sat, 23 Mar 2019 12:01:22 +0100 Subject: [PATCH] added test case --- .../logging/logback/LoggingAppenderTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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");