protected static void validateTimestampColumnType(
      final Optional<String> timestampColumnName,
      final Schema avroSchema
  ) {
    if (timestampColumnName.isPresent()) {
      if (avroSchema.getField(timestampColumnName.get()) == null) {
        throw new IllegalArgumentException("The indicated timestamp field does not exist: "
            + timestampColumnName.get());
      }
      if (avroSchema.getField(timestampColumnName.get()).schema().getType() != Type.LONG) {
        throw new IllegalArgumentException("The timestamp column type should be bigint/long. "
            + timestampColumnName.get() + " type is "
            + avroSchema.getField(timestampColumnName.get()).schema().getType());
      }
    }
  }
@Test
  public void shouldThrowIfTimestampColumnDoesNotExist() throws IOException {
    // When
    final IllegalArgumentException illegalArgumentException = assertThrows(
        IllegalArgumentException.class,
        () -> DataGenProducer.validateTimestampColumnType(Optional.of("page__id"), getAvroSchema())
    );

    // Then
    assertThat(illegalArgumentException.getMessage(),
        CoreMatchers.equalTo("The indicated timestamp field does not exist: page__id") );

  }