protected static long extractTimestampAttribute(
      String timestampAttribute, @Nullable Map<String, String> attributes) {
    Preconditions.checkState(!timestampAttribute.isEmpty());
    String value = attributes == null ? null : attributes.get(timestampAttribute);
    checkArgument(
        value != null,
        "PubSub message is missing a value for timestamp attribute %s",
        timestampAttribute);
    Long timestampMsSinceEpoch = parseTimestampAsMsSinceEpoch(value);
    checkArgument(
        timestampMsSinceEpoch != null,
        "Cannot interpret value of attribute %s as timestamp: %s",
        timestampAttribute,
        value);
    return timestampMsSinceEpoch;
  }
@Test
  public void timestampAttributeWithNullAttributesThrowsError() {
    thrown.expect(RuntimeException.class);
    thrown.expectMessage("PubSub message is missing a value for timestamp attribute myAttribute");
    PubsubClient.extractTimestampAttribute("myAttribute", null);
  }