public virtual void TestStopListPositions()
{
var stopWordsSet = Support.Compatibility.SetFactory.GetSet<string>();
stopWordsSet.Add("good");
stopWordsSet.Add("test");
stopWordsSet.Add("analyzer");
var newStop = new StopAnalyzer(Version.LUCENE_CURRENT, stopWordsSet);
var reader = new System.IO.StringReader("This is a good test of the english stop analyzer with positions");
int[] expectedIncr = { 1, 1, 1, 3, 1, 1, 1, 2, 1};
TokenStream stream = newStop.TokenStream("test", reader);
Assert.NotNull(stream);
int i = 0;
ITermAttribute termAtt = stream.GetAttribute<ITermAttribute>();
IPositionIncrementAttribute posIncrAtt = stream.AddAttribute<IPositionIncrementAttribute>();
while (stream.IncrementToken())
{
string text = termAtt.Term;
Assert.IsFalse(stopWordsSet.Contains(text));
Assert.AreEqual(expectedIncr[i++], posIncrAtt.PositionIncrement);
}
}
}