@Test
  public void testNegativeSampleTimeStamp() throws Exception {
    final StatArchiveDescriptor archiveDescriptor =
        new StatArchiveDescriptor.Builder().setArchiveName(archiveFileName).setSystemId(1)
            .setSystemStartTime(WRITER_INITIAL_DATE_MILLIS)
            .setSystemDirectoryPath(testName.getMethodName())
            .setProductDescription(getClass().getSimpleName()).build();
    final StatArchiveWriter writer = new TestStatArchiveWriter(archiveDescriptor);

    final long sampleIncNanos = NANOS_PER_MILLI * 1000;

    try {
      writer.sampled(WRITER_PREVIOUS_TIMESTAMP_NANOS - sampleIncNanos, Collections.emptyList());
      fail(
          "Expected IllegalArgumentException to be thrown from StatArchiveWriter#writeTimeStamp(long)");
    } catch (IllegalArgumentException expected) {
      // test passed
    } finally {
      writer.close();
    }
  }
Validates that IllegalArgumentException is thrown if sample time stamp is before the previous
time stamp. Tests the fix for cause of bug #45268.
geode-core/src/integrationTest/java/org/apache/geode/internal/statistics/StatArchiveWriterReaderIntegrationTest.java