### Question:
FrequencyMeasurement extends BasicMeasurement { public void setFrequency(String category, Integer freq) throws IllegalArgumentException { checkCategory(category); Map<String, Integer> oldfreq = new HashMap<String,Integer>(getFrequencies()); getFrequencies().put(category, freq); updateSampleSize(); firePropertyChange(PROPERTY_FREQUENCIES, oldfreq, getFrequencies()); } private  FrequencyMeasurement();  FrequencyMeasurement(PopulationCharacteristic cv);  FrequencyMeasurement(List<String> categories, Map<String, Integer> map); void setFrequency(String category, Integer freq); Integer getFrequency(String category); String[] getCategories(); void add(FrequencyMeasurement other); boolean isOfType(VariableType type); @Override Set<Entity> getDependencies(); @Override String toString(); @Override FrequencyMeasurement clone(); @Override boolean equals(Object o); @Override int hashCode(); static final String PROPERTY_FREQUENCIES; }### Answer:
@Test public void testGetSampleSize() { d_meas.setFrequency(getCat(d_cv, 0), 5); assertEquals(null, d_meas.getSampleSize()); d_meas.setFrequency(getCat(d_cv, 1), 3); assertEquals(new Integer(8), d_meas.getSampleSize()); }
@Test public void testSetFrequency() { d_meas.setFrequency(getCat(d_cv, 0), 5); assertEquals(new Integer(5), d_meas.getFrequency(getCat(d_cv, 0))); }
@Test(expected=IllegalArgumentException.class) public void testSetFrequencyThrows() { d_meas.setFrequency("illegalCat", 0); }