### Question:
BagOfTermsWithFrequencies implements InferWithHPOHierarchy { public void addTerm(TermId termId, int count) { if (termCounts.containsKey(termId)) { termCounts.put(termId, termCounts.get(termId) + count); } else { termCounts.put(termId, count); } } BagOfTermsWithFrequencies(String patientId, Ontology hpo);  BagOfTermsWithFrequencies(String patientId, Map<TermId, Integer> termCounts, Ontology hpo); void addTerm(TermId termId, int count); String getPatientId(); Map<TermId, Integer> getOriginalTermCounts(); Map<TermId, Integer> getInferredTermCounts(); @Override void infer(); @Override String toString();  }### Answer:
@Test public void addTerm() { assertNotNull(hpo); BagOfTermsWithFrequencies bag1 = new BagOfTermsWithFrequencies(patientId, hpo); assertNotNull(bag1); bag1.addTerm(TermId.of(HP_PREFIX, "0003074"), 5); assertEquals(bag1.getOriginalTermCounts().size(), 1); bag1.addTerm(TermId.of(HP_PREFIX, "0011297"), 1); assertEquals(bag1.getOriginalTermCounts().size(), 2); bag1.addTerm(TermId.of(HP_PREFIX, "0040064"), 1); assertEquals(bag1.getOriginalTermCounts().size(), 3); }