/**
* Tests each possible invalid value and it's substitution.
*/
@Test
public void testInvalidScoringFilter() {
final DummyRecommendationResult tag = new DummyRecommendationResult("foo", Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
final InvalidScoringFilter<DummyRecommendationResult> filter = new InvalidScoringFilter<DummyRecommendationResult>();
final SortedSet<DummyRecommendationResult> tags = new TreeSet<DummyRecommendationResult>(new RecommendationResultComparator<DummyRecommendationResult>());
tags.add(tag);
filter.alterResult(tags);
assertEquals(Integer.MAX_VALUE, tags.first().getScore(), DELTA);
assertEquals(Integer.MAX_VALUE, tags.first().getConfidence(), DELTA);
tag.setScore(Double.NEGATIVE_INFINITY);
tag.setConfidence(Double.NEGATIVE_INFINITY);
filter.alterResult(tags);
assertEquals(Integer.MIN_VALUE, tags.first().getScore(), DELTA);
assertEquals(Integer.MIN_VALUE, tags.first().getConfidence(), DELTA);
tag.setScore(Double.NaN);
tag.setConfidence(Double.NaN);
filter.alterResult(tags);
assertEquals(Integer.MIN_VALUE, tags.first().getScore(), DELTA);
assertEquals(Integer.MIN_VALUE, tags.first().getConfidence(), DELTA);