@Test
public void testMaxCounts() throws Exception {

    IsotopeFactory ifac = Isotopes.getInstance();
    IIsotope c = ifac.getMajorIsotope("C");
    IIsotope h = ifac.getMajorIsotope("H");
    IIsotope n = ifac.getMajorIsotope("N");
    IIsotope o = ifac.getMajorIsotope("O");
    MolecularFormulaRange mfRange = new MolecularFormulaRange();
    mfRange.addIsotope(c, 3, 7);
    mfRange.addIsotope(h, 3, 7);
    mfRange.addIsotope(o, 3, 7);
    mfRange.addIsotope(n, 3, 7);
    // The maximal formula MF=C7H7O7N7 MW=301.0406955954
    double minMass = 250;
    double maxMass = 400;
    MolecularFormulaGenerator gen = new MolecularFormulaGenerator(builder,
            minMass, maxMass, mfRange);
    IMolecularFormulaSet mfSet = gen.getAllFormulas();
    // Check that all element counts in the formula are <= 7
    for (IMolecularFormula f : mfSet.molecularFormulas()) {
        for (IIsotope i : f.isotopes()) {
            int count = f.getIsotopeCount(i);
            Assert.assertTrue(count <= 7);
        }
    }
}