Skip to content

Commit

Permalink
added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed Mar 23, 2019
1 parent c4fd4da commit d10fb93
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit d10fb93

Please sign in to comment.