### Question:
RawMetricValues extends WindowIndexedArrays { public synchronized boolean isValid(int maxAllowedWindowsWithExtrapolation) { int currentArrayIndex = arrayIndex(currentWindowIndex()); int numValidIndicesAdjustment = _validity.get(currentArrayIndex) ? 1 : 0; boolean allIndicesValid = _validity.cardinality() - numValidIndicesAdjustment == _counts.length - 1; return allIndicesValid && numWindowsWithExtrapolation() <= maxAllowedWindowsWithExtrapolation; } RawMetricValues(int numWindowsToKeep, byte minSamplesPerWindow, int numMetricTypesInSample); synchronized void addSample(MetricSample<?, ?> sample, long windowIndex, MetricDef metricDef); synchronized void updateOldestWindowIndex(long newOldestWindowIndex); synchronized boolean isValid(int maxAllowedWindowsWithExtrapolation); synchronized int numWindowsWithExtrapolation(); synchronized boolean isValidAtWindowIndex(long windowIndex); synchronized boolean isExtrapolatedAtWindowIndex(long windowIndex); synchronized byte sampleCountsAtWindowIndex(long windowIndex); synchronized void sanityCheckWindowIndex(long windowIndex); synchronized void sanityCheckWindowRangeReset(long startingWindowIndex, int numWindowIndicesToReset); synchronized int resetWindowIndices(long startingWindowIndex, int numWindowIndicesToReset); synchronized ValuesAndExtrapolations aggregate(SortedSet<Long> windowIndices, MetricDef metricDef); synchronized ValuesAndExtrapolations peekCurrentWindow(long currentWindowIndex, MetricDef metricDef); synchronized int numSamples();  }### Answer:
@Test public void testIsValid() { RawMetricValues rawValues = new RawMetricValues(NUM_WINDOWS_TO_KEEP, MIN_SAMPLES_PER_WINDOW, NUM_RAW_METRICS); rawValues.updateOldestWindowIndex(0); MetricSample<String, IntegerEntity> m = getMetricSample(10, 10, 10); for (int i = 0; i < NUM_WINDOWS_TO_KEEP; i++) { for (int j = 0; j < MIN_SAMPLES_PER_WINDOW - 1; j++) { addSample(rawValues, m, i); } } assertTrue(rawValues.isValid(5)); assertFalse(rawValues.isValid(4)); addSample(rawValues, m, 0); assertTrue(rawValues.isValid(4)); }