@@ -0,0 +1,1574 @@
+package jfoley.vocabpress.feature;%0A%0Aimport jfoley.vocabpress.movement.Mover;%0Aimport jfoley.vocabpress.scoring.CountPosting;%0Aimport jfoley.vocabpress.scoring.impl.SimpleCountPosting;%0Aimport org.junit.Test;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic class MapFeatureTest %7B%0A%0A%09@Test%0A%09public void testHasFeature() throws Exception %7B%0A%09%09Map%3CInteger, CountPosting%3E priors = new HashMap%3C%3E();%0A%09%09priors.put(1, new SimpleCountPosting(1, 9));%0A%09%09priors.put(2, new SimpleCountPosting(2, 6));%0A%09%09priors.put(3, new SimpleCountPosting(3, 4));%0A%0A%09%09MapFeature%3CCountPosting%3E fpriors = new MapFeature%3C%3E(priors);%0A%0A%09%09assertTrue(fpriors.hasFeature(1));%0A%09%09assertTrue(fpriors.hasFeature(2));%0A%09%09assertTrue(fpriors.hasFeature(3));%0A%09%09assertEquals(9, fpriors.getFeature(1).getCount());%0A%09%09assertEquals(6, fpriors.getFeature(2).getCount());%0A%09%09assertEquals(4, fpriors.getFeature(3).getCount());%0A%09%7D%0A%0A%09@Test%0A%09public void testMovement() throws Exception %7B%0A%09%09Map%3CInteger, CountPosting%3E priors = new HashMap%3C%3E();%0A%09%09priors.put(1, new SimpleCountPosting(1, 9));%0A%09%09priors.put(2, new SimpleCountPosting(2, 6));%0A%09%09priors.put(3, new SimpleCountPosting(3, 4));%0A%0A%09%09MapFeature%3CCountPosting%3E fpriors = new MapFeature%3C%3E(priors);%0A%0A%09%09int count = 0;%0A%09%09for(Mover m = fpriors.getMover(); !m.isDone(); m.next()) %7B%0A%09%09%09int doc = m.currentKey();%0A%09%09%09count++;%0A%09%09%09assertEquals(priors.get(doc).getCount(), fpriors.getFeature(doc).getCount());%0A%09%09%09assertEquals(doc, fpriors.getFeature(doc).getKey());%0A%09%09%7D%0A%0A%09%09assertEquals(3, count);%0A%09%7D%0A%0A%0A%7D

Add a test for MapFeature