NumericDoubleAnalyzer analyzer = new NumericDoubleAnalyzer(precisionStep);
final TokenStream ts1 = analyzer.tokenStream("dummy", String.valueOf(value));
final NumericTokenStream ts2 = new NumericTokenStream(precisionStep);
ts2.setDoubleValue(value);
final NumericTermAttribute numTerm1 = ts1.addAttribute(NumericTermAttribute.class);
final NumericTermAttribute numTerm2 = ts1.addAttribute(NumericTermAttribute.class);
final PositionIncrementAttribute posInc1 = ts1.addAttribute(PositionIncrementAttribute.class);
final PositionIncrementAttribute posInc2 = ts1.addAttribute(PositionIncrementAttribute.class);
ts1.reset();
ts2.reset();
while (ts1.incrementToken()) {
assertThat(ts2.incrementToken(), is(true));
assertThat(posInc1, equalTo(posInc2));
// can't use equalTo directly on the numeric attribute cause it doesn't implement equals (LUCENE-5070)
assertThat(numTerm1.getRawValue(), equalTo(numTerm2.getRawValue()));
assertThat(numTerm2.getShift(), equalTo(numTerm2.getShift()));
}
assertThat(ts2.incrementToken(), is(false));
ts1.end();
ts2.end();
}